8.3. Pruning DeploymentConfig objects

In order to prune DeploymentConfig objects that are no longer required by the system due to age and status, administrators can run the following command:

$ oc adm prune deployments [<options>]

表 8.2. Prune deployments CLI configuration options

OptionDescription

--confirm

Indicate that pruning should occur, instead of performing a dry-run.

--orphans

Prune all deployments that no longer have a DeploymentConfig object, has status of Complete or Failed, and has a replica count of zero.

--keep-complete=<N>

Per the DeploymentConfig object, keep the last N deployments that have a status of Complete and replica count of zero. (default 5)

--keep-failed=<N>

Per the DeploymentConfig object, keep the last N deployments that have a status of Failed and replica count of zero. (default 1)

--keep-younger-than=<duration>

Do not prune any object that is younger than <duration> relative to the current time. (default 60m) Valid units of measurement include nanoseconds (ns), microseconds (us), milliseconds (ms), seconds (s), minutes (m), and hours (h).

To see what a pruning operation would delete:

$ oc adm prune deployments --orphans --keep-complete=5 --keep-failed=1 \
    --keep-younger-than=60m

To actually perform the prune operation:

$ oc adm prune deployments --orphans --keep-complete=5 --keep-failed=1 \
    --keep-younger-than=60m --confirm