[htk] Jobs; put labels only in the template spec
This is an update to address a behavior change introduced with
0ae8f4d21a
.
Job labels if empty/unspecified are taken from the template. If (any)
labels are specified on the job we do not get this behavior.
Specifically if we *apply*:
apiVersion: batch/v1
kind: Job
metadata:
# no "labels:" here
name: placement-db-init
namespace: openstack
spec:
template:
metadata:
labels:
application: placement
component: db-init
release_group: placement
spec:
containers:
# do stuffs
then *query* we see:
apiVersion: batch/v1
kind: Job
metadata:
# k8s did this for us!
labels:
application: placement
component: db-init
job-name: placement-db-init
release_group: placement
name: placement-db-init
namespace: openstack
spec:
template:
metadata:
labels:
application: placement
component: db-init
release_group: placement
spec:
containers:
# do stuffs
The aforementioned change causes objects we apply and query to look
like:
apiVersion: batch/v1
kind: Job
metadata:
# k8s did this for us!
labels:
application: placement
# nothing else!
name: placement-db-init
namespace: openstack
spec:
template:
metadata:
labels:
application: placement
component: db-init
release_group: placement
spec:
containers:
# do stuffs
Current users rely on this behavior and deployment systems use job
labels for synchronization, those labels being only specified in the
template and propagating to the job.
This change preserves functionality added recently and restores the
previous behavior.
The explicit "application" label is no longer needed as the
helm-toolkit.snippets.kubernetes_metadata_labels macro provides it.
Change-Id: I1582d008217b8848103579b826fae065c538aaf0
This commit is contained in:
parent
7351586a7d
commit
20cf2db961
@ -15,7 +15,7 @@ apiVersion: v1
|
|||||||
appVersion: v1.0.0
|
appVersion: v1.0.0
|
||||||
description: OpenStack-Helm Helm-Toolkit
|
description: OpenStack-Helm Helm-Toolkit
|
||||||
name: helm-toolkit
|
name: helm-toolkit
|
||||||
version: 0.2.8
|
version: 0.2.9
|
||||||
home: https://docs.openstack.org/openstack-helm
|
home: https://docs.openstack.org/openstack-helm
|
||||||
icon: https://www.openstack.org/themes/openstack/images/project-mascots/OpenStack-Helm/OpenStack_Project_OpenStackHelm_vertical.png
|
icon: https://www.openstack.org/themes/openstack/images/project-mascots/OpenStack-Helm/OpenStack_Project_OpenStackHelm_vertical.png
|
||||||
sources:
|
sources:
|
||||||
|
@ -48,11 +48,6 @@ metadata:
|
|||||||
"helm.sh/hook-delete-policy": before-hook-creation
|
"helm.sh/hook-delete-policy": before-hook-creation
|
||||||
{{- if $jobAnnotations }}
|
{{- if $jobAnnotations }}
|
||||||
{{ toYaml $jobAnnotations | indent 4 }}
|
{{ toYaml $jobAnnotations | indent 4 }}
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
application: {{ $serviceName }}
|
|
||||||
{{- if $jobLabels }}
|
|
||||||
{{ toYaml $jobLabels | indent 4 }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: {{ $backoffLimit }}
|
backoffLimit: {{ $backoffLimit }}
|
||||||
@ -63,6 +58,9 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll $serviceName "bootstrap" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
{{ tuple $envAll $serviceName "bootstrap" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||||
|
{{- if $jobLabels }}
|
||||||
|
{{ toYaml $jobLabels | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
annotations:
|
annotations:
|
||||||
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
||||||
spec:
|
spec:
|
||||||
|
@ -50,11 +50,6 @@ metadata:
|
|||||||
"helm.sh/hook-delete-policy": hook-succeeded
|
"helm.sh/hook-delete-policy": hook-succeeded
|
||||||
{{- if $jobAnnotations }}
|
{{- if $jobAnnotations }}
|
||||||
{{ toYaml $jobAnnotations | indent 4 }}
|
{{ toYaml $jobAnnotations | indent 4 }}
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
application: {{ $serviceName }}
|
|
||||||
{{- if $jobLabels }}
|
|
||||||
{{ toYaml $jobLabels | indent 4 }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: {{ $backoffLimit }}
|
backoffLimit: {{ $backoffLimit }}
|
||||||
@ -65,6 +60,9 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll $serviceName "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
{{ tuple $envAll $serviceName "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||||
|
{{- if $jobLabels }}
|
||||||
|
{{ toYaml $jobLabels | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: {{ $serviceAccountName }}
|
serviceAccountName: {{ $serviceAccountName }}
|
||||||
restartPolicy: OnFailure
|
restartPolicy: OnFailure
|
||||||
|
@ -49,11 +49,6 @@ metadata:
|
|||||||
"helm.sh/hook-delete-policy": before-hook-creation
|
"helm.sh/hook-delete-policy": before-hook-creation
|
||||||
{{- if $jobAnnotations }}
|
{{- if $jobAnnotations }}
|
||||||
{{ toYaml $jobAnnotations | indent 4 }}
|
{{ toYaml $jobAnnotations | indent 4 }}
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
application: {{ $serviceName }}
|
|
||||||
{{- if $jobLabels }}
|
|
||||||
{{ toYaml $jobLabels | indent 4 }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: {{ $backoffLimit }}
|
backoffLimit: {{ $backoffLimit }}
|
||||||
@ -64,6 +59,9 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll $serviceName "db-init" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
{{ tuple $envAll $serviceName "db-init" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||||
|
{{- if $jobLabels }}
|
||||||
|
{{ toYaml $jobLabels | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
annotations:
|
annotations:
|
||||||
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
||||||
spec:
|
spec:
|
||||||
|
@ -46,11 +46,6 @@ metadata:
|
|||||||
"helm.sh/hook-delete-policy": before-hook-creation
|
"helm.sh/hook-delete-policy": before-hook-creation
|
||||||
{{- if $jobAnnotations }}
|
{{- if $jobAnnotations }}
|
||||||
{{ toYaml $jobAnnotations | indent 4 }}
|
{{ toYaml $jobAnnotations | indent 4 }}
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
application: {{ $serviceName }}
|
|
||||||
{{- if $jobLabels }}
|
|
||||||
{{ toYaml $jobLabels | indent 4 }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: {{ $backoffLimit }}
|
backoffLimit: {{ $backoffLimit }}
|
||||||
@ -61,6 +56,9 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll $serviceName "db-sync" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
{{ tuple $envAll $serviceName "db-sync" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||||
|
{{- if $jobLabels }}
|
||||||
|
{{ toYaml $jobLabels | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
annotations:
|
annotations:
|
||||||
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
||||||
spec:
|
spec:
|
||||||
|
@ -49,11 +49,6 @@ metadata:
|
|||||||
"helm.sh/hook-delete-policy": before-hook-creation
|
"helm.sh/hook-delete-policy": before-hook-creation
|
||||||
{{- if $jobAnnotations }}
|
{{- if $jobAnnotations }}
|
||||||
{{ toYaml $jobAnnotations | indent 4 }}
|
{{ toYaml $jobAnnotations | indent 4 }}
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
application: {{ $serviceName }}
|
|
||||||
{{- if $jobLabels }}
|
|
||||||
{{ toYaml $jobLabels | indent 4 }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: {{ $backoffLimit }}
|
backoffLimit: {{ $backoffLimit }}
|
||||||
@ -64,6 +59,9 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll $serviceName "ks-endpoints" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
{{ tuple $envAll $serviceName "ks-endpoints" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||||
|
{{- if $jobLabels }}
|
||||||
|
{{ toYaml $jobLabels | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
annotations:
|
annotations:
|
||||||
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
||||||
spec:
|
spec:
|
||||||
|
@ -49,11 +49,6 @@ metadata:
|
|||||||
"helm.sh/hook-delete-policy": before-hook-creation
|
"helm.sh/hook-delete-policy": before-hook-creation
|
||||||
{{- if $jobAnnotations }}
|
{{- if $jobAnnotations }}
|
||||||
{{ toYaml $jobAnnotations | indent 4 }}
|
{{ toYaml $jobAnnotations | indent 4 }}
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
application: {{ $serviceName }}
|
|
||||||
{{- if $jobLabels }}
|
|
||||||
{{ toYaml $jobLabels | indent 4 }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: {{ $backoffLimit }}
|
backoffLimit: {{ $backoffLimit }}
|
||||||
@ -64,6 +59,9 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll $serviceName "ks-service" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
{{ tuple $envAll $serviceName "ks-service" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||||
|
{{- if $jobLabels }}
|
||||||
|
{{ toYaml $jobLabels | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
annotations:
|
annotations:
|
||||||
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
||||||
spec:
|
spec:
|
||||||
|
@ -49,11 +49,6 @@ metadata:
|
|||||||
"helm.sh/hook-delete-policy": before-hook-creation
|
"helm.sh/hook-delete-policy": before-hook-creation
|
||||||
{{- if $jobAnnotations }}
|
{{- if $jobAnnotations }}
|
||||||
{{ toYaml $jobAnnotations | indent 4 }}
|
{{ toYaml $jobAnnotations | indent 4 }}
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
application: {{ $serviceName }}
|
|
||||||
{{- if $jobLabels }}
|
|
||||||
{{ toYaml $jobLabels | indent 4 }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: {{ $backoffLimit }}
|
backoffLimit: {{ $backoffLimit }}
|
||||||
@ -64,6 +59,9 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll $serviceName "ks-user" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
{{ tuple $envAll $serviceName "ks-user" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||||
|
{{- if $jobLabels }}
|
||||||
|
{{ toYaml $jobLabels | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
annotations:
|
annotations:
|
||||||
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
||||||
spec:
|
spec:
|
||||||
|
@ -36,11 +36,6 @@ metadata:
|
|||||||
"helm.sh/hook-delete-policy": before-hook-creation
|
"helm.sh/hook-delete-policy": before-hook-creation
|
||||||
{{- if $jobAnnotations }}
|
{{- if $jobAnnotations }}
|
||||||
{{ toYaml $jobAnnotations | indent 4 }}
|
{{ toYaml $jobAnnotations | indent 4 }}
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
application: {{ $serviceName }}
|
|
||||||
{{- if $jobLabels }}
|
|
||||||
{{ toYaml $jobLabels | indent 4 }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: {{ $backoffLimit }}
|
backoffLimit: {{ $backoffLimit }}
|
||||||
@ -51,6 +46,9 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll $serviceName "rabbit-init" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
{{ tuple $envAll $serviceName "rabbit-init" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||||
|
{{- if $jobLabels }}
|
||||||
|
{{ toYaml $jobLabels | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
annotations:
|
annotations:
|
||||||
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
|
||||||
spec:
|
spec:
|
||||||
|
@ -44,11 +44,6 @@ metadata:
|
|||||||
"helm.sh/hook-delete-policy": before-hook-creation
|
"helm.sh/hook-delete-policy": before-hook-creation
|
||||||
{{- if $jobAnnotations }}
|
{{- if $jobAnnotations }}
|
||||||
{{ toYaml $jobAnnotations | indent 4 }}
|
{{ toYaml $jobAnnotations | indent 4 }}
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
application: {{ $serviceName }}
|
|
||||||
{{- if $jobLabels }}
|
|
||||||
{{ toYaml $jobLabels | indent 4 }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: {{ $backoffLimit }}
|
backoffLimit: {{ $backoffLimit }}
|
||||||
@ -59,6 +54,9 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll $serviceName "s3-bucket" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
{{ tuple $envAll $serviceName "s3-bucket" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||||
|
{{- if $jobLabels }}
|
||||||
|
{{ toYaml $jobLabels | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: {{ $serviceAccountName | quote }}
|
serviceAccountName: {{ $serviceAccountName | quote }}
|
||||||
restartPolicy: OnFailure
|
restartPolicy: OnFailure
|
||||||
|
@ -43,11 +43,6 @@ metadata:
|
|||||||
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
|
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
|
||||||
{{- if $jobAnnotations }}
|
{{- if $jobAnnotations }}
|
||||||
{{ toYaml $jobAnnotations | indent 4 }}
|
{{ toYaml $jobAnnotations | indent 4 }}
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
application: {{ $serviceName }}
|
|
||||||
{{- if $jobLabels }}
|
|
||||||
{{ toYaml $jobLabels | indent 4 }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: {{ $backoffLimit }}
|
backoffLimit: {{ $backoffLimit }}
|
||||||
@ -58,6 +53,9 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll $serviceName "s3-user" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
{{ tuple $envAll $serviceName "s3-user" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||||
|
{{- if $jobLabels }}
|
||||||
|
{{ toYaml $jobLabels | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: {{ $serviceAccountName | quote }}
|
serviceAccountName: {{ $serviceAccountName | quote }}
|
||||||
restartPolicy: OnFailure
|
restartPolicy: OnFailure
|
||||||
|
@ -42,11 +42,6 @@ metadata:
|
|||||||
"helm.sh/hook-delete-policy": before-hook-creation
|
"helm.sh/hook-delete-policy": before-hook-creation
|
||||||
{{- if $jobAnnotations }}
|
{{- if $jobAnnotations }}
|
||||||
{{ toYaml $jobAnnotations | indent 4 }}
|
{{ toYaml $jobAnnotations | indent 4 }}
|
||||||
{{- end }}
|
|
||||||
labels:
|
|
||||||
application: {{ $serviceName }}
|
|
||||||
{{- if $jobLabels }}
|
|
||||||
{{ toYaml $jobLabels | indent 4 }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
backoffLimit: {{ $backoffLimit }}
|
backoffLimit: {{ $backoffLimit }}
|
||||||
@ -57,6 +52,9 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll $serviceName "image-repo-sync" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
{{ tuple $envAll $serviceName "image-repo-sync" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||||
|
{{- if $jobLabels }}
|
||||||
|
{{ toYaml $jobLabels | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: {{ $serviceAccountName }}
|
serviceAccountName: {{ $serviceAccountName }}
|
||||||
restartPolicy: OnFailure
|
restartPolicy: OnFailure
|
||||||
|
@ -15,4 +15,5 @@ helm-toolkit:
|
|||||||
- 0.2.6 Add metadata in job templates
|
- 0.2.6 Add metadata in job templates
|
||||||
- 0.2.7 Replace brace expansion with more standardized Posix approach
|
- 0.2.7 Replace brace expansion with more standardized Posix approach
|
||||||
- 0.2.8 Override the expiry of Ingress TLS certificate
|
- 0.2.8 Override the expiry of Ingress TLS certificate
|
||||||
|
- 0.2.9 Jobs; put labels only in the template spec
|
||||||
...
|
...
|
||||||
|
Loading…
Reference in New Issue
Block a user