From f074a65ba1e76b2d308d2c8a1497d91dae2938d3 Mon Sep 17 00:00:00 2001 From: ricolin Date: Thu, 24 Aug 2023 23:17:03 +0800 Subject: [PATCH] Allows keep glance-images PVC once defined Glance image PVC contains requires images that should be careful handled during changing glance storage when migrate out of PVC mode for glance storage. Which in migrate/upgrade path, should be be correctly moved and deleted the PVC after. On the other hand, it's also possible to accidentally changes storage mode out of `pvc` and lose the `glance-images` PVC which is unbearable mistake. Once storage mode set to `pvc, we should allow that PVC to be able to stay and ready for reuse again until it's mannually deleted. This add flag `keep_pvc` (default to true). Set it to true to set helm/resource-policy to keep for glance-images. Set it to false to allow helm delete glance-images PVC when request. Change-Id: I9d0e2a49aabf81eb2d4e00ad2a9d42125261489e --- glance/Chart.yaml | 2 +- glance/templates/pvc-images.yaml | 4 ++++ glance/values.yaml | 7 +++++++ releasenotes/notes/glance.yaml | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/glance/Chart.yaml b/glance/Chart.yaml index 7f298dda03..ef5e7f5494 100644 --- a/glance/Chart.yaml +++ b/glance/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Glance name: glance -version: 0.4.11 +version: 0.4.12 home: https://docs.openstack.org/glance/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Glance/OpenStack_Project_Glance_vertical.png sources: diff --git a/glance/templates/pvc-images.yaml b/glance/templates/pvc-images.yaml index bd86d68e27..21ea96135c 100644 --- a/glance/templates/pvc-images.yaml +++ b/glance/templates/pvc-images.yaml @@ -20,6 +20,10 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: name: glance-images + {{- if .Values.keep_pvc }} + annotations: + helm.sh/resource-policy: keep + {{- end }} spec: accessModes: [ "ReadWriteOnce" ] resources: diff --git a/glance/values.yaml b/glance/values.yaml index bfffd7eedf..2406a35d88 100644 --- a/glance/values.yaml +++ b/glance/values.yaml @@ -1026,4 +1026,11 @@ manifests: secret_registry: true service_ingress_api: true service_api: true + +# NOTE: This is for enable helm resource-policy to keep glance-images PVC. +# set keep_pvc: true when allow helm resource-policy to keep for PVC. +# This will requires mannual delete for PVC. +# set keep_pvc: false when disallow helm resource-policy to keep for PVC. +# This will allow helm to delete the PVC. +keep_pvc: true ... diff --git a/releasenotes/notes/glance.yaml b/releasenotes/notes/glance.yaml index df2e8fa869..5f4aa48d9e 100644 --- a/releasenotes/notes/glance.yaml +++ b/releasenotes/notes/glance.yaml @@ -45,4 +45,5 @@ glance: - 0.4.9 Use service tokens - 0.4.10 Add exec probe timeouts - 0.4.11 Bring liveness/readiness params out to values.yaml + - 0.4.12 Add flag `keep_pvc` to allows set helm resource-policy for glance-images PVC to keep. ...