Add helm.sh/hook related annotations in keystone chart

Same motivation with openstack/openstack-helm-infra/776466

Depends-On: https://review.opendev.org/openstack/openstack-helm-infra/777980
Change-Id: I4388eda429f3093fed214633e5cebf3105bcebd3
This commit is contained in:
okozachenko 2021-03-01 13:01:10 +02:00
parent 287abeecb0
commit 909f967920
10 changed files with 40 additions and 6 deletions

View File

@ -14,7 +14,7 @@ apiVersion: v1
appVersion: v1.0.0 appVersion: v1.0.0
description: OpenStack-Helm Keystone description: OpenStack-Helm Keystone
name: keystone name: keystone
version: 0.1.8 version: 0.1.9
home: https://docs.openstack.org/keystone/latest/ home: https://docs.openstack.org/keystone/latest/
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Keystone/OpenStack_Project_Keystone_vertical.png icon: https://www.openstack.org/themes/openstack/images/project-mascots/Keystone/OpenStack_Project_Keystone_vertical.png
sources: sources:

View File

@ -12,8 +12,13 @@ See the License for the specific language governing permissions and
limitations under the License. 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 }} {{- 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 -}} {{- if .Values.manifests.certificates -}}
{{- $_ := set $bootstrapJob "tlsSecret" .Values.secrets.tls.identity.api.internal -}} {{- $_ := set $bootstrapJob "tlsSecret" .Values.secrets.tls.identity.api.internal -}}
{{- end -}} {{- end -}}

View File

@ -54,6 +54,9 @@ kind: Job
metadata: metadata:
name: keystone-credential-setup name: keystone-credential-setup
annotations: 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" }} {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
spec: spec:
template: template:

View File

@ -12,10 +12,15 @@ See the License for the specific language governing permissions and
limitations under the License. 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 }} {{- if .Values.manifests.job_db_init }}
{{- $dbInitJob := dict "envAll" . "serviceName" "keystone" -}} {{- $dbInitJob := dict "envAll" . "serviceName" "keystone" -}}
{{- if .Values.manifests.certificates -}} {{- 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 -}} {{- end -}}
{{ $dbInitJob | include "helm-toolkit.manifests.job_db_init_mysql" }} {{ $dbInitJob | include "helm-toolkit.manifests.job_db_init_mysql" }}
{{- end }} {{- end }}

View File

@ -12,6 +12,11 @@ See the License for the specific language governing permissions and
limitations under the License. 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" -}} {{- define "keystone.templates._job_db_sync.env_vars" -}}
{{- $envAll := index . 0 -}} {{- $envAll := index . 0 -}}
env: env:
@ -61,6 +66,6 @@ volumes:
{{- $_ := set $local "podVols" ( index ( tuple . | include "keystone.templates._job_db_sync.pod_vols" | toString | fromYaml ) "volumes" ) }} {{- $_ := set $local "podVols" ( index ( tuple . | include "keystone.templates._job_db_sync.pod_vols" | toString | fromYaml ) "volumes" ) }}
{{- end }} {{- end }}
{{- $podEnvVars := tuple . | include "keystone.templates._job_db_sync.env_vars" | toString | fromYaml }} {{- $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" }} {{ $dbSyncJob | include "helm-toolkit.manifests.job_db_sync" }}
{{- end }} {{- end }}

View File

@ -25,6 +25,9 @@ apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: keystone-domain-manage name: keystone-domain-manage
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
spec: spec:
template: template:
metadata: metadata:

View File

@ -54,6 +54,10 @@ apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: keystone-fernet-setup 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: spec:
template: template:
metadata: metadata:

View File

@ -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 See the License for the specific language governing permissions and
limitations under the License. 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 }} {{- 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" }} {{ $imageRepoSyncJob | include "helm-toolkit.manifests.job_image_repo_sync" }}
{{- end }} {{- end }}

View File

@ -12,7 +12,12 @@ See the License for the specific language governing permissions and
limitations under the License. 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 }} {{- 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" }} {{ $rmqUserJob | include "helm-toolkit.manifests.job_rabbit_init" }}
{{- end }} {{- end }}

View File

@ -9,3 +9,4 @@ keystone:
- 0.1.6 Fix typo in subPath entry - 0.1.6 Fix typo in subPath entry
- 0.1.7 Move rabbit-init to dynamic dependency - 0.1.7 Move rabbit-init to dynamic dependency
- 0.1.8 Change Issuer to ClusterIssuer - 0.1.8 Change Issuer to ClusterIssuer
- 0.1.9 Add helm.sh/hook related annotations