Skip to content

Commit 8f8d460

Browse files
committed
TELCODOCS-1861: Automatic image cleanup in container storage disk
1 parent cb922b6 commit 8f8d460

6 files changed

+77
-1
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,6 +3228,8 @@ Topics:
32283228
File: cnf-image-based-upgrade-prep-resources
32293229
- Name: Creating ConfigMap objects for the image-based upgrade with Lifecycle Agent using GitOps ZTP
32303230
File: ztp-image-based-upgrade-prep-resources
3231+
- Name: Configuring the automatic image cleanup of the container storage disk
3232+
File: cnf-image-based-upgrade-auto-image-cleanup
32313233
- Name: Performing an image-based upgrade for single-node OpenShift clusters with the Lifecycle Agent
32323234
File: cnf-image-based-upgrade-base
32333235
- Name: Performing an image-based upgrade for single-node OpenShift clusters using GitOps ZTP

edge_computing/image_based_upgrade/cnf-understanding-image-based-upgrade.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ include::modules/cnf-image-based-upgrade.adoc[leveloffset=+1]
7272
[role="_additional-resources"]
7373
.Additional resources
7474

75+
* xref:../../edge_computing/image_based_upgrade/preparing_for_image_based_upgrade/cnf-image-based-upgrade-auto-image-cleanup#cnf-image-based-upgrade-configure-auto-image-cleanup[Configuring the automatic image cleanup of the container storage disk]
76+
7577
* xref:../../edge_computing/image_based_upgrade/cnf-image-based-upgrade-base.adoc#cnf-image-based-upgrade[Performing an image-based upgrade for {sno} clusters with {lcao}]
7678
7779
* xref:../../edge_computing/image_based_upgrade/ztp-image-based-upgrade.adoc#ztp-image-based-upgrade[Performing an image-based upgrade for {sno} clusters using {ztp}]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
[id="cnf-image-based-upgrade-configure-auto-image-cleanup"]
3+
= Configuring the automatic image cleanup of the container storage disk
4+
include::_attributes/common-attributes.adoc[]
5+
:context: auto-cleanup
6+
7+
toc::[]
8+
9+
Configure when the {lcao} cleans up unpinned images in the `Prep` stage by setting a minimum threshold for available storage space through annotations.
10+
The default container storage disk usage threshold is 50%.
11+
12+
The {lcao} does not delete images that are pinned in CRI-O or are currently used.
13+
The Operator selects the images for deletion by starting with dangling images and then sorting the images from oldest to newest that is determined by the image `Created` timestamp.
14+
15+
include::modules/cnf-image-based-upgrade-configure-container-storage-image-cleanup.adoc[leveloffset=+1]
16+
17+
include::modules/cnf-image-based-upgrade-disable-container-storage-image-cleanup.adoc[leveloffset=+1]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Module included in the following assemblies:
2+
// * edge_computing/image-based-upgrade/cnf-image-based-upgrade-shared-container-partition
3+
4+
:_mod-docs-content-type: PROCEDURE
5+
[id="ztp-image-based-upgrade-configure-threshold_{context}"]
6+
= Configuring the automatic image cleanup of the container storage disk
7+
8+
Configure the minimum threshold for available storage space through annotations.
9+
10+
.Prerequisites
11+
12+
* Create an `ImageBasedUpgrade` CR.
13+
14+
.Procedure
15+
16+
. Increase the threshold to 65% by running the following command:
17+
+
18+
[source,terminal]
19+
----
20+
$ oc -n openshift-lifecycle-agent annotate ibu upgrade image-cleanup.lca.openshift.io/disk-usage-threshold-percent='65'
21+
----
22+
23+
. (Optional) Remove the threshold override by running the following command:
24+
+
25+
[source,terminal]
26+
----
27+
$ oc -n openshift-lifecycle-agent annotate ibu upgrade image-cleanup.lca.openshift.io/disk-usage-threshold-percent-
28+
----
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Module included in the following assemblies:
2+
// * edge_computing/image-based-upgrade/cnf-image-based-upgrade-shared-container-partition
3+
4+
:_mod-docs-content-type: PROCEDURE
5+
[id="ztp-image-based-upgrade-disable-container-storage-image-cleanup_{context}"]
6+
= Disable the automatic image cleanup of the container storage disk
7+
8+
Disable the automatic image cleanup threshold.
9+
10+
.Procedure
11+
12+
. Disable the automatic image cleanup by running the following command:
13+
+
14+
[source,terminal]
15+
----
16+
$ oc -n openshift-lifecycle-agent annotate ibu upgrade image-cleanup.lca.openshift.io/on-prep='Disabled'
17+
----
18+
19+
. (Optional) Enable automatic image cleanup again by running the following command:
20+
+
21+
[source,terminal]
22+
----
23+
$ oc -n openshift-lifecycle-agent annotate ibu upgrade image-cleanup.lca.openshift.io/on-prep-
24+
----

modules/cnf-image-based-upgrade.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ For the `Prep` stage, you specify the following upgrade details in the `ImageBas
5656
* extra manifests to apply and custom catalog sources to retain after the upgrade, if any
5757

5858
Then, based on what you specify, the {lcao} prepares for the upgrade without impacting the current running version.
59-
During this stage, the {lcao} ensures that the target cluster is ready to proceed to the `Upgrade` stage by checking if it meets certain conditions and pulls the seed image to the target cluster with additional container images specified in the seed image.
59+
During this stage, the {lcao} ensures that the target cluster is ready to proceed to the `Upgrade` stage by checking if it meets certain conditions.
60+
The Operator pulls the seed image to the target cluster with additional container images specified in the seed image.
61+
The {lcao} checks if there is enough space on the container storage disk and if necessary, the Operator deletes unpinned images until the disk usage is below the specified threshold.
62+
For more information about how to configure or disable the cleaning up of the container storage disk, see "Configuring the automatic image cleanup of the container storage disk".
6063

6164
You also prepare backup resources with the {oadp-short} Operator's `Backup` and `Restore` CRs.
6265
These CRs are used in the `Upgrade` stage to reconfigure the cluster, register the cluster with {rh-rhacm}, and restore application artifacts.

0 commit comments

Comments
 (0)