diff --git a/magnum/Chart.yaml b/magnum/Chart.yaml index 96163a8557..2e0a6e298c 100644 --- a/magnum/Chart.yaml +++ b/magnum/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Magnum name: magnum -version: 0.1.1 +version: 0.1.2 home: https://docs.openstack.org/magnum/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Magnum/OpenStack_Project_Magnum_vertical.png sources: diff --git a/magnum/templates/job-bootstrap.yaml b/magnum/templates/job-bootstrap.yaml index 2902bd9956..83ecd2ec15 100644 --- a/magnum/templates/job-bootstrap.yaml +++ b/magnum/templates/job-bootstrap.yaml @@ -12,7 +12,12 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- define "metadata.annotations.job.bootstrap" }} +helm.sh/hook: post-install,post-upgrade +helm.sh/hook-weight: "5" +{{- end }} + {{- if and .Values.manifests.job_bootstrap .Values.bootstrap.enabled }} -{{- $bootstrapJob := dict "envAll" . "serviceName" "magnum" "keystoneUser" .Values.bootstrap.ks_user "logConfigFile" .Values.conf.magnum.DEFAULT.log_config_append -}} +{{- $bootstrapJob := dict "envAll" . "serviceName" "magnum" "keystoneUser" .Values.bootstrap.ks_user "logConfigFile" .Values.conf.magnum.DEFAULT.log_config_append "jobAnnotations" (include "metadata.annotations.job.bootstrap" . | fromYaml) -}} {{ $bootstrapJob | include "helm-toolkit.manifests.job_bootstrap" }} {{- end }} diff --git a/magnum/templates/job-db-init.yaml b/magnum/templates/job-db-init.yaml index a8e9cf0d27..130e57cb60 100644 --- a/magnum/templates/job-db-init.yaml +++ b/magnum/templates/job-db-init.yaml @@ -12,7 +12,12 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- define "metadata.annotations.job.db_init" }} +helm.sh/hook: post-install,post-upgrade +helm.sh/hook-weight: "-5" +{{- end }} + {{- if .Values.manifests.job_db_init }} -{{- $dbInitJob := dict "envAll" . "serviceName" "magnum" -}} +{{- $dbInitJob := dict "envAll" . "serviceName" "magnum" "jobAnnotations" (include "metadata.annotations.job.db_init" . | fromYaml) -}} {{ $dbInitJob | include "helm-toolkit.manifests.job_db_init_mysql" }} {{- end }} diff --git a/magnum/templates/job-db-sync.yaml b/magnum/templates/job-db-sync.yaml index b606e32df4..2b5baa3a35 100644 --- a/magnum/templates/job-db-sync.yaml +++ b/magnum/templates/job-db-sync.yaml @@ -12,7 +12,12 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- define "metadata.annotations.job.db_sync" }} +helm.sh/hook: post-install,post-upgrade +helm.sh/hook-weight: "-4" +{{- end }} + {{- if .Values.manifests.job_db_sync }} -{{- $dbSyncJob := dict "envAll" . "serviceName" "magnum" "podVolMounts" .Values.pod.mounts.magnum_db_sync.magnum_db_sync.volumeMounts "podVols" .Values.pod.mounts.magnum_db_sync.magnum_db_sync.volumes -}} +{{- $dbSyncJob := dict "envAll" . "serviceName" "magnum" "podVolMounts" .Values.pod.mounts.magnum_db_sync.magnum_db_sync.volumeMounts "podVols" .Values.pod.mounts.magnum_db_sync.magnum_db_sync.volumes "jobAnnotations" (include "metadata.annotations.job.db_sync" . | fromYaml) -}} {{ $dbSyncJob | include "helm-toolkit.manifests.job_db_sync" }} {{- end }} diff --git a/magnum/templates/job-image-repo-sync.yaml b/magnum/templates/job-image-repo-sync.yaml index 83bf761fff..4cb06703b3 100644 --- a/magnum/templates/job-image-repo-sync.yaml +++ b/magnum/templates/job-image-repo-sync.yaml @@ -12,7 +12,11 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- define "metadata.annotations.job.repo_sync" }} +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" "magnum" -}} +{{- $imageRepoSyncJob := dict "envAll" . "serviceName" "magnum" "jobAnnotations" (include "metadata.annotations.job.repo_sync" . | fromYaml) -}} {{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }} {{- end }} diff --git a/magnum/templates/job-ks-endpoints.yaml b/magnum/templates/job-ks-endpoints.yaml index e6014f21f4..179aeaab53 100644 --- a/magnum/templates/job-ks-endpoints.yaml +++ b/magnum/templates/job-ks-endpoints.yaml @@ -12,7 +12,12 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- define "metadata.annotations.job.ks_endpoints" }} +helm.sh/hook: post-install,post-upgrade +helm.sh/hook-weight: "-2" +{{- end }} + {{- if .Values.manifests.job_ks_endpoints }} -{{- $ksServiceJob := dict "envAll" . "serviceName" "magnum" "serviceTypes" ( tuple "container-infra" ) -}} +{{- $ksServiceJob := dict "envAll" . "serviceName" "magnum" "serviceTypes" ( tuple "container-infra" ) "jobAnnotations" (include "metadata.annotations.job.ks_endpoints" . | fromYaml) -}} {{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_endpoints" }} {{- end }} diff --git a/magnum/templates/job-ks-service.yaml b/magnum/templates/job-ks-service.yaml index b2051c696b..5e7944b4cb 100644 --- a/magnum/templates/job-ks-service.yaml +++ b/magnum/templates/job-ks-service.yaml @@ -12,7 +12,12 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- define "metadata.annotations.job.ks_service" }} +helm.sh/hook: post-install,post-upgrade +helm.sh/hook-weight: "-3" +{{- end }} + {{- if .Values.manifests.job_ks_service }} -{{- $ksServiceJob := dict "envAll" . "serviceName" "magnum" "serviceTypes" ( tuple "container-infra" ) -}} +{{- $ksServiceJob := dict "envAll" . "serviceName" "magnum" "serviceTypes" ( tuple "container-infra" ) "jobAnnotations" (include "metadata.annotations.job.ks_service" . | fromYaml) -}} {{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_service" }} {{- end }} diff --git a/magnum/templates/job-ks-user-domain.yaml b/magnum/templates/job-ks-user-domain.yaml index ff645e893c..4521148d35 100644 --- a/magnum/templates/job-ks-user-domain.yaml +++ b/magnum/templates/job-ks-user-domain.yaml @@ -23,6 +23,8 @@ kind: Job metadata: name: magnum-domain-ks-user annotations: + "helm.sh/hook": post-install,post-upgrade + "helm.sh/hook-delete-policy": before-hook-creation {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} spec: template: diff --git a/magnum/templates/job-ks-user.yaml b/magnum/templates/job-ks-user.yaml index 661b43ab6d..cf34873357 100644 --- a/magnum/templates/job-ks-user.yaml +++ b/magnum/templates/job-ks-user.yaml @@ -12,7 +12,12 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- define "metadata.annotations.job.ks_user" }} +helm.sh/hook: post-install,post-upgrade +helm.sh/hook-weight: "-1" +{{- end }} + {{- if .Values.manifests.job_ks_user }} -{{- $ksUserJob := dict "envAll" . "serviceName" "magnum" -}} +{{- $ksUserJob := dict "envAll" . "serviceName" "magnum" "jobAnnotations" (include "metadata.annotations.job.ks_user" . | fromYaml) -}} {{ $ksUserJob | include "helm-toolkit.manifests.job_ks_user" }} {{- end }} diff --git a/magnum/templates/job-rabbit-init.yaml b/magnum/templates/job-rabbit-init.yaml index 9ca6f7d06a..399a32e57a 100644 --- a/magnum/templates/job-rabbit-init.yaml +++ b/magnum/templates/job-rabbit-init.yaml @@ -12,7 +12,12 @@ See the License for the specific language governing permissions and limitations under the License. */}} +{{- define "metadata.annotations.job.rabbit_init" }} +helm.sh/hook: post-install,post-upgrade +helm.sh/hook-weight: "-4" +{{- end }} + {{- if .Values.manifests.job_rabbit_init }} -{{- $rmqUserJob := dict "envAll" . "serviceName" "magnum" -}} +{{- $rmqUserJob := dict "envAll" . "serviceName" "magnum" "jobAnnotations" (include "metadata.annotations.job.rabbit_init" . | fromYaml) -}} {{ $rmqUserJob | include "helm-toolkit.manifests.job_rabbit_init" }} {{- end }} diff --git a/releasenotes/notes/magnum.yaml b/releasenotes/notes/magnum.yaml index ac0a4b1977..c67e27627c 100644 --- a/releasenotes/notes/magnum.yaml +++ b/releasenotes/notes/magnum.yaml @@ -2,3 +2,4 @@ magnum: - 0.1.0 Initial Chart - 0.1.1 Change helm-toolkit dependency version to ">= 0.1.0" + - 0.1.2 Added post-install and post-upgrade helm hook for jobs