Chapter 2. Deleting or updating Kustomize manifest resources
MicroShift supports the deletion of manifest resources in the following situations:
- Manifest removal: Manifests can be removed when you need to completely remove a resource from the cluster.
- Manifest upgrade: During an application upgrade, some resources might need to be removed while others are retained to preserve data.
When creating new manifests, you can use manifest resource deletion to remove or update old objects, ensuring there are no conflicts or issues.
Manifest files placed in the delete
subdirectories are not automatically removed and require manual deletion. Only the resources listed in the manifest files placed in the delete subdirectories are deleted.
2.1. How manifest deletion works
By default, MicroShift searches for deletion manifests in the delete
subdirectories within the manifests path. When a user places a manifest in these subdirectories, MicroShift removes the manifests when the system is started. Read through the following to understand how manifests deletion works in MicroShift.
Each time the system starts, before applying the manifests, MicroShift scans the following
delete
subdirectories within the configured manifests directory to identify the manifests 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 deletes the resources defined in the manifests found in the
delete
directories by running the equivalent of thekubectl delete --ignore-not-found -k
command.
2.2. Use cases for manifest resource deletion
The following sections explain the use case in which the manifest resource deletion is used.
2.2.1. Removing manifests for RPM systems
Use the following procedure in the data removal scenario for RPM systems to completely delete the resource defined in the manifests.
Procedure
-
Identify the manifest that needs to be placed in the
delete
subdirectories. Create the
delete
subdirectory in which the manifest will be placed by running the following command:$ sudo mkdir -p <path_of_delete_directory> 1
- 1
- Replace
<path_of_delete_directory>
with one of the following valid directory paths:/etc/microshift/manifests.d/delete
,/etc/microshift/manifests/delete/
,/usr/lib/microshift/manifests.d/delete
, or/usr/lib/microshift/manifests/delete
.
Move the manifest file into one of the
delete
subdirectories under the configured manifests directory by running the following command:$ [sudo] mv <path_of_manifests> <path_of_delete_directory>
where:
<path_of_manifests>
:: Specifies the path of the manifest to be deleted, for example/etc/microshift/manifests.d/010-SOME-MANIFEST
.<path_of_delete_directory>
:: Specifies one of the following valid directory paths:/etc/microshift/manifests.d/delete
,/etc/microshift/manifests/delete
,/usr/lib/microshift/manifests.d/delete
or/usr/lib/microshift/manifests/delete
.Restart MicroShift by running the following command:
$ sudo systemctl restart microshift
-
MicroShift detects and removes the resource after the manifest file is placed in the
delete
subdirectories.
2.2.2. Removing manifests for OSTree systems
Use the following procedure to completely delete the resource defined in the manifests.
For OSTree installation, the delete
subdirectories are read-only.
Procedure
-
Identify the manifest that needs to be placed in the
delete
subdirectories. - Package the manifest into an RPM. See Building the RPM package for the application for the procedure to package the manifest into an RPM.
- Add the packaged RPM to the blueprint file to install it into correct location. See Adding application RPMs to a blueprint for the procedure to add an RPM to a blueprint.
2.2.3. Upgrading manifests for RPM systems
Use the following procedure to remove some resources while retaining others to preserve data.
Procedure
- Identify the manifest that requires updating.
- Create new manifests to be applied in the manifest directories.
-
Create new manifests for resource deletion. It is not necessary to include the
spec
in these manifests. See Using manifests example to create new manifests using the example. -
Use the procedure in "Removing manifests for RPM systems" to create
delete
subdirectories and place the manifests created for resource deletion in this path.
2.2.4. Upgrading manifests for OSTree systems
Use the following procedure to remove some resources while retaining others to preserve data.
For OSTree systems, the delete
subdirectories are read-only.
Procedure
- Identify the manifest that needs updating.
- Create a new manifest to apply in the manifest directories. See Using manifests example to create new manifests using the example.
-
Create a new manifest for resource deletion to be placed in the
delete
subdirectories. - Use the procedure in "Removing manifests for OSTree systems" to remove the manifests.