Bug 2036826
| Summary: | `oc adm prune deployments` can prune the RC/RS | ||
|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | zhou ying <yinzhou> |
| Component: | oc | Assignee: | Ross Peoples <rpeoples> |
| oc sub component: | oc | QA Contact: | zhou ying <yinzhou> |
| Status: | CLOSED ERRATA | Docs Contact: | |
| Severity: | high | ||
| Priority: | high | CC: | aos-bugs, maszulik, mfojtik |
| Version: | 4.10 | ||
| Target Milestone: | --- | ||
| Target Release: | 4.10.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-03-11 18:15:11 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
zhou ying
2022-01-04 06:20:20 UTC
Are there any associated Deployments or DeploymentConfigs? If not, can you try adding the `--orphans` flag? I think I found the issue, PR submitted for testing. [root@localhost ~]# oc version --client
Client Version: 4.10.0-202201102246.p0.g293b52e.assembly.stream-293b52e
[root@localhost ~]# oc get rc
NAME DESIRED CURRENT READY AGE
my-dc-1 0 0 0 3h20m
my-dc-10 0 0 0 70m
my-dc-11 0 0 0 10m
my-dc-2 0 0 0 3h20m
my-dc-3 0 0 0 3h17m
my-dc-4 0 0 0 3h16m
my-dc-5 0 0 0 3h14m
my-dc-6 0 0 0 3h11m
my-dc-7 0 0 0 3h9m
my-dc-8 0 0 0 3h7m
my-dc-9 1 1 1 71m
[root@localhost ~]# oc adm prune deployments --confirm=true --keep-complete=2 --keep-failed=1 --keep-younger-than=1m
NAMESPACE NAME
zhout my-dc-6
zhout my-dc-5
zhout my-dc-4
zhout my-dc-3
zhout my-dc-2
zhout my-dc-1
zhout my-dc-10
[root@localhost ~]# oc get rc
NAME DESIRED CURRENT READY AGE
my-dc-11 0 0 0 11m
my-dc-7 0 0 0 3h10m
my-dc-8 0 0 0 3h8m
my-dc-9 1 1 1 72m
[root@localhost ~]# oc get rs --sort-by='{.metadata.creationTimestamp}'
NAME DESIRED CURRENT READY AGE
hello-openshift-b97f9584b 0 0 0 29m
hello-openshift-64746b5c7b 0 0 0 27m
hello-openshift-f58c964df 0 0 0 24m
hello-openshift-54c7d9b5fd 0 0 0 22m
hello-openshift-768995fdcf 0 0 0 20m
hello-openshift-9cc9fd576 0 0 0 19m
hello-openshift-7965bf8cdf 0 0 0 18m
hello-openshift-8447df5bfd 0 0 0 16m
hello-openshift-55bf5dc7f 15 15 15 15m
hello-openshift-66bd77f944 0 0 0 15m
hello-openshift-7579f658f9 10 10 0 14m
[root@localhost ~]# oc adm prune deployments --keep-younger-than=1m --replica-sets=true --keep-complete=2
Dry run enabled - no modifications will be made. Add --confirm to remove deployments
NAMESPACE NAME
zhout hello-openshift-7965bf8cdf
zhout hello-openshift-9cc9fd576
zhout hello-openshift-768995fdcf
zhout hello-openshift-54c7d9b5fd
zhout hello-openshift-f58c964df
zhout hello-openshift-64746b5c7b
[root@localhost ~]# oc get rs --sort-by='{.metadata.creationTimestamp}'
NAME DESIRED CURRENT READY AGE
hello-openshift-b97f9584b 0 0 0 29m
hello-openshift-64746b5c7b 0 0 0 28m
hello-openshift-f58c964df 0 0 0 24m
hello-openshift-54c7d9b5fd 0 0 0 22m
hello-openshift-768995fdcf 0 0 0 20m
hello-openshift-9cc9fd576 0 0 0 19m
hello-openshift-7965bf8cdf 0 0 0 18m
hello-openshift-8447df5bfd 0 0 0 17m
hello-openshift-55bf5dc7f 15 15 15 15m
hello-openshift-66bd77f944 0 0 0 15m
hello-openshift-7579f658f9 10 10 0 14m
[root@localhost ~]# oc adm prune deployments --keep-younger-than=1m --replica-sets=true --keep-complete=2 --confirm
NAMESPACE NAME
zhout hello-openshift-7965bf8cdf
zhout hello-openshift-9cc9fd576
zhout hello-openshift-768995fdcf
zhout hello-openshift-54c7d9b5fd
zhout hello-openshift-f58c964df
zhout hello-openshift-64746b5c7b
[root@localhost ~]# oc get rs --sort-by='{.metadata.creationTimestamp}'
NAME DESIRED CURRENT READY AGE
hello-openshift-b97f9584b 0 0 0 31m
hello-openshift-8447df5bfd 0 0 0 19m
hello-openshift-55bf5dc7f 15 15 15 18m
hello-openshift-66bd77f944 0 0 0 18m
hello-openshift-7579f658f9 10 10 0 17m
|