From a15ecc573fbb0f53f691be0f748da87f7cd1d55a Mon Sep 17 00:00:00 2001 From: Alexandra Molnar Date: Thu, 12 Sep 2024 11:49:12 +0100 Subject: [PATCH] TELCODOCS-1861: Automatic image cleanup in container storage disk --- _topic_maps/_topic_map.yml | 2 ++ ...cnf-understanding-image-based-upgrade.adoc | 2 ++ ...mage-based-upgrade-auto-image-cleanup.adoc | 17 +++++++++++ ...igure-container-storage-image-cleanup.adoc | 28 +++++++++++++++++++ ...sable-container-storage-image-cleanup.adoc | 24 ++++++++++++++++ modules/cnf-image-based-upgrade.adoc | 5 +++- 6 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 edge_computing/image_based_upgrade/preparing_for_image_based_upgrade/cnf-image-based-upgrade-auto-image-cleanup.adoc create mode 100644 modules/cnf-image-based-upgrade-configure-container-storage-image-cleanup.adoc create mode 100644 modules/cnf-image-based-upgrade-disable-container-storage-image-cleanup.adoc diff --git a/_topic_maps/_topic_map.yml b/_topic_maps/_topic_map.yml index 63b30844c5..e7a224915a 100644 --- a/_topic_maps/_topic_map.yml +++ b/_topic_maps/_topic_map.yml @@ -3229,6 +3229,8 @@ Topics: File: cnf-image-based-upgrade-prep-resources - Name: Creating ConfigMap objects for the image-based upgrade with Lifecycle Agent using GitOps ZTP File: ztp-image-based-upgrade-prep-resources + - Name: Configuring the automatic image cleanup of the container storage disk + File: cnf-image-based-upgrade-auto-image-cleanup - Name: Performing an image-based upgrade for single-node OpenShift clusters with the Lifecycle Agent File: cnf-image-based-upgrade-base - Name: Performing an image-based upgrade for single-node OpenShift clusters using GitOps ZTP diff --git a/edge_computing/image_based_upgrade/cnf-understanding-image-based-upgrade.adoc b/edge_computing/image_based_upgrade/cnf-understanding-image-based-upgrade.adoc index 20d8ef6f8f..38830c9d1b 100644 --- a/edge_computing/image_based_upgrade/cnf-understanding-image-based-upgrade.adoc +++ b/edge_computing/image_based_upgrade/cnf-understanding-image-based-upgrade.adoc @@ -72,6 +72,8 @@ include::modules/cnf-image-based-upgrade.adoc[leveloffset=+1] [role="_additional-resources"] .Additional resources +* 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] + * 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}] * 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}] diff --git a/edge_computing/image_based_upgrade/preparing_for_image_based_upgrade/cnf-image-based-upgrade-auto-image-cleanup.adoc b/edge_computing/image_based_upgrade/preparing_for_image_based_upgrade/cnf-image-based-upgrade-auto-image-cleanup.adoc new file mode 100644 index 0000000000..b265852400 --- /dev/null +++ b/edge_computing/image_based_upgrade/preparing_for_image_based_upgrade/cnf-image-based-upgrade-auto-image-cleanup.adoc @@ -0,0 +1,17 @@ +:_mod-docs-content-type: ASSEMBLY +[id="cnf-image-based-upgrade-configure-auto-image-cleanup"] += Configuring the automatic image cleanup of the container storage disk +include::_attributes/common-attributes.adoc[] +:context: auto-cleanup + +toc::[] + +Configure when the {lcao} cleans up unpinned images in the `Prep` stage by setting a minimum threshold for available storage space through annotations. +The default container storage disk usage threshold is 50%. + +The {lcao} does not delete images that are pinned in CRI-O or are currently used. +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. + +include::modules/cnf-image-based-upgrade-configure-container-storage-image-cleanup.adoc[leveloffset=+1] + +include::modules/cnf-image-based-upgrade-disable-container-storage-image-cleanup.adoc[leveloffset=+1] \ No newline at end of file diff --git a/modules/cnf-image-based-upgrade-configure-container-storage-image-cleanup.adoc b/modules/cnf-image-based-upgrade-configure-container-storage-image-cleanup.adoc new file mode 100644 index 0000000000..3a2d8dede8 --- /dev/null +++ b/modules/cnf-image-based-upgrade-configure-container-storage-image-cleanup.adoc @@ -0,0 +1,28 @@ +// Module included in the following assemblies: +// * edge_computing/image-based-upgrade/cnf-image-based-upgrade-shared-container-partition + +:_mod-docs-content-type: PROCEDURE +[id="ztp-image-based-upgrade-configure-threshold_{context}"] += Configuring the automatic image cleanup of the container storage disk + +Configure the minimum threshold for available storage space through annotations. + +.Prerequisites + +* Create an `ImageBasedUpgrade` CR. + +.Procedure + +. Increase the threshold to 65% by running the following command: ++ +[source,terminal] +---- +$ oc -n openshift-lifecycle-agent annotate ibu upgrade image-cleanup.lca.openshift.io/disk-usage-threshold-percent='65' +---- + +. (Optional) Remove the threshold override by running the following command: ++ +[source,terminal] +---- +$ oc -n openshift-lifecycle-agent annotate ibu upgrade image-cleanup.lca.openshift.io/disk-usage-threshold-percent- +---- \ No newline at end of file diff --git a/modules/cnf-image-based-upgrade-disable-container-storage-image-cleanup.adoc b/modules/cnf-image-based-upgrade-disable-container-storage-image-cleanup.adoc new file mode 100644 index 0000000000..bdfe38a27f --- /dev/null +++ b/modules/cnf-image-based-upgrade-disable-container-storage-image-cleanup.adoc @@ -0,0 +1,24 @@ +// Module included in the following assemblies: +// * edge_computing/image-based-upgrade/cnf-image-based-upgrade-shared-container-partition + +:_mod-docs-content-type: PROCEDURE +[id="ztp-image-based-upgrade-disable-container-storage-image-cleanup_{context}"] += Disable the automatic image cleanup of the container storage disk + +Disable the automatic image cleanup threshold. + +.Procedure + +. Disable the automatic image cleanup by running the following command: ++ +[source,terminal] +---- +$ oc -n openshift-lifecycle-agent annotate ibu upgrade image-cleanup.lca.openshift.io/on-prep='Disabled' +---- + +. (Optional) Enable automatic image cleanup again by running the following command: ++ +[source,terminal] +---- +$ oc -n openshift-lifecycle-agent annotate ibu upgrade image-cleanup.lca.openshift.io/on-prep- +---- \ No newline at end of file diff --git a/modules/cnf-image-based-upgrade.adoc b/modules/cnf-image-based-upgrade.adoc index 637a51475d..d3e45d225f 100644 --- a/modules/cnf-image-based-upgrade.adoc +++ b/modules/cnf-image-based-upgrade.adoc @@ -56,7 +56,10 @@ For the `Prep` stage, you specify the following upgrade details in the `ImageBas * extra manifests to apply and custom catalog sources to retain after the upgrade, if any Then, based on what you specify, the {lcao} prepares for the upgrade without impacting the current running version. -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. +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. +The Operator pulls the seed image to the target cluster with additional container images specified in the seed image. +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. +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". You also prepare backup resources with the {oadp-short} Operator's `Backup` and `Restore` CRs. These CRs are used in the `Upgrade` stage to reconfigure the cluster, register the cluster with {rh-rhacm}, and restore application artifacts.