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
This commit is contained in:
DeJaeger, Darren (dd118r) 2021-10-10 11:43:58 -05:00
parent 1e651dc3c3
commit 7803000a54
7 changed files with 10 additions and 2 deletions

View File

@ -14,7 +14,7 @@ apiVersion: v1
appVersion: v1.0.0 appVersion: v1.0.0
description: OpenStack-Helm Glance description: OpenStack-Helm Glance
name: glance name: glance
version: 0.2.8 version: 0.2.9
home: https://docs.openstack.org/glance/latest/ home: https://docs.openstack.org/glance/latest/
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Glance/OpenStack_Project_Glance_vertical.png icon: https://www.openstack.org/themes/openstack/images/project-mascots/Glance/OpenStack_Project_Glance_vertical.png
sources: sources:

View File

@ -49,6 +49,8 @@ apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: {{ print "glance-clean" }} name: {{ print "glance-clean" }}
labels:
{{ tuple $envAll "glance" "clean" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
annotations: annotations:
"helm.sh/hook": pre-delete "helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded "helm.sh/hook-delete-policy": hook-succeeded

View File

@ -50,6 +50,8 @@ apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: glance-storage-init name: glance-storage-init
labels:
{{ tuple $envAll "glance" "storage-init" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
annotations: annotations:
{{- if .Values.helm3_hook }} {{- if .Values.helm3_hook }}
helm.sh/hook: post-install,post-upgrade helm.sh/hook: post-install,post-upgrade

View File

@ -14,7 +14,7 @@ apiVersion: v1
appVersion: v1.0.0 appVersion: v1.0.0
description: OpenStack-Helm Keystone description: OpenStack-Helm Keystone
name: keystone name: keystone
version: 0.2.12 version: 0.2.13
home: https://docs.openstack.org/keystone/latest/ home: https://docs.openstack.org/keystone/latest/
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Keystone/OpenStack_Project_Keystone_vertical.png icon: https://www.openstack.org/themes/openstack/images/project-mascots/Keystone/OpenStack_Project_Keystone_vertical.png
sources: sources:

View File

@ -54,6 +54,8 @@ apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: keystone-fernet-setup name: keystone-fernet-setup
labels:
{{ tuple $envAll "keystone" "fernet-setup" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{- if .Values.helm3_hook }} {{- if .Values.helm3_hook }}
annotations: annotations:
"helm.sh/hook": post-install,post-upgrade "helm.sh/hook": post-install,post-upgrade

View File

@ -18,4 +18,5 @@ glance:
- 0.2.6 Add Victoria and Wallaby releases support - 0.2.6 Add Victoria and Wallaby releases support
- 0.2.7 Added helm.sh/hook for the jobs - 0.2.7 Added helm.sh/hook for the jobs
- 0.2.8 Helm 3 - Fix Job Labels - 0.2.8 Helm 3 - Fix Job Labels
- 0.2.9 Helm 3 - Fix More Job Labels
... ...

View File

@ -28,4 +28,5 @@ keystone:
- 0.2.10 Make internal TLS more robust - 0.2.10 Make internal TLS more robust
- 0.2.11 Add missing slash - 0.2.11 Add missing slash
- 0.2.12 Helm 3 - Fix Job Labels - 0.2.12 Helm 3 - Fix Job Labels
- 0.2.13 Helm 3 - Fix more Job Labels
... ...