Skip to content

Commit b1c90cf

Browse files
committed
Add pruning topics to 4.0
1 parent a1b47e8 commit b1c90cf

12 files changed

+773
-2
lines changed

_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ Topics:
177177
File: idling-applications
178178
- Name: Extending the Kubernetes API with CRDs
179179
File: crd-extending-api-with-crds
180+
- Name: Pruning objects
181+
File: pruning-objects
180182
---
181183
Name: Networking
182184
Dir: networking

masters/idling-applications.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[id='idling_applications']
1+
[id='idling-applications']
22
= Idling applications
33
include::modules/common-attributes.adoc[]
44
:context: idling-applications

masters/pruning-objects.adoc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[id='pruning-objects']
2+
= Pruning objects
3+
include::modules/common-attributes.adoc[]
4+
:context: pruning-objects
5+
6+
toc::[]
7+
8+
{nbsp} +
9+
Over time, API objects created in {product-title} can accumulate in the etcd
10+
data store through normal user operations, such as when building and deploying
11+
applications.
12+
13+
Cluster administrators can periodically prune older versions of objects from the
14+
cluster that are no longer needed. For example, by pruning images you can delete
15+
older images and layers that are no longer in use, but are still taking up disk
16+
space.
17+
18+
include::modules/pruning-basic-operations.adoc[leveloffset=+1]
19+
include::modules/pruning-groups.adoc[leveloffset=+1]
20+
include::modules/pruning-deployments.adoc[leveloffset=+1]
21+
include::modules/pruning-builds.adoc[leveloffset=+1]
22+
.Additional resources
23+
- xref:../builds/advanced-build-operations.adoc#builds-build-pruning-advanced-build-operations[Performing advanced builds -> Pruning builds]
24+
25+
include::modules/pruning-images.adoc[leveloffset=+1]
26+
.Additional resources
27+
- xref:../registry/accessing-the-registry.adoc#accessing-the-registry[Accessing the registry]
28+
- xref:../registry/securing-exposing-registry.adoc#securing-exposing-registry[Securing and exposing the registry]
29+
30+
include::modules/pruning-hard-pruning-registry.adoc[leveloffset=+1]
31+
include::modules/pruning-cronjobs.adoc[leveloffset=+1]
32+
.Additional resources
33+
- xref:../nodes/nodes-nodes-jobs.adoc#nodes-nodes-jobs_nodes-nodes-jobs[Running tasks in pods using jobs]
34+
- xref:../masters/quotas-setting-across-multiple-projects.adoc#setting-quotas-across-multiple-projects[Setting resource quotas across multiple projects]
35+
- xref:../authentication/using-rbac.adoc#using-rbac[Using RBAC to define and apply permissions]

modules/pruning-basic-operations.adoc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * masters/pruning-objects.adoc
4+
5+
[id='pruning-basic-operations-{context}']
6+
= Basic pruning operations
7+
8+
The CLI groups prune operations under a common parent command:
9+
10+
----
11+
$ oc adm prune <object_type> <options>
12+
----
13+
14+
This specifies:
15+
16+
- The `<object_type>` to perform the action on, such as `groups`, `builds`,
17+
`deployments`, or `images`.
18+
- The `<options>` supported to prune that object type.

modules/pruning-builds.adoc

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * masters/pruning-objects.adoc
4+
5+
[id='pruning-builds-{context}']
6+
= Pruning builds
7+
8+
In order to prune builds that are no longer required by the system due to age
9+
and status, administrators can run the following command:
10+
11+
----
12+
$ oc adm prune builds [<options>]
13+
----
14+
15+
.Prune builds CLI configuration options
16+
[cols="4,8",options="header"]
17+
|===
18+
19+
|Option |Description
20+
21+
.^|`--confirm`
22+
|Indicate that pruning should occur, instead of performing a dry-run.
23+
24+
.^|`--orphans`
25+
|Prune all builds whose Build Configuration no longer exists, status is complete,
26+
failed, error, or canceled.
27+
28+
.^|`--keep-complete=<N>`
29+
|Per Build Configuration, keep the last `N` builds whose status is complete (default
30+
`5`).
31+
32+
.^|`--keep-failed=<N>`
33+
|Per Build Configuration, keep the last `N` builds whose status is failed, error, or
34+
canceled (default `1`).
35+
36+
.^|`--keep-younger-than=<duration>`
37+
|Do not prune any object that is younger than `<duration>` relative to the
38+
current time (default `60m`).
39+
|===
40+
41+
To see what a pruning operation would delete:
42+
43+
----
44+
$ oc adm prune builds --orphans --keep-complete=5 --keep-failed=1 \
45+
--keep-younger-than=60m
46+
----
47+
48+
To actually perform the prune operation:
49+
50+
----
51+
$ oc adm prune builds --orphans --keep-complete=5 --keep-failed=1 \
52+
--keep-younger-than=60m --confirm
53+
----
54+
55+
[NOTE]
56+
====
57+
Developers can enable automatic build pruning by modifying their Build
58+
Configuration.
59+
====

