From b4bb6fb088459cb5c316c2d78c065c379aee04c3 Mon Sep 17 00:00:00 2001 From: aravipra Date: Wed, 9 Oct 2024 19:50:57 +0530 Subject: [PATCH] OSDOCS-12183: adding how to delete manifests --- _topic_maps/_topic_map_ms.yml | 2 ++ ...icroshift-deleting-resource-manifests.adoc | 18 ++++++++++++ modules/microshift-examples-of-usecase.adoc | 29 +++++++++++++++++++ ...icroshift-manifests-deletion-overview.adoc | 25 ++++++++++++++++ 4 files changed, 74 insertions(+) create mode 100644 microshift_running_apps/microshift-deleting-resource-manifests.adoc create mode 100644 modules/microshift-examples-of-usecase.adoc create mode 100644 modules/microshift-manifests-deletion-overview.adoc diff --git a/_topic_maps/_topic_map_ms.yml b/_topic_maps/_topic_map_ms.yml index 5e201bf18fdf..ed0d1ea7ad55 100644 --- a/_topic_maps/_topic_map_ms.yml +++ b/_topic_maps/_topic_map_ms.yml @@ -195,6 +195,8 @@ Distros: microshift Topics: - Name: Using Kustomize to deploy applications File: microshift-applications +- Name: Deleting resource manifests + File: microshift-deleting-resource-manifests - Name: Embedding applications on RHEL for Edge File: microshift-embedded-apps-on-rhel-edge - Name: Embedding applications for offline use diff --git a/microshift_running_apps/microshift-deleting-resource-manifests.adoc b/microshift_running_apps/microshift-deleting-resource-manifests.adoc new file mode 100644 index 000000000000..52ade50f7f67 --- /dev/null +++ b/microshift_running_apps/microshift-deleting-resource-manifests.adoc @@ -0,0 +1,18 @@ +:_mod-docs-content-type: ASSEMBLY +[id="microshift-deleting-resource-manifests"] += Deleting resource manifests +include::_attributes/attributes-microshift.adoc[] +:context: microshift-deleting-resource-manifests + +toc::[] + +{microshift-short} supports the deletion of resource manifests for the following use cases: + +* Data removal - when you need to completely remove resource from the cluster. +* Upgrade - During an upgrade, some resources may need to be removed while retaining others to preserve data. + +Resource manifest deletion helps to manage the cluster resources efficiently by removing outdated objects while preserving necessary data. + +include::modules/microshift-examples-of-usecase.adoc[leveloffset=+1] + +include::modules/microshift-manifests-deletion-overview.adoc[leveloffset=+1] \ No newline at end of file diff --git a/modules/microshift-examples-of-usecase.adoc b/modules/microshift-examples-of-usecase.adoc new file mode 100644 index 000000000000..cd12cc9d81cd --- /dev/null +++ b/modules/microshift-examples-of-usecase.adoc @@ -0,0 +1,29 @@ +// Module included in the following assemblies: +// +// * microshift//running_applications/microshift-deleting-resource-manifests.adoc + +:_mod-docs-content-type: PROCEDURE +[id="microshift-examples-of-usecase_{context}"] += Use cases for resource manifest deletion + +Use the following procedure in the data removal scenario to completely delete the resources defined in the kustomize manifest file. + +.Procedure + +. Identify the Kustomization file that has to be placed in the `delete` sub directories. +. Move the manifest file to be deleted into one of the `delete` subdirectories under the configured manifests directory by running the following command: ++ +[source,terminal] +---- +[sudo] mv /usr/lib/microshift/manifests.d/some-user-manifest /usr/lib/microshift/manifests.d/delete/some-user-manifest +---- +. {microshift-short} will automatically delete and remove the resource once the manifest file is placed in the `delete` sub directories. + + +Use the following procedure in the upgrade scenario where some resources may need to be removed while retaining others to preserve data. + +.Procedure + +. . Identify the Kustomization file that has to be upgraded.It is not necessary to include the entire resource `spec` in the `delete` sub directories. +. You can specify the metadata like `name` and `namespace`of the resource you want to remove in the `delete` sub directories. +. {microshift-short} will automatically delete the specified object without affecting the related data. \ No newline at end of file diff --git a/modules/microshift-manifests-deletion-overview.adoc b/modules/microshift-manifests-deletion-overview.adoc new file mode 100644 index 000000000000..de405443a57b --- /dev/null +++ b/modules/microshift-manifests-deletion-overview.adoc @@ -0,0 +1,25 @@ +// Module included in the following assemblies: +// +// * microshift//running_applications/microshift-deleting-resource-manifests.adoc + +:_mod-docs-content-type: PROCEDURE +[id="microshift-manifests-deletion-overview_{context}"] += How manifest deletion works + +By default, {microshift-short} expects to find deletion manifests in the `delete` subdirectories within the manifest path. When a manifest file is placed in the `delete` subdirectories, {microshift-short} will automatically handle the removal. Read through the following procedure to understand how manifest file deletion works in {microshift-short}. + +.Procedure + +. At every start, before applying the manifests, {microshift-short} scans the following `delete` sub directories within the configured manifests directory to identify the Kustomize manifest files that need to be deleted: + +* /usr/lib/microshift/manifests/delete +* /usr/lib/microshift/manifests.d/delete/* +* /etc/microshift/manifests/delete +* /etc/microshift/manifests.d/delete/* + +. {microshift-short} then runs the following command to delete the resources defined in the kustomize manifest file found in the `delete` directories. ++ +[source,terminal] +---- +kubectl delete -k --ignore-not-found=true +----