From 1c87fe6fe3dc3c3d06b2251e1253c760535289a7 Mon Sep 17 00:00:00 2001 From: Karl Kloppenborg Date: Mon, 16 Jan 2023 05:48:44 +0000 Subject: [PATCH] chore: add helm3 hook capabilities to ironic bugfix: add helm3_hook default bugfix: revert change on neutron - not applicable to this changeset Change-Id: I4bc60e8e34a6861742f1f9e7582e69f49740ab87 --- ironic/Chart.yaml | 2 +- ironic/templates/job-bootstrap.yaml | 5 ++++- ironic/templates/job-db-init.yaml | 5 ++++- ironic/templates/job-db-sync.yaml | 5 ++++- ironic/templates/job-image-repo-sync.yaml | 5 ++++- ironic/templates/job-ks-endpoints.yaml | 5 ++++- ironic/templates/job-ks-service.yaml | 5 ++++- ironic/templates/job-ks-user.yaml | 5 ++++- ironic/templates/job-manage-cleaning-network.yaml | 2 ++ ironic/templates/job-rabbit-init.yaml | 5 ++++- ironic/values.yaml | 2 ++ releasenotes/notes/ironic.yaml | 1 + 12 files changed, 38 insertions(+), 9 deletions(-) diff --git a/ironic/Chart.yaml b/ironic/Chart.yaml index 8dccfabb41..da269916b3 100644 --- a/ironic/Chart.yaml +++ b/ironic/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Ironic name: ironic -version: 0.2.7 +version: 0.2.8 home: https://docs.openstack.org/ironic/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Ironic/OpenStack_Project_Ironic_vertical.png sources: diff --git a/ironic/templates/job-bootstrap.yaml b/ironic/templates/job-bootstrap.yaml index 190d412db9..3a942b6944 100644 --- a/ironic/templates/job-bootstrap.yaml +++ b/ironic/templates/job-bootstrap.yaml @@ -19,10 +19,13 @@ helm.sh/hook-weight: "5" {{- if and .Values.manifests.job_bootstrap .Values.bootstrap.image.enabled }} {{- if .Values.bootstrap.image.openstack.enabled }} -{{- $bootstrapJob := dict "envAll" . "serviceName" "ironic" "keystoneUser" .Values.bootstrap.image.openstack.ks_user "logConfigFile" .Values.conf.ironic.DEFAULT.log_config_append "jobAnnotations" (include "metadata.annotations.job.bootstrap" . | fromYaml) -}} +{{- $bootstrapJob := dict "envAll" . "serviceName" "ironic" "keystoneUser" .Values.bootstrap.image.openstack.ks_user "logConfigFile" .Values.conf.ironic.DEFAULT.log_config_append -}} {{- if .Values.pod.tolerations.ironic.enabled -}} {{- $_ := set $bootstrapJob "tolerationsEnabled" true -}} {{- end -}} +{{- if .Values.helm3_hook }} +{{- $_ := set $bootstrapJob "jobAnnotations" (include "metadata.annotations.job.bootstrap" . | fromYaml) }} +{{- end }} {{ $bootstrapJob | include "helm-toolkit.manifests.job_bootstrap" }} {{- else }} {{ include "helm-toolkit.manifests.job_bootstrap" }} diff --git a/ironic/templates/job-db-init.yaml b/ironic/templates/job-db-init.yaml index 22c071d5ec..9ec9fda52f 100644 --- a/ironic/templates/job-db-init.yaml +++ b/ironic/templates/job-db-init.yaml @@ -18,7 +18,10 @@ helm.sh/hook-weight: "-5" {{- end }} {{- if .Values.manifests.job_db_init }} -{{- $dbInitJob := dict "envAll" . "serviceName" "ironic" "jobAnnotations" (include "metadata.annotations.job.db_init" . | fromYaml) -}} +{{- $dbInitJob := dict "envAll" . "serviceName" "ironic" "jobAnnotations" -}} +{{- if .Values.helm3_hook }} +{{- $_ := set $dbInitJob "jobAnnotations" (include "metadata.annotations.job.db_init" . | fromYaml) }} +{{- end }} {{- if .Values.pod.tolerations.ironic.enabled -}} {{- $_ := set $dbInitJob "tolerationsEnabled" true -}} {{- end -}} diff --git a/ironic/templates/job-db-sync.yaml b/ironic/templates/job-db-sync.yaml index c397bcf28e..fecf8a53e2 100644 --- a/ironic/templates/job-db-sync.yaml +++ b/ironic/templates/job-db-sync.yaml @@ -18,7 +18,10 @@ helm.sh/hook-weight: "-4" {{- end }} {{- if .Values.manifests.job_db_sync }} -{{- $dbSyncJob := dict "envAll" . "serviceName" "ironic" "podVolMounts" .Values.pod.mounts.ironic_db_sync.ironic_db_sync.volumeMounts "podVols" .Values.pod.mounts.ironic_db_sync.ironic_db_sync.volumes "jobAnnotations" (include "metadata.annotations.job.db_sync" . | fromYaml) -}} +{{- $dbSyncJob := dict "envAll" . "serviceName" "ironic" "podVolMounts" .Values.pod.mounts.ironic_db_sync.ironic_db_sync.volumeMounts "podVols" .Values.pod.mounts.ironic_db_sync.ironic_db_sync.volumes -}} +{{- if .Values.helm3_hook }} +{{- $_ := set $dbSyncJob "jobAnnotations" (include "metadata.annotations.job.db_sync" . | fromYaml) }} +{{- end }} {{- if .Values.pod.tolerations.ironic.enabled -}} {{- $_ := set $dbSyncJob "tolerationsEnabled" true -}} {{- end -}} diff --git a/ironic/templates/job-image-repo-sync.yaml b/ironic/templates/job-image-repo-sync.yaml index e83bac9151..fa31d0e0fc 100644 --- a/ironic/templates/job-image-repo-sync.yaml +++ b/ironic/templates/job-image-repo-sync.yaml @@ -17,7 +17,10 @@ helm.sh/hook: post-install,post-upgrade {{- end }} {{- if and .Values.manifests.job_image_repo_sync .Values.images.local_registry.active }} -{{- $imageRepoSyncJob := dict "envAll" . "serviceName" "ironic" "jobAnnotations" (include "metadata.annotations.job.repo_sync" . | fromYaml) -}} +{{- $imageRepoSyncJob := dict "envAll" . "serviceName" "ironic" -}} +{{- if .Values.helm3_hook }} +{{- $_ := $imageRepoSyncJob "jobAnnotations" (include "metadata.annotations.job.repo_sync" . | fromYaml) }} +{{- end }} {{- if .Values.pod.tolerations.ironic.enabled -}} {{- $_ := set $imageRepoSyncJob "tolerationsEnabled" true -}} {{- end -}} diff --git a/ironic/templates/job-ks-endpoints.yaml b/ironic/templates/job-ks-endpoints.yaml index 940e13ceac..1b3a915159 100644 --- a/ironic/templates/job-ks-endpoints.yaml +++ b/ironic/templates/job-ks-endpoints.yaml @@ -18,7 +18,10 @@ helm.sh/hook-weight: "-2" {{- end }} {{- if .Values.manifests.job_ks_endpoints }} -{{- $ksEndpointsJob := dict "envAll" . "serviceName" "ironic" "serviceTypes" ( tuple "baremetal" ) "jobAnnotations" (include "metadata.annotations.job.ks_endpoints" . | fromYaml) -}} +{{- $ksEndpointsJob := dict "envAll" . "serviceName" "ironic" "serviceTypes" ( tuple "baremetal" ) -}} +{{- if .Values.helm3_hook }} +{{- $_ := set $ksEndpointsJob "jobAnnotations" (include "metadata.annotations.job.ks_endpoints" . | fromYaml) }} +{{- end }} {{- if .Values.pod.tolerations.ironic.enabled -}} {{- $_ := set $ksEndpointsJob "tolerationsEnabled" true -}} {{- end -}} diff --git a/ironic/templates/job-ks-service.yaml b/ironic/templates/job-ks-service.yaml index 40cc978628..686fa091f8 100644 --- a/ironic/templates/job-ks-service.yaml +++ b/ironic/templates/job-ks-service.yaml @@ -18,7 +18,10 @@ helm.sh/hook-weight: "-3" {{- end }} {{- if .Values.manifests.job_ks_service }} -{{- $ksServiceJob := dict "envAll" . "serviceName" "ironic" "serviceTypes" ( tuple "baremetal" ) "jobAnnotations" (include "metadata.annotations.job.ks_service" . | fromYaml) -}} +{{- $ksServiceJob := dict "envAll" . "serviceName" "ironic" "serviceTypes" ( tuple "baremetal" ) -}} +{{- if .Values.helm3_hook }} +{{- $_ := set $ksServiceJob "jobAnnotations" (include "metadata.annotations.job.ks_service" . | fromYaml) }} +{{- end }} {{- if .Values.pod.tolerations.ironic.enabled -}} {{- $_ := set $ksServiceJob "tolerationsEnabled" true -}} {{- end -}} diff --git a/ironic/templates/job-ks-user.yaml b/ironic/templates/job-ks-user.yaml index a09aa9d217..ed587397de 100644 --- a/ironic/templates/job-ks-user.yaml +++ b/ironic/templates/job-ks-user.yaml @@ -18,7 +18,10 @@ helm.sh/hook-weight: "-1" {{- end }} {{- if .Values.manifests.job_ks_user }} -{{- $ksUserJob := dict "envAll" . "serviceName" "ironic" "jobAnnotations" (include "metadata.annotations.job.ks_user" . | fromYaml) -}} +{{- $ksUserJob := dict "envAll" . "serviceName" "ironic" "jobAnnotations" -}} +{{- if .Values.helm3_hook }} +{{- $_ := set $ksUserJob "jobAnnotations" (include "metadata.annotations.job.ks_user" . | fromYaml) }} +{{- end }} {{- if .Values.pod.tolerations.ironic.enabled -}} {{- $_ := set $ksUserJob "tolerationsEnabled" true -}} {{- end -}} diff --git a/ironic/templates/job-manage-cleaning-network.yaml b/ironic/templates/job-manage-cleaning-network.yaml index 8902fa8621..18e9476964 100644 --- a/ironic/templates/job-manage-cleaning-network.yaml +++ b/ironic/templates/job-manage-cleaning-network.yaml @@ -23,8 +23,10 @@ kind: Job metadata: name: ironic-manage-cleaning-network annotations: +{{- if .Values.helm3_hook }} "helm.sh/hook": post-install,post-upgrade "helm.sh/hook-delete-policy": before-hook-creation +{{- end }} {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} spec: template: diff --git a/ironic/templates/job-rabbit-init.yaml b/ironic/templates/job-rabbit-init.yaml index 8d80b7c2f7..0abfa91ac0 100644 --- a/ironic/templates/job-rabbit-init.yaml +++ b/ironic/templates/job-rabbit-init.yaml @@ -18,7 +18,10 @@ helm.sh/hook-weight: "-4" {{- end }} {{- if .Values.manifests.job_rabbit_init }} -{{- $rmqUserJob := dict "envAll" . "serviceName" "ironic" "jobAnnotations" (include "metadata.annotations.job.rabbit_init" . | fromYaml) -}} +{{- $rmqUserJob := dict "envAll" . "serviceName" "ironic" -}} +{{- if .Values.helm3_hook }} +{{- $_ := set $rmqUserJob "jobAnnotations" (include "metadata.annotations.job.rabbit_init" . | fromYaml) }} +{{- end }} {{- if .Values.pod.tolerations.ironic.enabled -}} {{- $_ := set $rmqUserJob "tolerationsEnabled" true -}} {{- end -}} diff --git a/ironic/values.yaml b/ironic/values.yaml index 6e5e3a8d42..5c908d4553 100644 --- a/ironic/values.yaml +++ b/ironic/values.yaml @@ -18,6 +18,8 @@ --- release_group: null +helm3_hook: true + labels: api: node_selector_key: openstack-control-plane diff --git a/releasenotes/notes/ironic.yaml b/releasenotes/notes/ironic.yaml index cdfa34034d..e0c8112ae7 100644 --- a/releasenotes/notes/ironic.yaml +++ b/releasenotes/notes/ironic.yaml @@ -11,4 +11,5 @@ ironic: - 0.2.5 Migrated PodDisruptionBudget resource to policy/v1 API version - 0.2.6 Added OCI registry authentication - 0.2.7 Use HTTP probe instead of TCP probe + - 0.2.8 Add helm3 hook supports to allow things like terraform deploys ...