diff --git a/keystone/Chart.yaml b/keystone/Chart.yaml index ced1df005d..8997b310e3 100644 --- a/keystone/Chart.yaml +++ b/keystone/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Keystone name: keystone -version: 0.1.8 +version: 0.1.9 home: https://docs.openstack.org/keystone/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Keystone/OpenStack_Project_Keystone_vertical.png sources: diff --git a/keystone/templates/job-bootstrap.yaml b/keystone/templates/job-bootstrap.yaml index db222426ed..f065f2a6e0 100644 --- a/keystone/templates/job-bootstrap.yaml +++ b/keystone/templates/job-bootstrap.yaml @@ -12,8 +12,13 @@ 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" "keystone" "keystoneUser" .Values.bootstrap.ks_user "logConfigFile" .Values.conf.keystone.DEFAULT.log_config_append -}} +{{- $bootstrapJob := dict "envAll" . "serviceName" "keystone" "keystoneUser" .Values.bootstrap.ks_user "logConfigFile" .Values.conf.keystone.DEFAULT.log_config_append "jobAnnotations" (include "metadata.annotations.job.bootstrap" . | fromYaml) -}} {{- if .Values.manifests.certificates -}} {{- $_ := set $bootstrapJob "tlsSecret" .Values.secrets.tls.identity.api.internal -}} {{- end -}} diff --git a/keystone/templates/job-credential-setup.yaml b/keystone/templates/job-credential-setup.yaml index 53cdce43d1..11e8ce6055 100644 --- a/keystone/templates/job-credential-setup.yaml +++ b/keystone/templates/job-credential-setup.yaml @@ -54,6 +54,9 @@ kind: Job metadata: name: keystone-credential-setup annotations: + "helm.sh/hook": post-install,post-upgrade + "helm.sh/hook-weight": "-5" + "helm.sh/hook-delete-policy": before-hook-creation {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} spec: template: diff --git a/keystone/templates/job-db-init.yaml b/keystone/templates/job-db-init.yaml index 84e2ee917f..64064ce256 100644 --- a/keystone/templates/job-db-init.yaml +++ b/keystone/templates/job-db-init.yaml @@ -12,10 +12,15 @@ 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" "keystone" -}} {{- if .Values.manifests.certificates -}} -{{- $_ := set $dbInitJob "dbAdminTlsSecret" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal -}} +{{- $_ := set $dbInitJob "dbAdminTlsSecret" .Values.endpoints.oslo_db.auth.admin.secret.tls.internal "jobAnnotations" (include "metadata.annotations.job.db_init" . | fromYaml) -}} {{- end -}} {{ $dbInitJob | include "helm-toolkit.manifests.job_db_init_mysql" }} {{- end }} diff --git a/keystone/templates/job-db-sync.yaml b/keystone/templates/job-db-sync.yaml index 31348931a2..818d4a471e 100644 --- a/keystone/templates/job-db-sync.yaml +++ b/keystone/templates/job-db-sync.yaml @@ -12,6 +12,11 @@ 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 }} + {{- define "keystone.templates._job_db_sync.env_vars" -}} {{- $envAll := index . 0 -}} env: @@ -61,6 +66,6 @@ volumes: {{- $_ := set $local "podVols" ( index ( tuple . | include "keystone.templates._job_db_sync.pod_vols" | toString | fromYaml ) "volumes" ) }} {{- end }} {{- $podEnvVars := tuple . | include "keystone.templates._job_db_sync.env_vars" | toString | fromYaml }} -{{- $dbSyncJob := dict "envAll" . "serviceName" "keystone" "podVolMounts" $local.podVolMounts "podVols" $local.podVols "podEnvVars" $podEnvVars.env -}} +{{- $dbSyncJob := dict "envAll" . "serviceName" "keystone" "podVolMounts" $local.podVolMounts "podVols" $local.podVols "podEnvVars" $podEnvVars.env "jobAnnotations" (include "metadata.annotations.job.db_sync" . | fromYaml) -}} {{ $dbSyncJob | include "helm-toolkit.manifests.job_db_sync" }} {{- end }} diff --git a/keystone/templates/job-domain-manage.yaml b/keystone/templates/job-domain-manage.yaml index 3b8b62aaee..7164623a42 100644 --- a/keystone/templates/job-domain-manage.yaml +++ b/keystone/templates/job-domain-manage.yaml @@ -25,6 +25,9 @@ apiVersion: batch/v1 kind: Job metadata: name: keystone-domain-manage + annotations: + "helm.sh/hook": post-install,post-upgrade + "helm.sh/hook-delete-policy": before-hook-creation spec: template: metadata: diff --git a/keystone/templates/job-fernet-setup.yaml b/keystone/templates/job-fernet-setup.yaml index ac06632f10..c488414f8a 100644 --- a/keystone/templates/job-fernet-setup.yaml +++ b/keystone/templates/job-fernet-setup.yaml @@ -54,6 +54,10 @@ apiVersion: batch/v1 kind: Job metadata: name: keystone-fernet-setup + annotations: + "helm.sh/hook": post-install,post-upgrade + "helm.sh/hook-weight": "-5" + "helm.sh/hook-delete-policy": before-hook-creation spec: template: metadata: diff --git a/keystone/templates/job-image-repo-sync.yaml b/keystone/templates/job-image-repo-sync.yaml index 20f6678f24..fd301c3525 100644 --- a/keystone/templates/job-image-repo-sync.yaml +++ b/keystone/templates/job-image-repo-sync.yaml @@ -11,8 +11,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 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" "keystone" -}} +{{- $imageRepoSyncJob := dict "envAll" . "serviceName" "keystone" "jobAnnotations" (include "metadata.annotations.job.repo_sync" . | fromYaml) -}} {{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }} {{- end }} diff --git a/keystone/templates/job-rabbit-init.yaml b/keystone/templates/job-rabbit-init.yaml index ba7d7ce8c1..7208d33b6e 100644 --- a/keystone/templates/job-rabbit-init.yaml +++ b/keystone/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" "keystone" -}} +{{- $rmqUserJob := dict "envAll" . "serviceName" "keystone" "jobAnnotations" (include "metadata.annotations.job.rabbit_init" . | fromYaml) -}} {{ $rmqUserJob | include "helm-toolkit.manifests.job_rabbit_init" }} {{- end }} diff --git a/releasenotes/notes/keystone.yaml b/releasenotes/notes/keystone.yaml index 33befd93eb..1ff8f786f2 100644 --- a/releasenotes/notes/keystone.yaml +++ b/releasenotes/notes/keystone.yaml @@ -9,3 +9,4 @@ keystone: - 0.1.6 Fix typo in subPath entry - 0.1.7 Move rabbit-init to dynamic dependency - 0.1.8 Change Issuer to ClusterIssuer + - 0.1.9 Add helm.sh/hook related annotations