DB-Drop-Jobs: consolidate to helm-toolkit
This PS consolidates the DB-Drop Job to helm-toolkit. Change-Id: Ia2b035d730bf612086a9fd9b5d14aba494f56dc7
This commit is contained in:
parent
05d1123497
commit
6e4bcebcf5
@ -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 }}
|
||||
|
20
ceilometer/templates/job-db-drop.yaml
Normal file
20
ceilometer/templates/job-db-drop.yaml
Normal file
@ -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 }}
|
@ -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
|
||||
|
@ -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 }}
|
||||
|
20
congress/templates/job-db-drop.yaml
Normal file
20
congress/templates/job-db-drop.yaml
Normal file
@ -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 }}
|
@ -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
|
||||
|
@ -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 }}
|
||||
|
20
gnocchi/templates/job-db-drop.yaml
Normal file
20
gnocchi/templates/job-db-drop.yaml
Normal file
@ -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 }}
|
@ -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
|
||||
|
@ -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 }}
|
||||
|
123
helm-toolkit/templates/manifests/_job-db-drop-mysql.yaml.tpl
Normal file
123
helm-toolkit/templates/manifests/_job-db-drop-mysql.yaml.tpl
Normal file
@ -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 -}}
|
@ -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 }}
|
||||
|
20
ironic/templates/job-db-drop.yaml
Normal file
20
ironic/templates/job-db-drop.yaml
Normal file
@ -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 }}
|
@ -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
|
||||
|
@ -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 }}
|
||||
|
@ -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 }}
|
||||
|
@ -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 }}
|
||||
|
@ -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 }}
|
||||
|
@ -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 }}
|
||||
|
@ -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 }}
|
||||
|
Loading…
Reference in New Issue
Block a user