diff --git a/helm-toolkit/Chart.yaml b/helm-toolkit/Chart.yaml index 038933aab..490e4a74b 100644 --- a/helm-toolkit/Chart.yaml +++ b/helm-toolkit/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Helm-Toolkit name: helm-toolkit -version: 0.2.5 +version: 0.2.6 home: https://docs.openstack.org/openstack-helm icon: https://www.openstack.org/themes/openstack/images/project-mascots/OpenStack-Helm/OpenStack_Project_OpenStackHelm_vertical.png sources: diff --git a/helm-toolkit/templates/manifests/_job-bootstrap.tpl b/helm-toolkit/templates/manifests/_job-bootstrap.tpl index ea2772955..946f312f0 100644 --- a/helm-toolkit/templates/manifests/_job-bootstrap.tpl +++ b/helm-toolkit/templates/manifests/_job-bootstrap.tpl @@ -20,6 +20,8 @@ limitations under the License. {{- define "helm-toolkit.manifests.job_bootstrap" -}} {{- $envAll := index . "envAll" -}} {{- $serviceName := index . "serviceName" -}} +{{- $jobAnnotations := index . "jobAnnotations" -}} +{{- $jobLabels := index . "jobLabels" -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $podVolMounts := index . "podVolMounts" | default false -}} {{- $podVols := index . "podVols" | default false -}} @@ -42,6 +44,16 @@ apiVersion: batch/v1 kind: Job metadata: name: {{ printf "%s-%s" $serviceNamePretty "bootstrap" | quote }} + annotations: + "helm.sh/hook-delete-policy": before-hook-creation +{{- if $jobAnnotations }} +{{ toYaml $jobAnnotations | indent 4 }} +{{- end }} + labels: + application: {{ $serviceName }} +{{- if $jobLabels }} +{{ toYaml $jobLabels | indent 4 }} +{{- end }} spec: backoffLimit: {{ $backoffLimit }} {{- if $activeDeadlineSeconds }} diff --git a/helm-toolkit/templates/manifests/_job-db-drop-mysql.tpl b/helm-toolkit/templates/manifests/_job-db-drop-mysql.tpl index 0c2b63ab6..46a6889e1 100644 --- a/helm-toolkit/templates/manifests/_job-db-drop-mysql.tpl +++ b/helm-toolkit/templates/manifests/_job-db-drop-mysql.tpl @@ -25,6 +25,8 @@ limitations under the License. {{- define "helm-toolkit.manifests.job_db_drop_mysql" -}} {{- $envAll := index . "envAll" -}} {{- $serviceName := index . "serviceName" -}} +{{- $jobAnnotations := index . "jobAnnotations" -}} +{{- $jobLabels := index . "jobLabels" -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapEtc := index . "configMapEtc" | default (printf "%s-%s" $serviceName "etc" ) -}} @@ -46,6 +48,14 @@ metadata: annotations: "helm.sh/hook": pre-delete "helm.sh/hook-delete-policy": hook-succeeded +{{- if $jobAnnotations }} +{{ toYaml $jobAnnotations | indent 4 }} +{{- end }} + labels: + application: {{ $serviceName }} +{{- if $jobLabels }} +{{ toYaml $jobLabels | indent 4 }} +{{- end }} spec: backoffLimit: {{ $backoffLimit }} {{- if $activeDeadlineSeconds }} diff --git a/helm-toolkit/templates/manifests/_job-db-init-mysql.tpl b/helm-toolkit/templates/manifests/_job-db-init-mysql.tpl index 9192ccc95..de798b657 100644 --- a/helm-toolkit/templates/manifests/_job-db-init-mysql.tpl +++ b/helm-toolkit/templates/manifests/_job-db-init-mysql.tpl @@ -25,6 +25,8 @@ limitations under the License. {{- define "helm-toolkit.manifests.job_db_init_mysql" -}} {{- $envAll := index . "envAll" -}} {{- $serviceName := index . "serviceName" -}} +{{- $jobAnnotations := index . "jobAnnotations" -}} +{{- $jobLabels := index . "jobLabels" -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapEtc := index . "configMapEtc" | default (printf "%s-%s" $serviceName "etc" ) -}} @@ -43,6 +45,16 @@ apiVersion: batch/v1 kind: Job metadata: name: {{ printf "%s-%s" $serviceNamePretty "db-init" | quote }} + annotations: + "helm.sh/hook-delete-policy": before-hook-creation +{{- if $jobAnnotations }} +{{ toYaml $jobAnnotations | indent 4 }} +{{- end }} + labels: + application: {{ $serviceName }} +{{- if $jobLabels }} +{{ toYaml $jobLabels | indent 4 }} +{{- end }} spec: backoffLimit: {{ $backoffLimit }} {{- if $activeDeadlineSeconds }} diff --git a/helm-toolkit/templates/manifests/_job-db-sync.tpl b/helm-toolkit/templates/manifests/_job-db-sync.tpl index 0a60a3b4d..76daa9f9c 100644 --- a/helm-toolkit/templates/manifests/_job-db-sync.tpl +++ b/helm-toolkit/templates/manifests/_job-db-sync.tpl @@ -20,6 +20,8 @@ limitations under the License. {{- define "helm-toolkit.manifests.job_db_sync" -}} {{- $envAll := index . "envAll" -}} {{- $serviceName := index . "serviceName" -}} +{{- $jobAnnotations := index . "jobAnnotations" -}} +{{- $jobLabels := index . "jobLabels" -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapEtc := index . "configMapEtc" | default (printf "%s-%s" $serviceName "etc" ) -}} @@ -40,6 +42,16 @@ apiVersion: batch/v1 kind: Job metadata: name: {{ printf "%s-%s" $serviceNamePretty "db-sync" | quote }} + annotations: + "helm.sh/hook-delete-policy": before-hook-creation +{{- if $jobAnnotations }} +{{ toYaml $jobAnnotations | indent 4 }} +{{- end }} + labels: + application: {{ $serviceName }} +{{- if $jobLabels }} +{{ toYaml $jobLabels | indent 4 }} +{{- end }} spec: backoffLimit: {{ $backoffLimit }} {{- if $activeDeadlineSeconds }} diff --git a/helm-toolkit/templates/manifests/_job-ks-endpoints.tpl b/helm-toolkit/templates/manifests/_job-ks-endpoints.tpl index a32ffd2fd..e5377b41e 100644 --- a/helm-toolkit/templates/manifests/_job-ks-endpoints.tpl +++ b/helm-toolkit/templates/manifests/_job-ks-endpoints.tpl @@ -21,6 +21,8 @@ limitations under the License. {{- $envAll := index . "envAll" -}} {{- $serviceName := index . "serviceName" -}} {{- $serviceTypes := index . "serviceTypes" -}} +{{- $jobAnnotations := index . "jobAnnotations" -}} +{{- $jobLabels := index . "jobLabels" -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $secretBin := index . "secretBin" -}} @@ -43,6 +45,16 @@ apiVersion: batch/v1 kind: Job metadata: name: {{ printf "%s-%s" $serviceNamePretty "ks-endpoints" | quote }} + annotations: + "helm.sh/hook-delete-policy": before-hook-creation +{{- if $jobAnnotations }} +{{ toYaml $jobAnnotations | indent 4 }} +{{- end }} + labels: + application: {{ $serviceName }} +{{- if $jobLabels }} +{{ toYaml $jobLabels | indent 4 }} +{{- end }} spec: backoffLimit: {{ $backoffLimit }} {{- if $activeDeadlineSeconds }} diff --git a/helm-toolkit/templates/manifests/_job-ks-service.tpl b/helm-toolkit/templates/manifests/_job-ks-service.tpl index e5a0cb69a..e5d4f7532 100644 --- a/helm-toolkit/templates/manifests/_job-ks-service.tpl +++ b/helm-toolkit/templates/manifests/_job-ks-service.tpl @@ -21,6 +21,8 @@ limitations under the License. {{- $envAll := index . "envAll" -}} {{- $serviceName := index . "serviceName" -}} {{- $serviceTypes := index . "serviceTypes" -}} +{{- $jobAnnotations := index . "jobAnnotations" -}} +{{- $jobLabels := index . "jobLabels" -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $secretBin := index . "secretBin" -}} @@ -43,6 +45,16 @@ apiVersion: batch/v1 kind: Job metadata: name: {{ printf "%s-%s" $serviceNamePretty "ks-service" | quote }} + annotations: + "helm.sh/hook-delete-policy": before-hook-creation +{{- if $jobAnnotations }} +{{ toYaml $jobAnnotations | indent 4 }} +{{- end }} + labels: + application: {{ $serviceName }} +{{- if $jobLabels }} +{{ toYaml $jobLabels | indent 4 }} +{{- end }} spec: backoffLimit: {{ $backoffLimit }} {{- if $activeDeadlineSeconds }} diff --git a/helm-toolkit/templates/manifests/_job-ks-user.yaml.tpl b/helm-toolkit/templates/manifests/_job-ks-user.yaml.tpl index b977b5a6b..f38337b2a 100644 --- a/helm-toolkit/templates/manifests/_job-ks-user.yaml.tpl +++ b/helm-toolkit/templates/manifests/_job-ks-user.yaml.tpl @@ -20,6 +20,8 @@ limitations under the License. {{- define "helm-toolkit.manifests.job_ks_user" -}} {{- $envAll := index . "envAll" -}} {{- $serviceName := index . "serviceName" -}} +{{- $jobAnnotations := index . "jobAnnotations" -}} +{{- $jobLabels := index . "jobLabels" -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $serviceUser := index . "serviceUser" | default $serviceName -}} @@ -43,6 +45,16 @@ apiVersion: batch/v1 kind: Job metadata: name: {{ printf "%s-%s" $serviceUserPretty "ks-user" | quote }} + annotations: + "helm.sh/hook-delete-policy": before-hook-creation +{{- if $jobAnnotations }} +{{ toYaml $jobAnnotations | indent 4 }} +{{- end }} + labels: + application: {{ $serviceName }} +{{- if $jobLabels }} +{{ toYaml $jobLabels | indent 4 }} +{{- end }} spec: backoffLimit: {{ $backoffLimit }} {{- if $activeDeadlineSeconds }} diff --git a/helm-toolkit/templates/manifests/_job-rabbit-init.yaml.tpl b/helm-toolkit/templates/manifests/_job-rabbit-init.yaml.tpl index ef56655ff..02727d99d 100644 --- a/helm-toolkit/templates/manifests/_job-rabbit-init.yaml.tpl +++ b/helm-toolkit/templates/manifests/_job-rabbit-init.yaml.tpl @@ -15,6 +15,8 @@ limitations under the License. {{- define "helm-toolkit.manifests.job_rabbit_init" -}} {{- $envAll := index . "envAll" -}} {{- $serviceName := index . "serviceName" -}} +{{- $jobAnnotations := index . "jobAnnotations" -}} +{{- $jobLabels := index . "jobLabels" -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $serviceUser := index . "serviceUser" | default $serviceName -}} @@ -30,6 +32,16 @@ apiVersion: batch/v1 kind: Job metadata: name: {{ printf "%s-%s" $serviceUserPretty "rabbit-init" | quote }} + annotations: + "helm.sh/hook-delete-policy": before-hook-creation +{{- if $jobAnnotations }} +{{ toYaml $jobAnnotations | indent 4 }} +{{- end }} + labels: + application: {{ $serviceName }} +{{- if $jobLabels }} +{{ toYaml $jobLabels | indent 4 }} +{{- end }} spec: backoffLimit: {{ $backoffLimit }} {{- if $activeDeadlineSeconds }} diff --git a/helm-toolkit/templates/manifests/_job-s3-bucket.yaml.tpl b/helm-toolkit/templates/manifests/_job-s3-bucket.yaml.tpl index 047a8c819..ef3dd0382 100644 --- a/helm-toolkit/templates/manifests/_job-s3-bucket.yaml.tpl +++ b/helm-toolkit/templates/manifests/_job-s3-bucket.yaml.tpl @@ -20,6 +20,8 @@ limitations under the License. {{- define "helm-toolkit.manifests.job_s3_bucket" -}} {{- $envAll := index . "envAll" -}} {{- $serviceName := index . "serviceName" -}} +{{- $jobAnnotations := index . "jobAnnotations" -}} +{{- $jobLabels := index . "jobLabels" -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapCeph := index . "configMapCeph" | default (printf "ceph-etc" ) -}} @@ -39,6 +41,15 @@ metadata: name: {{ printf "%s-%s" $serviceNamePretty "s3-bucket" | quote }} annotations: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} + "helm.sh/hook-delete-policy": before-hook-creation +{{- if $jobAnnotations }} +{{ toYaml $jobAnnotations | indent 4 }} +{{- end }} + labels: + application: {{ $serviceName }} +{{- if $jobLabels }} +{{ toYaml $jobLabels | indent 4 }} +{{- end }} spec: backoffLimit: {{ $backoffLimit }} {{- if $activeDeadlineSeconds }} diff --git a/helm-toolkit/templates/manifests/_job-s3-user.yaml.tpl b/helm-toolkit/templates/manifests/_job-s3-user.yaml.tpl index a86d4ee6a..9a8fe8581 100644 --- a/helm-toolkit/templates/manifests/_job-s3-user.yaml.tpl +++ b/helm-toolkit/templates/manifests/_job-s3-user.yaml.tpl @@ -20,6 +20,8 @@ limitations under the License. {{- define "helm-toolkit.manifests.job_s3_user" -}} {{- $envAll := index . "envAll" -}} {{- $serviceName := index . "serviceName" -}} +{{- $jobAnnotations := index . "jobAnnotations" -}} +{{- $jobLabels := index . "jobLabels" -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapCeph := index . "configMapCeph" | default (printf "ceph-etc" ) -}} @@ -37,7 +39,16 @@ kind: Job metadata: name: {{ printf "%s-%s" $serviceNamePretty "s3-user" | quote }} annotations: + "helm.sh/hook-delete-policy": before-hook-creation {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} +{{- if $jobAnnotations }} +{{ toYaml $jobAnnotations | indent 4 }} +{{- end }} + labels: + application: {{ $serviceName }} +{{- if $jobLabels }} +{{ toYaml $jobLabels | indent 4 }} +{{- end }} spec: backoffLimit: {{ $backoffLimit }} {{- if $activeDeadlineSeconds }} diff --git a/helm-toolkit/templates/manifests/_job_image_repo_sync.tpl b/helm-toolkit/templates/manifests/_job_image_repo_sync.tpl index 7d4b07820..3e3facb33 100644 --- a/helm-toolkit/templates/manifests/_job_image_repo_sync.tpl +++ b/helm-toolkit/templates/manifests/_job_image_repo_sync.tpl @@ -20,6 +20,8 @@ limitations under the License. {{- define "helm-toolkit.manifests.job_image_repo_sync" -}} {{- $envAll := index . "envAll" -}} {{- $serviceName := index . "serviceName" -}} +{{- $jobAnnotations := index . "jobAnnotations" -}} +{{- $jobLabels := index . "jobLabels" -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $podVolMounts := index . "podVolMounts" | default false -}} {{- $podVols := index . "podVols" | default false -}} @@ -36,6 +38,16 @@ apiVersion: batch/v1 kind: Job metadata: name: {{ printf "%s-%s" $serviceNamePretty "image-repo-sync" | quote }} + annotations: + "helm.sh/hook-delete-policy": before-hook-creation +{{- if $jobAnnotations }} +{{ toYaml $jobAnnotations | indent 4 }} +{{- end }} + labels: + application: {{ $serviceName }} +{{- if $jobLabels }} +{{ toYaml $jobLabels | indent 4 }} +{{- end }} spec: backoffLimit: {{ $backoffLimit }} {{- if $activeDeadlineSeconds }} diff --git a/releasenotes/notes/helm-toolkit.yaml b/releasenotes/notes/helm-toolkit.yaml index 8497c0ba0..e9a8fe190 100644 --- a/releasenotes/notes/helm-toolkit.yaml +++ b/releasenotes/notes/helm-toolkit.yaml @@ -12,4 +12,5 @@ helm-toolkit: - 0.2.3 Allow openstack service list to retry in event of keystone connection issues - 0.2.4 Added detailed FiXME for ks-service script bug and code changes - 0.2.5 Added logic to support cert-manager versioning + - 0.2.6 Add metadata in job templates ...