From 6e4bcebcf59944fb25909f71e51d4e701e1bed45 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Fri, 9 Mar 2018 14:25:15 +0000 Subject: [PATCH] DB-Drop-Jobs: consolidate to helm-toolkit This PS consolidates the DB-Drop Job to helm-toolkit. Change-Id: Ia2b035d730bf612086a9fd9b5d14aba494f56dc7 --- barbican/templates/job-db-drop.yaml | 73 +---------- ceilometer/templates/job-db-drop.yaml | 20 +++ ceilometer/values.yaml | 1 + cinder/templates/job-db-drop.yaml | 70 +--------- congress/templates/job-db-drop.yaml | 20 +++ congress/values.yaml | 1 + glance/templates/job-db-drop.yaml | 72 +--------- gnocchi/templates/job-db-drop.yaml | 20 +++ gnocchi/values.yaml | 1 + heat/templates/job-db-drop.yaml | 70 +--------- .../manifests/_job-db-drop-mysql.yaml.tpl | 123 ++++++++++++++++++ horizon/templates/job-db-drop.yaml | 64 +-------- ironic/templates/job-db-drop.yaml | 20 +++ ironic/values.yaml | 1 + keystone/templates/job-db-drop.yaml | 75 +---------- magnum/templates/job-db-drop.yaml | 70 +--------- mistral/templates/job-db-drop.yaml | 70 +--------- neutron/templates/job-db-drop.yaml | 70 +--------- nova/templates/job-db-drop.yaml | 104 +-------------- senlin/templates/job-db-drop.yaml | 70 +--------- 20 files changed, 239 insertions(+), 776 deletions(-) create mode 100644 ceilometer/templates/job-db-drop.yaml create mode 100644 congress/templates/job-db-drop.yaml create mode 100644 gnocchi/templates/job-db-drop.yaml create mode 100644 helm-toolkit/templates/manifests/_job-db-drop-mysql.yaml.tpl create mode 100644 ironic/templates/job-db-drop.yaml diff --git a/barbican/templates/job-db-drop.yaml b/barbican/templates/job-db-drop.yaml index 41365ccbc6..3c6ec5d451 100644 --- a/barbican/templates/job-db-drop.yaml +++ b/barbican/templates/job-db-drop.yaml @@ -15,73 +15,8 @@ limitations under the License. */}} {{- if .Values.manifests.job_db_drop }} -{{- $envAll := . }} -{{- $dependencies := .Values.dependencies.static.db_drop }} - -{{- $randStringSuffix := randAlphaNum 5 | lower }} - -{{- $serviceAccountName := print "barbican-db-drop-" $randStringSuffix }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ print "barbican-db-drop-" $randStringSuffix }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - labels: -{{ tuple $envAll "barbican" "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: - {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} - initContainers: -{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: barbican-db-drop - image: {{ .Values.images.tags.db_drop }} - imagePullPolicy: {{ .Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.admin }} - key: DB_CONNECTION - - name: OPENSTACK_CONFIG_FILE - value: /etc/barbican/barbican.conf - - name: OPENSTACK_CONFIG_DB_SECTION - value: DEFAULT - - name: OPENSTACK_CONFIG_DB_KEY - value: sql_connection - command: - - /tmp/db-drop.py - volumeMounts: - - name: barbican-etc - mountPath: /etc/barbican - - name: barbican-bin - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true - - name: barbican-conf - mountPath: /etc/barbican/barbican.conf - subPath: barbican.conf - readOnly: true - volumes: - - name: barbican-etc - emptyDir: {} - - name: barbican-conf - configMap: - name: barbican-etc - defaultMode: 0444 - - name: barbican-bin - configMap: - name: barbican-bin - defaultMode: 0555 - +{{- $serviceName := "barbican" -}} +{{- $dbToDrop := dict "adminSecret" .Values.secrets.oslo_db.admin "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "configDbSection" "DEFAULT" "configDbKey" "sql_connection" -}} +{{- $dbDropJob := dict "envAll" . "serviceName" $serviceName "dbToDrop" $dbToDrop -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/ceilometer/templates/job-db-drop.yaml b/ceilometer/templates/job-db-drop.yaml new file mode 100644 index 0000000000..865a2ab0fd --- /dev/null +++ b/ceilometer/templates/job-db-drop.yaml @@ -0,0 +1,20 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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. +*/}} + +{{- if .Values.manifests.job_db_drop }} +{{- $dbDropJob := dict "envAll" . "serviceName" "ceilometer" -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} +{{- end }} diff --git a/ceilometer/values.yaml b/ceilometer/values.yaml index e14819974a..09f45d3f9f 100644 --- a/ceilometer/values.yaml +++ b/ceilometer/values.yaml @@ -1937,6 +1937,7 @@ manifests: deployment_notification: true ingress_api: true job_bootstrap: true + job_db_drop: false job_db_init: true job_db_init_mongodb: true job_db_sync: true diff --git a/cinder/templates/job-db-drop.yaml b/cinder/templates/job-db-drop.yaml index 9ad3f36189..9e4f5e2c2a 100644 --- a/cinder/templates/job-db-drop.yaml +++ b/cinder/templates/job-db-drop.yaml @@ -15,72 +15,6 @@ limitations under the License. */}} {{- if .Values.manifests.job_db_drop }} -{{- $envAll := . }} -{{- $dependencies := .Values.dependencies.static.db_drop }} - -{{- $randStringSuffix := randAlphaNum 5 | lower }} - -{{- $serviceAccountName := print "cinder-db-drop-" $randStringSuffix }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ print "cinder-db-drop-" $randStringSuffix }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - labels: -{{ tuple $envAll "cinder" "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: - {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} - initContainers: -{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: cinder-db-drop - image: {{ .Values.images.tags.db_drop }} - imagePullPolicy: {{ .Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.admin }} - key: DB_CONNECTION - - name: OPENSTACK_CONFIG_FILE - value: /etc/cinder/cinder.conf - - name: OPENSTACK_CONFIG_DB_SECTION - value: database - - name: OPENSTACK_CONFIG_DB_KEY - value: connection - command: - - /tmp/db-drop.py - volumeMounts: - - name: cinder-bin - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true - - name: etccinder - mountPath: /etc/cinder - - name: cinder-etc - mountPath: /etc/cinder/cinder.conf - subPath: cinder.conf - readOnly: true - volumes: - - name: etccinder - emptyDir: {} - - name: cinder-etc - configMap: - name: cinder-etc - defaultMode: 0444 - - name: cinder-bin - configMap: - name: cinder-bin - defaultMode: 0555 +{{- $dbDropJob := dict "envAll" . "serviceName" "cinder" -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/congress/templates/job-db-drop.yaml b/congress/templates/job-db-drop.yaml new file mode 100644 index 0000000000..3e790d16af --- /dev/null +++ b/congress/templates/job-db-drop.yaml @@ -0,0 +1,20 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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. +*/}} + +{{- if .Values.manifests.job_db_drop }} +{{- $dbDropJob := dict "envAll" . "serviceName" "congress" -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} +{{- end }} diff --git a/congress/values.yaml b/congress/values.yaml index c3457d79e0..3e5977275b 100644 --- a/congress/values.yaml +++ b/congress/values.yaml @@ -476,6 +476,7 @@ manifests: deployment_policy_engine: true ingress_api: true job_bootstrap: true + job_db_drop: false job_db_init: true job_db_sync: true job_ds_create: true diff --git a/glance/templates/job-db-drop.yaml b/glance/templates/job-db-drop.yaml index 8c65bd0c28..1622b06244 100644 --- a/glance/templates/job-db-drop.yaml +++ b/glance/templates/job-db-drop.yaml @@ -15,72 +15,8 @@ limitations under the License. */}} {{- if .Values.manifests.job_db_drop }} -{{- $envAll := . }} -{{- $dependencies := .Values.dependencies.static.db_drop }} - -{{- $randStringSuffix := randAlphaNum 5 | lower }} - -{{- $serviceAccountName := print "glance-db-drop-" $randStringSuffix }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ print "glance-db-drop-" $randStringSuffix }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - labels: -{{ tuple $envAll "glance" "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: - {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} - initContainers: -{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: glance-db-drop - image: {{ .Values.images.tags.db_drop }} - imagePullPolicy: {{ .Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.admin }} - key: DB_CONNECTION - - name: OPENSTACK_CONFIG_FILE - value: /etc/glance/glance-api.conf - - name: OPENSTACK_CONFIG_DB_SECTION - value: database - - name: OPENSTACK_CONFIG_DB_KEY - value: connection - command: - - /tmp/db-drop.py - volumeMounts: - - name: glance-bin - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true - - name: etcglance - mountPath: /etc/glance - - name: glance-etc - mountPath: /etc/glance/glance-api.conf - subPath: glance-api.conf - readOnly: true - volumes: - - name: etcglance - emptyDir: {} - - name: glance-etc - configMap: - name: glance-etc - defaultMode: 0444 - - name: glance-bin - configMap: - name: glance-bin - defaultMode: 0555 +{{- $serviceName := "glance" -}} +{{- $dbToDrop := dict "adminSecret" .Values.secrets.oslo_db.admin "configFile" (printf "/etc/%s/%s.conf" $serviceName "glance-api" ) "configDbSection" "database" "configDbKey" "connection" -}} +{{- $dbDropJob := dict "envAll" . "serviceName" $serviceName "dbToDrop" $dbToDrop -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/gnocchi/templates/job-db-drop.yaml b/gnocchi/templates/job-db-drop.yaml new file mode 100644 index 0000000000..ac2b6562a3 --- /dev/null +++ b/gnocchi/templates/job-db-drop.yaml @@ -0,0 +1,20 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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. +*/}} + +{{- if .Values.manifests.job_db_drop }} +{{- $dbDropJob := dict "envAll" . "serviceName" "gnocchi" -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} +{{- end }} diff --git a/gnocchi/values.yaml b/gnocchi/values.yaml index 6d6f7293ba..11cafd16ca 100644 --- a/gnocchi/values.yaml +++ b/gnocchi/values.yaml @@ -503,6 +503,7 @@ manifests: ingress_api: true job_bootstrap: true job_clean: true + job_db_drop: false job_db_init_indexer: true job_db_init: true secret_db_indexer: true diff --git a/heat/templates/job-db-drop.yaml b/heat/templates/job-db-drop.yaml index 20ee0df34b..36020b3337 100644 --- a/heat/templates/job-db-drop.yaml +++ b/heat/templates/job-db-drop.yaml @@ -15,72 +15,6 @@ limitations under the License. */}} {{- if .Values.manifests.job_db_drop }} -{{- $envAll := . }} -{{- $dependencies := .Values.dependencies.static.db_drop }} - -{{- $randStringSuffix := randAlphaNum 5 | lower }} - -{{- $serviceAccountName := print "heat-db-drop-" $randStringSuffix }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ print "heat-db-drop-" $randStringSuffix }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - labels: -{{ tuple $envAll "heat" "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: - {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} - initContainers: -{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: heat-db-drop - image: {{ .Values.images.tags.db_drop }} - imagePullPolicy: {{ .Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.admin }} - key: DB_CONNECTION - - name: OPENSTACK_CONFIG_FILE - value: /etc/heat/heat.conf - - name: OPENSTACK_CONFIG_DB_SECTION - value: database - - name: OPENSTACK_CONFIG_DB_KEY - value: connection - command: - - /tmp/db-drop.py - volumeMounts: - - name: heat-bin - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true - - name: etcheat - mountPath: /etc/heat - - name: heat-etc - mountPath: /etc/heat/heat.conf - subPath: heat.conf - readOnly: true - volumes: - - name: etcheat - emptyDir: {} - - name: heat-etc - configMap: - name: heat-etc - defaultMode: 0444 - - name: heat-bin - configMap: - name: heat-bin - defaultMode: 0555 +{{- $dbDropJob := dict "envAll" . "serviceName" "heat" -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/helm-toolkit/templates/manifests/_job-db-drop-mysql.yaml.tpl b/helm-toolkit/templates/manifests/_job-db-drop-mysql.yaml.tpl new file mode 100644 index 0000000000..753ff8bd23 --- /dev/null +++ b/helm-toolkit/templates/manifests/_job-db-drop-mysql.yaml.tpl @@ -0,0 +1,123 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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. +*/}} + +# This function creates a manifest for db creation and user management. +# It can be used in charts dict created similar to the following: +# {- $dbToDropJob := dict "envAll" . "serviceName" "senlin" -} +# { $dbToDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" } +# +# If the service does not use olso then the db can be managed with: +# {- $dbToDrop := dict "inputType" "secret" "adminSecret" .Values.secrets.oslo_db.admin "userSecret" .Values.secrets.oslo_db.horizon -} +# {- $dbToDropJob := dict "envAll" . "serviceName" "horizon" "dbToDrop" $dbToDrop -} +# { $dbToDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" } + +{{- define "helm-toolkit.manifests.job_db_drop_mysql" -}} +{{- $envAll := index . "envAll" -}} +{{- $serviceName := index . "serviceName" -}} +{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} +{{- $dependencies := index . "dependencies" | default $envAll.Values.dependencies.static.db_drop -}} +{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} +{{- $configMapEtc := index . "configMapEtc" | default (printf "%s-%s" $serviceName "etc" ) -}} +{{- $dbToDrop := index . "dbToDrop" | default ( dict "adminSecret" $envAll.Values.secrets.oslo_db.admin "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "configDbSection" "database" "configDbKey" "connection" ) -}} +{{- $dbsToDrop := default (list $dbToDrop) (index . "dbsToDrop") }} + +{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} + +{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "db-drop" }} +{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ printf "%s-%s" $serviceNamePretty "db-drop" | quote }} + annotations: + "helm.sh/hook": pre-delete + "helm.sh/hook-delete-policy": hook-succeeded +spec: + template: + metadata: + labels: +{{ tuple $envAll $serviceName "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} + spec: + serviceAccountName: {{ $serviceAccountName }} + restartPolicy: OnFailure + nodeSelector: +{{ toYaml $nodeSelector | indent 8 }} + initContainers: +{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} + containers: +{{- range $key1, $dbToDrop := $dbsToDrop }} +{{ $dbToDropType := default "oslo" $dbToDrop.inputType }} + - name: {{ printf "%s-%s-%d" $serviceNamePretty "db-drop" $key1 | quote }} + image: {{ $envAll.Values.images.tags.db_drop }} + imagePullPolicy: {{ $envAll.Values.images.pull_policy }} +{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} + env: + - name: ROOT_DB_CONNECTION + valueFrom: + secretKeyRef: + name: {{ $dbToDrop.adminSecret | quote }} + key: DB_CONNECTION +{{- if eq $dbToDropType "oslo" }} + - name: OPENSTACK_CONFIG_FILE + value: {{ $dbToDrop.configFile | quote }} + - name: OPENSTACK_CONFIG_DB_SECTION + value: {{ $dbToDrop.configDbSection | quote }} + - name: OPENSTACK_CONFIG_DB_KEY + value: {{ $dbToDrop.configDbKey | quote }} +{{- end }} +{{- if eq $dbToDropType "secret" }} + - name: DB_CONNECTION + valueFrom: + secretKeyRef: + name: {{ $dbToDrop.userSecret | quote }} + key: DB_CONNECTION +{{- end }} + command: + - /tmp/db-drop.py + volumeMounts: + - name: db-drop-sh + mountPath: /tmp/db-drop.py + subPath: db-drop.py + readOnly: true +{{- if eq $dbToDropType "oslo" }} + - name: etc-service + mountPath: {{ dir $dbToDrop.configFile | quote }} + - name: db-drop-conf + mountPath: {{ $dbToDrop.configFile | quote }} + subPath: {{ base $dbToDrop.configFile | quote }} + readOnly: true +{{- end }} +{{- end }} + volumes: + - name: db-drop-sh + configMap: + name: {{ $configMapBin | quote }} + defaultMode: 0555 +{{- $local := dict "configMapBinFirst" true -}} +{{- range $key1, $dbToDrop := $dbsToDrop }} +{{- $dbToDropType := default "oslo" $dbToDrop.inputType }} +{{- if and (eq $dbToDropType "oslo") $local.configMapBinFirst }} +{{- $_ := set $local "configMapBinFirst" false }} + - name: etc-service + emptyDir: {} + - name: db-drop-conf + configMap: + name: {{ $configMapEtc | quote }} + defaultMode: 0444 +{{- end -}} +{{- end -}} +{{- end -}} diff --git a/horizon/templates/job-db-drop.yaml b/horizon/templates/job-db-drop.yaml index 304ce33e9a..bf5048bf24 100644 --- a/horizon/templates/job-db-drop.yaml +++ b/horizon/templates/job-db-drop.yaml @@ -15,65 +15,7 @@ limitations under the License. */}} {{- if .Values.manifests.job_db_drop }} - -{{- $envAll := . }} -{{- $dependencies := .Values.dependencies.static.db_drop }} - -{{- $mounts_horizon_db_init := .Values.pod.mounts.horizon_db_init.horizon_db_init }} -{{- $mounts_horizon_db_init_init := .Values.pod.mounts.horizon_db_init.init_container }} - -{{- $randStringSuffix := randAlphaNum 5 | lower }} - -{{- $serviceAccountName := print "horizon-db-drop-" $randStringSuffix }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ print "horizon-db-drop-" $randStringSuffix }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - labels: -{{ tuple $envAll "horizon" "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: - {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} - initContainers: -{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: horizon-db-drop - image: {{ .Values.images.tags.db_drop }} - imagePullPolicy: {{ .Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.admin }} - key: DB_CONNECTION - - name: DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.horizon }} - key: DB_CONNECTION - command: - - /tmp/db-drop.py - volumeMounts: - - name: horizon-bin - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true -{{ if $mounts_horizon_db_init.volumeMounts }}{{ toYaml $mounts_horizon_db_init.volumeMounts | indent 10 }}{{ end }} - volumes: - - name: horizon-bin - configMap: - name: horizon-bin - defaultMode: 0555 -{{ if $mounts_horizon_db_init.volumes }}{{ toYaml $mounts_horizon_db_init.volumes | indent 6 }}{{ end }} +{{- $dbToDrop := dict "inputType" "secret" "adminSecret" .Values.secrets.oslo_db.admin "userSecret" .Values.secrets.oslo_db.horizon -}} +{{- $dbDropJob := dict "envAll" . "serviceName" "horizon" "dbToDrop" $dbToDrop -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/ironic/templates/job-db-drop.yaml b/ironic/templates/job-db-drop.yaml new file mode 100644 index 0000000000..ced2e56e82 --- /dev/null +++ b/ironic/templates/job-db-drop.yaml @@ -0,0 +1,20 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +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. +*/}} + +{{- if .Values.manifests.job_db_drop }} +{{- $dbDropJob := dict "envAll" . "serviceName" "ironic" -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} +{{- end }} diff --git a/ironic/values.yaml b/ironic/values.yaml index e0f35d108f..b21e4b9248 100644 --- a/ironic/values.yaml +++ b/ironic/values.yaml @@ -498,6 +498,7 @@ manifests: deployment_api: true ingress_api: true job_bootstrap: true + job_db_drop: false job_db_init: true job_db_sync: true job_ks_endpoints: true diff --git a/keystone/templates/job-db-drop.yaml b/keystone/templates/job-db-drop.yaml index a9039af124..d692c89fd6 100644 --- a/keystone/templates/job-db-drop.yaml +++ b/keystone/templates/job-db-drop.yaml @@ -15,77 +15,6 @@ limitations under the License. */}} {{- if .Values.manifests.job_db_drop }} -{{- $envAll := . }} -{{- $dependencies := .Values.dependencies.static.db_drop }} - -{{- $mounts_keystone_db_init := .Values.pod.mounts.keystone_db_init.keystone_db_init }} -{{- $mounts_keystone_db_init_init := .Values.pod.mounts.keystone_db_init.init_container }} - -{{- $randStringSuffix := randAlphaNum 5 | lower }} - -{{- $serviceAccountName := print "keystone-db-drop-" $randStringSuffix }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ print "keystone-db-drop-" $randStringSuffix }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - labels: -{{ tuple $envAll "keystone" "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: - {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} - initContainers: -{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: keystone-db-drop - image: {{ .Values.images.tags.db_drop }} - imagePullPolicy: {{ .Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.admin }} - key: DB_CONNECTION - - name: OPENSTACK_CONFIG_FILE - value: /etc/keystone/keystone.conf - - name: OPENSTACK_CONFIG_DB_SECTION - value: database - - name: OPENSTACK_CONFIG_DB_KEY - value: connection - command: - - /tmp/db-drop.py - volumeMounts: - - name: etckeystone - mountPath: /etc/keystone - - name: keystone-etc - mountPath: /etc/keystone/keystone.conf - subPath: keystone.conf - readOnly: true - - name: keystone-bin - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true -{{ if $mounts_keystone_db_init.volumeMounts }}{{ toYaml $mounts_keystone_db_init.volumeMounts | indent 10 }}{{ end }} - volumes: - - name: etckeystone - emptyDir: {} - - name: keystone-etc - configMap: - name: keystone-etc - defaultMode: 0444 - - name: keystone-bin - configMap: - name: keystone-bin - defaultMode: 0555 -{{ if $mounts_keystone_db_init.volumes }}{{ toYaml $mounts_keystone_db_init.volumes | indent 6 }}{{ end }} +{{- $dbDropJob := dict "envAll" . "serviceName" "keystone" -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/magnum/templates/job-db-drop.yaml b/magnum/templates/job-db-drop.yaml index f7615b5f5f..38dbc3e617 100644 --- a/magnum/templates/job-db-drop.yaml +++ b/magnum/templates/job-db-drop.yaml @@ -15,72 +15,6 @@ limitations under the License. */}} {{- if .Values.manifests.job_db_drop }} -{{- $envAll := . }} -{{- $dependencies := .Values.dependencies.static.db_drop }} - -{{- $randStringSuffix := randAlphaNum 5 | lower }} - -{{- $serviceAccountName := print "magnum-db-drop-" $randStringSuffix }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ print "magnum-db-drop-" $randStringSuffix }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - labels: -{{ tuple $envAll "magnum" "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: - {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} - initContainers: -{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: magnum-db-drop - image: {{ .Values.images.tags.db_drop }} - imagePullPolicy: {{ .Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.admin }} - key: DB_CONNECTION - - name: OPENSTACK_CONFIG_FILE - value: /etc/magnum/magnum.conf - - name: OPENSTACK_CONFIG_DB_SECTION - value: database - - name: OPENSTACK_CONFIG_DB_KEY - value: connection - command: - - /tmp/db-drop.py - volumeMounts: - - name: magnum-bin - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true - - name: etcmagnum - mountPath: /etc/magnum - - name: magnum-etc - mountPath: /etc/magnum/magnum.conf - subPath: magnum.conf - readOnly: true - volumes: - - name: etcmagnum - emptyDir: {} - - name: magnum-etc - configMap: - name: magnum-etc - defaultMode: 0444 - - name: magnum-bin - configMap: - name: magnum-bin - defaultMode: 0555 +{{- $dbDropJob := dict "envAll" . "serviceName" "magnum" -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/mistral/templates/job-db-drop.yaml b/mistral/templates/job-db-drop.yaml index 8783791a69..5ebf48a7fe 100644 --- a/mistral/templates/job-db-drop.yaml +++ b/mistral/templates/job-db-drop.yaml @@ -15,72 +15,6 @@ limitations under the License. */}} {{- if .Values.manifests.job_db_drop }} -{{- $envAll := . }} -{{- $dependencies := .Values.dependencies.static.db_drop }} - -{{- $randStringSuffix := randAlphaNum 5 | lower }} - -{{- $serviceAccountName := print "mistral-db-drop-" $randStringSuffix }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ print "mistral-db-drop-" $randStringSuffix }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - labels: -{{ tuple $envAll "mistral" "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: - {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} - initContainers: -{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: mistral-db-drop - image: {{ .Values.images.tags.db_drop }} - imagePullPolicy: {{ .Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.admin }} - key: DB_CONNECTION - - name: OPENSTACK_CONFIG_FILE - value: /etc/mistral/mistral.conf - - name: OPENSTACK_CONFIG_DB_SECTION - value: database - - name: OPENSTACK_CONFIG_DB_KEY - value: connection - command: - - /tmp/db-drop.py - volumeMounts: - - name: mistral-bin - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true - - name: pod-etc-mistral - mountPath: /etc/mistral - - name: mistral-etc - mountPath: /etc/mistral/mistral.conf - subPath: mistral.conf - readOnly: true - volumes: - - name: mistral-bin - configMap: - name: mistral-bin - defaultMode: 0555 - - name: pod-etc-mistral - emptyDir: {} - - name: mistral-etc - configMap: - name: mistral-etc - defaultMode: 0444 +{{- $dbDropJob := dict "envAll" . "serviceName" "mistral" -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/neutron/templates/job-db-drop.yaml b/neutron/templates/job-db-drop.yaml index 8492c849bf..74fc91e48e 100644 --- a/neutron/templates/job-db-drop.yaml +++ b/neutron/templates/job-db-drop.yaml @@ -16,72 +16,6 @@ limitations under the License. */}} {{- if .Values.manifests.job_db_drop }} -{{- $envAll := . }} -{{- $dependencies := .Values.dependencies.static.db_drop }} - -{{- $randStringSuffix := randAlphaNum 5 | lower }} - -{{- $serviceAccountName := print "neutron-db-drop-" $randStringSuffix }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ print "neutron-db-drop-" $randStringSuffix }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - labels: -{{ tuple $envAll "neutron" "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: - {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} - initContainers: -{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: neutron-db-drop - image: {{ .Values.images.tags.db_drop }} - imagePullPolicy: {{ .Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.admin }} - key: DB_CONNECTION - - name: OPENSTACK_CONFIG_FILE - value: /etc/neutron/neutron.conf - - name: OPENSTACK_CONFIG_DB_SECTION - value: database - - name: OPENSTACK_CONFIG_DB_KEY - value: connection - command: - - /tmp/db-drop.py - volumeMounts: - - name: neutron-bin - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true - - name: etcneutron - mountPath: /etc/neutron - - name: neutron-etc - mountPath: /etc/neutron/neutron.conf - subPath: neutron.conf - readOnly: true - volumes: - - name: etcneutron - emptyDir: {} - - name: neutron-etc - configMap: - name: neutron-etc - defaultMode: 0444 - - name: neutron-bin - configMap: - name: neutron-bin - defaultMode: 0555 +{{- $dbDropJob := dict "envAll" . "serviceName" "neutron" -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/nova/templates/job-db-drop.yaml b/nova/templates/job-db-drop.yaml index b7be5c2d59..48df2d40fd 100644 --- a/nova/templates/job-db-drop.yaml +++ b/nova/templates/job-db-drop.yaml @@ -15,101 +15,11 @@ limitations under the License. */}} {{- if .Values.manifests.job_db_drop }} -{{- $envAll := . }} -{{- $dependencies := .Values.dependencies.static.db_drop }} - -{{- $randStringSuffix := randAlphaNum 5 | lower }} - -{{- $serviceAccountName := print "nova-db-drop-" $randStringSuffix }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ print "nova-db-drop-" $randStringSuffix }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - labels: -{{ tuple $envAll "nova" "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: - {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} - initContainers: -{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: nova-db-drop - image: {{ .Values.images.tags.db_drop }} - imagePullPolicy: {{ .Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.admin }} - key: DB_CONNECTION - - name: OPENSTACK_CONFIG_FILE - value: /etc/nova/nova.conf - - name: OPENSTACK_CONFIG_DB_SECTION - value: database - - name: OPENSTACK_CONFIG_DB_KEY - value: connection - command: - - /tmp/db-drop.py - volumeMounts: - - name: nova-bin - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true - - name: etcnova - mountPath: /etc/nova - - name: nova-etc - mountPath: /etc/nova/nova.conf - subPath: nova.conf - readOnly: true - - name: nova-db-drop-api - image: {{ .Values.images.tags.db_drop }} - imagePullPolicy: {{ .Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.admin }} - key: DB_CONNECTION - - name: OPENSTACK_CONFIG_FILE - value: /etc/nova/nova.conf - - name: OPENSTACK_CONFIG_DB_SECTION - value: api_database - - name: OPENSTACK_CONFIG_DB_KEY - value: connection - command: - - /tmp/db-drop.py - volumeMounts: - - name: nova-bin - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true - - name: etcnova - mountPath: /etc/nova - - name: nova-etc - mountPath: /etc/nova/nova.conf - subPath: nova.conf - readOnly: true - volumes: - - name: etcnova - emptyDir: {} - - name: nova-etc - configMap: - name: nova-etc - defaultMode: 0444 - - name: nova-bin - configMap: - name: nova-bin - defaultMode: 0555 +{{- $serviceName := "nova" -}} +{{- $dbSvc := dict "adminSecret" .Values.secrets.oslo_db.admin "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "configDbSection" "database" "configDbKey" "connection" -}} +{{- $dbApi := dict "adminSecret" .Values.secrets.oslo_db.admin "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "configDbSection" "api_database" "configDbKey" "connection" -}} +{{- $dbCell := dict "adminSecret" .Values.secrets.oslo_db.admin "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "configDbSection" "cell0_database" "configDbKey" "connection" -}} +{{- $dbsToDrop := list $dbSvc $dbApi $dbCell }} +{{- $dbDropJob := dict "envAll" . "serviceName" $serviceName "dbsToDrop" $dbsToDrop -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }} diff --git a/senlin/templates/job-db-drop.yaml b/senlin/templates/job-db-drop.yaml index fc5000e57b..1b20bf43be 100644 --- a/senlin/templates/job-db-drop.yaml +++ b/senlin/templates/job-db-drop.yaml @@ -15,72 +15,6 @@ limitations under the License. */}} {{- if .Values.manifests.job_db_drop }} -{{- $envAll := . }} -{{- $dependencies := .Values.dependencies.static.db_drop }} - -{{- $randStringSuffix := randAlphaNum 5 | lower }} - -{{- $serviceAccountName := print "senlin-db-drop-" $randStringSuffix }} -{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ print "senlin-db-drop-" $randStringSuffix }} - annotations: - "helm.sh/hook": pre-delete - "helm.sh/hook-delete-policy": hook-succeeded -spec: - template: - metadata: - labels: -{{ tuple $envAll "senlin" "db-drop" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} - spec: - serviceAccountName: {{ $serviceAccountName }} - restartPolicy: OnFailure - nodeSelector: - {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} - initContainers: -{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - containers: - - name: senlin-db-drop - image: {{ .Values.images.tags.db_drop }} - imagePullPolicy: {{ .Values.images.pull_policy }} -{{ tuple $envAll $envAll.Values.pod.resources.jobs.db_drop | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - env: - - name: ROOT_DB_CONNECTION - valueFrom: - secretKeyRef: - name: {{ .Values.secrets.oslo_db.admin }} - key: DB_CONNECTION - - name: OPENSTACK_CONFIG_FILE - value: /etc/senlin/senlin.conf - - name: OPENSTACK_CONFIG_DB_SECTION - value: database - - name: OPENSTACK_CONFIG_DB_KEY - value: connection - command: - - /tmp/db-drop.py - volumeMounts: - - name: senlin-bin - mountPath: /tmp/db-drop.py - subPath: db-drop.py - readOnly: true - - name: etcsenlin - mountPath: /etc/senlin - - name: senlin-etc - mountPath: /etc/senlin/senlin.conf - subPath: senlin.conf - readOnly: true - volumes: - - name: etcsenlin - emptyDir: {} - - name: senlin-etc - configMap: - name: senlin-etc - defaultMode: 0444 - - name: senlin-bin - configMap: - name: senlin-bin - defaultMode: 0555 +{{- $dbDropJob := dict "envAll" . "serviceName" "senlin" -}} +{{ $dbDropJob | include "helm-toolkit.manifests.job_db_drop_mysql" }} {{- end }}