Ce contenu n'est pas disponible dans la langue sélectionnée.

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.

Important

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.

  1. 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/*
  2. MicroShift deletes the resources defined in the manifests found in the delete directories by running the equivalent of the kubectl 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

  1. Identify the manifest that needs to be placed in the delete subdirectories.
  2. 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.
  3. 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.

  4. Restart MicroShift by running the following command:

    $ sudo systemctl restart microshift
  5. 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.

Important

For OSTree installation, the delete subdirectories are read-only.

Procedure

  1. Identify the manifest that needs to be placed in the delete subdirectories.
  2. Package the manifest into an RPM. See Building the RPM package for the application for the procedure to package the manifest into an RPM.
  3. 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

  1. Identify the manifest that requires updating.
  2. Create new manifests to be applied in the manifest directories.
  3. 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.
  4. 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.

Important

For OSTree systems, the delete subdirectories are read-only.

Procedure

  1. Identify the manifest that needs updating.
  2. Create a new manifest to apply in the manifest directories. See Using manifests example to create new manifests using the example.
  3. Create a new manifest for resource deletion to be placed in the delete subdirectories.
  4. Use the procedure in "Removing manifests for OSTree systems" to remove the manifests.

2.3. Additional resources

Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.