modules/pruning-cronjobs.adoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * masters/pruning-objects.adoc
4+
5+
[id='pruning-cronjobs-{context}']
6+
= Pruning cron jobs
7+
8+
Cron jobs can perform pruning of successful jobs, but might not properly handle
9+
failed jobs. Therefore, the cluster administrator should perform regular cleanup of
10+
jobs manually. They should also restrict the access to cron jobs to a small
11+
group of trusted users and set appropriate quota to prevent the cron job from
12+
creating too many jobs and pods.

modules/pruning-deployments.adoc

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * masters/pruning-objects.adoc
4+
5+
[id='pruning-deployments-{context}']
6+
= Pruning deployments
7+
8+
In order to prune deployments that are no longer required by the system due to
9+
age and status, administrators can run the following command:
10+
11+
----
12+
$ oc adm prune deployments [<options>]
13+
----
14+
15+
.Prune deployments CLI configuration options
16+
[cols="4,8",options="header"]
17+
|===
18+
19+
|Option |Description
20+
21+
.^|`--confirm`
22+
|Indicate that pruning should occur, instead of performing a dry-run.
23+
24+
.^|`--orphans`
25+
|Prune all deployments that no longer have a Deployment Configuration, has status
26+
is `Complete` or `Failed`, and has a replica count of zero.
27+
28+
.^|`--keep-complete=<N>`
29+
|Per Deployment Configuration, keep the last `N` deployments that have a status
30+
of `Complete` and replica count of zero. (default `5`)
31+
32+
.^|`--keep-failed=<N>`
33+
|Per Deployment Configuration, keep the last `N` deployments that have a status
34+
of `Failed` and replica count of zero. (default `1`)
35+
36+
.^|`--keep-younger-than=<duration>`
37+
|Do not prune any object that is younger than `<duration>` relative to the
38+
current time. (default `60m`) Valid units of measurement include nanoseconds
39+
(`ns`), microseconds (`us`), milliseconds (`ms`), seconds (`s`), minutes (`m`),
40+
and hours (`h`).
41+
|===
42+
43+
To see what a pruning operation would delete:
44+
45+
----
46+
$ oc adm prune deployments --orphans --keep-complete=5 --keep-failed=1 \
47+
--keep-younger-than=60m
48+
----
49+
50+
To actually perform the prune operation:
51+
52+
----
53+
$ oc adm prune deployments --orphans --keep-complete=5 --keep-failed=1 \
54+
--keep-younger-than=60m --confirm
55+
----

modules/pruning-groups.adoc

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * masters/pruning-objects.adoc
4+
5+
[id='pruning-groups-{context}']
6+
= Pruning groups
7+
8+
To prune groups records from an external provider, administrators can run the
9+
following command:
10+
11+
----
12+
$ oc adm prune groups \
13+
--sync-config=path/to/sync/config [<options>]
14+
----
15+
16+
.Prune groups CLI configuration options
17+
[cols="4,8",options="header"]
18+
|===
19+
20+
|Options |Description
21+
22+
.^|`--confirm`
23+
|Indicate that pruning should occur, instead of performing a dry-run.
24+
25+
.^|`--blacklist`
26+
|Path to the group blacklist file.
27+
28+
.^|`--whitelist`
29+
|Path to the group whitelist file.
30+
31+
.^|`--sync-config`
32+
|Path to the synchronization configuration file.
33+
|===
34+
35+
To see the groups that the prune command deletes:
36+
37+
----
38+
$ oc adm prune groups --sync-file=ldap-sync-config.yaml
39+
----
40+
41+
To perform the prune operation:
42+
43+
----
44+
$ oc adm prune groups --sync-file=ldap-sync-config.yaml --confirm
45+
----
46+
47+
////
48+
Needs "Additional resources" links when converted:
49+
50+
xref:../install_config/syncing_groups_with_ldap.adoc#configuring-ldap-sync[Configuring LDAP Sync]
51+
xref:../install_config/syncing_groups_with_ldap.adoc#overview[Syncing Groups With LDAP]
52+
////

0 commit comments

Comments
 (0)