From 7803000a545687ec40b0ddc41d46a6b377dea45f Mon Sep 17 00:00:00 2001 From: "DeJaeger, Darren (dd118r)" Date: Sun, 10 Oct 2021 11:43:58 -0500 Subject: [PATCH] Helm 3 - Fix Additional Job Labels If labels are not specified on a Job, kubernetes defaults them to include the labels of their underlying Pod template. Helm 3 injects metadata into all resources [0] including a `app.kubernetes.io/managed-by: Helm` label. Thus when kubernetes sees a Job's labels they are no longer empty and thus do not get defaulted to the underlying Pod template's labels. This is a problem since Job labels are depended on by - Armada pre-upgrade delete hooks - Armada wait logic configurations - kubernetes-entrypoint dependencies Thus, for Job templates previously missed, this adds labels matching the underlying Pod template to retain the same labels that were present with Helm 2. [0]: https://github.com/helm/helm/pull/7649 Change-Id: Ie438b449a3d9853d786215d40a39c32d164e9950 --- glance/Chart.yaml | 2 +- glance/templates/job-clean.yaml | 2 ++ glance/templates/job-storage-init.yaml | 2 ++ keystone/Chart.yaml | 2 +- keystone/templates/job-fernet-setup.yaml | 2 ++ releasenotes/notes/glance.yaml | 1 + releasenotes/notes/keystone.yaml | 1 + 7 files changed, 10 insertions(+), 2 deletions(-) diff --git a/glance/Chart.yaml b/glance/Chart.yaml index f1f278aa74..8b5ad6317f 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.2.8 +version: 0.2.9 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/job-clean.yaml b/glance/templates/job-clean.yaml index fc2b4e0271..b4241f4100 100644 --- a/glance/templates/job-clean.yaml +++ b/glance/templates/job-clean.yaml @@ -49,6 +49,8 @@ apiVersion: batch/v1 kind: Job metadata: name: {{ print "glance-clean" }} + labels: +{{ tuple $envAll "glance" "clean" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} annotations: "helm.sh/hook": pre-delete "helm.sh/hook-delete-policy": hook-succeeded diff --git a/glance/templates/job-storage-init.yaml b/glance/templates/job-storage-init.yaml index b991d487db..562c097b67 100644 --- a/glance/templates/job-storage-init.yaml +++ b/glance/templates/job-storage-init.yaml @@ -50,6 +50,8 @@ apiVersion: batch/v1 kind: Job metadata: name: glance-storage-init + labels: +{{ tuple $envAll "glance" "storage-init" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} annotations: {{- if .Values.helm3_hook }} helm.sh/hook: post-install,post-upgrade diff --git a/keystone/Chart.yaml b/keystone/Chart.yaml index 721c20e24c..0ec0b14746 100644 --- a/keystone/Chart.yaml +++ b/keystone/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Keystone name: keystone -version: 0.2.12 +version: 0.2.13 home: https://docs.openstack.org/keystone/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Keystone/OpenStack_Project_Keystone_vertical.png sources: diff --git a/keystone/templates/job-fernet-setup.yaml b/keystone/templates/job-fernet-setup.yaml index 8042543352..786772d012 100644 --- a/keystone/templates/job-fernet-setup.yaml +++ b/keystone/templates/job-fernet-setup.yaml @@ -54,6 +54,8 @@ apiVersion: batch/v1 kind: Job metadata: name: keystone-fernet-setup + labels: +{{ tuple $envAll "keystone" "fernet-setup" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{- if .Values.helm3_hook }} annotations: "helm.sh/hook": post-install,post-upgrade diff --git a/releasenotes/notes/glance.yaml b/releasenotes/notes/glance.yaml index d4dd283f06..5b2ddd451f 100644 --- a/releasenotes/notes/glance.yaml +++ b/releasenotes/notes/glance.yaml @@ -18,4 +18,5 @@ glance: - 0.2.6 Add Victoria and Wallaby releases support - 0.2.7 Added helm.sh/hook for the jobs - 0.2.8 Helm 3 - Fix Job Labels + - 0.2.9 Helm 3 - Fix More Job Labels ... diff --git a/releasenotes/notes/keystone.yaml b/releasenotes/notes/keystone.yaml index c93ef8a6d0..89884f6ce3 100644 --- a/releasenotes/notes/keystone.yaml +++ b/releasenotes/notes/keystone.yaml @@ -28,4 +28,5 @@ keystone: - 0.2.10 Make internal TLS more robust - 0.2.11 Add missing slash - 0.2.12 Helm 3 - Fix Job Labels + - 0.2.13 Helm 3 - Fix more Job Labels ...