Enhance HTK Job Manifests to be more flexible

This patch enhances the HTK job manifest functions so that each job can
be configured to use the desired backoffLimit and activeDeadlineSeconds,
and can mount the command/script from either a configMap or a secret
instead of being confined to using only configMaps.

Change-Id: I5231e53b98e3e55e3e93070876d8694f37ad642d
This commit is contained in:
Cliff Parsons 2019-07-25 09:04:21 -05:00
parent 85b8d62830
commit e059f4f827
11 changed files with 161 additions and 6 deletions

View File

@ -31,7 +31,9 @@ limitations under the License.
{{- $logConfigFile := index . "logConfigFile" | default (printf "/etc/%s/logging.conf" $serviceName ) -}} {{- $logConfigFile := index . "logConfigFile" | default (printf "/etc/%s/logging.conf" $serviceName ) -}}
{{- $keystoneUser := index . "keystoneUser" | default $serviceName -}} {{- $keystoneUser := index . "keystoneUser" | default $serviceName -}}
{{- $openrc := index . "openrc" | default "true" -}} {{- $openrc := index . "openrc" | default "true" -}}
{{- $secretBin := index . "secretBin" -}}
{{- $backoffLimit := index . "backoffLimit" | default "6" -}}
{{- $activeDeadlineSeconds := index . "activeDeadlineSeconds" -}}
{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} {{- $serviceNamePretty := $serviceName | replace "_" "-" -}}
{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "bootstrap" }} {{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "bootstrap" }}
@ -42,6 +44,10 @@ kind: Job
metadata: metadata:
name: {{ printf "%s-%s" $serviceNamePretty "bootstrap" | quote }} name: {{ printf "%s-%s" $serviceNamePretty "bootstrap" | quote }}
spec: spec:
backoffLimit: {{ $backoffLimit }}
{{- if $activeDeadlineSeconds }}
activeDeadlineSeconds: {{ $activeDeadlineSeconds }}
{{- end }}
template: template:
metadata: metadata:
labels: labels:
@ -65,6 +71,8 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
command: command:
- /bin/bash
- -c
- /tmp/bootstrap.sh - /tmp/bootstrap.sh
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
@ -90,9 +98,15 @@ spec:
- name: pod-tmp - name: pod-tmp
emptyDir: {} emptyDir: {}
- name: bootstrap-sh - name: bootstrap-sh
{{- if $secretBin }}
secret:
secretName: {{ $secretBin | quote }}
defaultMode: 0555
{{- else }}
configMap: configMap:
name: {{ $configMapBin | quote }} name: {{ $configMapBin | quote }}
defaultMode: 0555 defaultMode: 0555
{{- end }}
- name: etc-service - name: etc-service
emptyDir: {} emptyDir: {}
- name: bootstrap-conf - name: bootstrap-conf

View File

@ -32,7 +32,9 @@ limitations under the License.
{{- $configMapEtc := index . "configMapEtc" | default (printf "%s-%s" $serviceName "etc" ) -}} {{- $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 ) "logConfigFile" (printf "/etc/%s/logging.conf" $serviceName ) "configDbSection" "database" "configDbKey" "connection" ) -}} {{- $dbToDrop := index . "dbToDrop" | default ( dict "adminSecret" $envAll.Values.secrets.oslo_db.admin "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "logConfigFile" (printf "/etc/%s/logging.conf" $serviceName ) "configDbSection" "database" "configDbKey" "connection" ) -}}
{{- $dbsToDrop := default (list $dbToDrop) (index . "dbsToDrop") }} {{- $dbsToDrop := default (list $dbToDrop) (index . "dbsToDrop") }}
{{- $secretBin := index . "secretBin" -}}
{{- $backoffLimit := index . "backoffLimit" | default "6" -}}
{{- $activeDeadlineSeconds := index . "activeDeadlineSeconds" -}}
{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} {{- $serviceNamePretty := $serviceName | replace "_" "-" -}}
{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "db-drop" }} {{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "db-drop" }}
@ -46,6 +48,10 @@ metadata:
"helm.sh/hook": pre-delete "helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded "helm.sh/hook-delete-policy": hook-succeeded
spec: spec:
backoffLimit: {{ $backoffLimit }}
{{- if $activeDeadlineSeconds }}
activeDeadlineSeconds: {{ $activeDeadlineSeconds }}
{{- end }}
template: template:
metadata: metadata:
labels: labels:
@ -111,9 +117,15 @@ spec:
- name: pod-tmp - name: pod-tmp
emptyDir: {} emptyDir: {}
- name: db-drop-sh - name: db-drop-sh
{{- if $secretBin }}
secret:
secretName: {{ $secretBin | quote }}
defaultMode: 0555
{{- else }}
configMap: configMap:
name: {{ $configMapBin | quote }} name: {{ $configMapBin | quote }}
defaultMode: 0555 defaultMode: 0555
{{- end }}
{{- $local := dict "configMapBinFirst" true -}} {{- $local := dict "configMapBinFirst" true -}}
{{- range $key1, $dbToDrop := $dbsToDrop }} {{- range $key1, $dbToDrop := $dbsToDrop }}
{{- $dbToDropType := default "oslo" $dbToDrop.inputType }} {{- $dbToDropType := default "oslo" $dbToDrop.inputType }}

View File

@ -32,7 +32,9 @@ limitations under the License.
{{- $configMapEtc := index . "configMapEtc" | default (printf "%s-%s" $serviceName "etc" ) -}} {{- $configMapEtc := index . "configMapEtc" | default (printf "%s-%s" $serviceName "etc" ) -}}
{{- $dbToInit := index . "dbToInit" | default ( dict "adminSecret" $envAll.Values.secrets.oslo_db.admin "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "logConfigFile" (printf "/etc/%s/logging.conf" $serviceName ) "configDbSection" "database" "configDbKey" "connection" ) -}} {{- $dbToInit := index . "dbToInit" | default ( dict "adminSecret" $envAll.Values.secrets.oslo_db.admin "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "logConfigFile" (printf "/etc/%s/logging.conf" $serviceName ) "configDbSection" "database" "configDbKey" "connection" ) -}}
{{- $dbsToInit := default (list $dbToInit) (index . "dbsToInit") }} {{- $dbsToInit := default (list $dbToInit) (index . "dbsToInit") }}
{{- $secretBin := index . "secretBin" -}}
{{- $backoffLimit := index . "backoffLimit" | default "6" -}}
{{- $activeDeadlineSeconds := index . "activeDeadlineSeconds" -}}
{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} {{- $serviceNamePretty := $serviceName | replace "_" "-" -}}
{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "db-init" }} {{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "db-init" }}
@ -43,6 +45,10 @@ kind: Job
metadata: metadata:
name: {{ printf "%s-%s" $serviceNamePretty "db-init" | quote }} name: {{ printf "%s-%s" $serviceNamePretty "db-init" | quote }}
spec: spec:
backoffLimit: {{ $backoffLimit }}
{{- if $activeDeadlineSeconds }}
activeDeadlineSeconds: {{ $activeDeadlineSeconds }}
{{- end }}
template: template:
metadata: metadata:
labels: labels:
@ -108,9 +114,15 @@ spec:
- name: pod-tmp - name: pod-tmp
emptyDir: {} emptyDir: {}
- name: db-init-sh - name: db-init-sh
{{- if $secretBin }}
secret:
secretName: {{ $secretBin | quote }}
defaultMode: 0555
{{- else }}
configMap: configMap:
name: {{ $configMapBin | quote }} name: {{ $configMapBin | quote }}
defaultMode: 0555 defaultMode: 0555
{{- end }}
{{- $local := dict "configMapBinFirst" true -}} {{- $local := dict "configMapBinFirst" true -}}
{{- range $key1, $dbToInit := $dbsToInit }} {{- range $key1, $dbToInit := $dbsToInit }}
{{- $dbToInitType := default "oslo" $dbToInit.inputType }} {{- $dbToInitType := default "oslo" $dbToInit.inputType }}

View File

@ -29,7 +29,9 @@ limitations under the License.
{{- $podVols := index . "podVols" | default false -}} {{- $podVols := index . "podVols" | default false -}}
{{- $podEnvVars := index . "podEnvVars" | default false -}} {{- $podEnvVars := index . "podEnvVars" | default false -}}
{{- $dbToSync := index . "dbToSync" | default ( dict "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "logConfigFile" (printf "/etc/%s/logging.conf" $serviceName ) "image" ( index $envAll.Values.images.tags ( printf "%s_db_sync" $serviceName )) ) -}} {{- $dbToSync := index . "dbToSync" | default ( dict "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "logConfigFile" (printf "/etc/%s/logging.conf" $serviceName ) "image" ( index $envAll.Values.images.tags ( printf "%s_db_sync" $serviceName )) ) -}}
{{- $secretBin := index . "secretBin" -}}
{{- $backoffLimit := index . "backoffLimit" | default "6" -}}
{{- $activeDeadlineSeconds := index . "activeDeadlineSeconds" -}}
{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} {{- $serviceNamePretty := $serviceName | replace "_" "-" -}}
{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "db-sync" }} {{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "db-sync" }}
@ -40,6 +42,10 @@ kind: Job
metadata: metadata:
name: {{ printf "%s-%s" $serviceNamePretty "db-sync" | quote }} name: {{ printf "%s-%s" $serviceNamePretty "db-sync" | quote }}
spec: spec:
backoffLimit: {{ $backoffLimit }}
{{- if $activeDeadlineSeconds }}
activeDeadlineSeconds: {{ $activeDeadlineSeconds }}
{{- end }}
template: template:
metadata: metadata:
labels: labels:
@ -61,6 +67,8 @@ spec:
{{ $podEnvVars | toYaml | indent 12 }} {{ $podEnvVars | toYaml | indent 12 }}
{{- end }} {{- end }}
command: command:
- /bin/bash
- -c
- /tmp/db-sync.sh - /tmp/db-sync.sh
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
@ -86,9 +94,15 @@ spec:
- name: pod-tmp - name: pod-tmp
emptyDir: {} emptyDir: {}
- name: db-sync-sh - name: db-sync-sh
{{- if $secretBin }}
secret:
secretName: {{ $secretBin | quote }}
defaultMode: 0555
{{- else }}
configMap: configMap:
name: {{ $configMapBin | quote }} name: {{ $configMapBin | quote }}
defaultMode: 0555 defaultMode: 0555
{{- end }}
- name: etc-service - name: etc-service
emptyDir: {} emptyDir: {}
- name: db-sync-conf - name: db-sync-conf

View File

@ -25,6 +25,9 @@ limitations under the License.
{{- $serviceTypes := index . "serviceTypes" -}} {{- $serviceTypes := index . "serviceTypes" -}}
{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}}
{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}}
{{- $secretBin := index . "secretBin" -}}
{{- $backoffLimit := index . "backoffLimit" | default "6" -}}
{{- $activeDeadlineSeconds := index . "activeDeadlineSeconds" -}}
{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} {{- $serviceNamePretty := $serviceName | replace "_" "-" -}}
{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "ks-endpoints" }} {{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "ks-endpoints" }}
@ -35,6 +38,10 @@ kind: Job
metadata: metadata:
name: {{ printf "%s-%s" $serviceNamePretty "ks-endpoints" | quote }} name: {{ printf "%s-%s" $serviceNamePretty "ks-endpoints" | quote }}
spec: spec:
backoffLimit: {{ $backoffLimit }}
{{- if $activeDeadlineSeconds }}
activeDeadlineSeconds: {{ $activeDeadlineSeconds }}
{{- end }}
template: template:
metadata: metadata:
labels: labels:
@ -54,6 +61,8 @@ spec:
imagePullPolicy: {{ $envAll.Values.images.pull_policy }} imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_endpoints | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_endpoints | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command: command:
- /bin/bash
- -c
- /tmp/ks-endpoints.sh - /tmp/ks-endpoints.sh
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
@ -80,7 +89,13 @@ spec:
- name: pod-tmp - name: pod-tmp
emptyDir: {} emptyDir: {}
- name: ks-endpoints-sh - name: ks-endpoints-sh
{{- if $secretBin }}
secret:
secretName: {{ $secretBin | quote }}
defaultMode: 0555
{{- else }}
configMap: configMap:
name: {{ $configMapBin | quote }} name: {{ $configMapBin | quote }}
defaultMode: 0555 defaultMode: 0555
{{- end }} {{- end }}
{{- end }}

View File

@ -25,6 +25,9 @@ limitations under the License.
{{- $serviceTypes := index . "serviceTypes" -}} {{- $serviceTypes := index . "serviceTypes" -}}
{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}}
{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}}
{{- $secretBin := index . "secretBin" -}}
{{- $backoffLimit := index . "backoffLimit" | default "6" -}}
{{- $activeDeadlineSeconds := index . "activeDeadlineSeconds" -}}
{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} {{- $serviceNamePretty := $serviceName | replace "_" "-" -}}
{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "ks-service" }} {{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "ks-service" }}
@ -35,6 +38,10 @@ kind: Job
metadata: metadata:
name: {{ printf "%s-%s" $serviceNamePretty "ks-service" | quote }} name: {{ printf "%s-%s" $serviceNamePretty "ks-service" | quote }}
spec: spec:
backoffLimit: {{ $backoffLimit }}
{{- if $activeDeadlineSeconds }}
activeDeadlineSeconds: {{ $activeDeadlineSeconds }}
{{- end }}
template: template:
metadata: metadata:
labels: labels:
@ -53,6 +60,8 @@ spec:
imagePullPolicy: {{ $envAll.Values.images.pull_policy }} imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_service | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_service | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command: command:
- /bin/bash
- -c
- /tmp/ks-service.sh - /tmp/ks-service.sh
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
@ -74,7 +83,13 @@ spec:
- name: pod-tmp - name: pod-tmp
emptyDir: {} emptyDir: {}
- name: ks-service-sh - name: ks-service-sh
{{- if $secretBin }}
secret:
secretName: {{ $secretBin | quote }}
defaultMode: 0555
{{- else }}
configMap: configMap:
name: {{ $configMapBin | quote }} name: {{ $configMapBin | quote }}
defaultMode: 0555 defaultMode: 0555
{{- end }} {{- end }}
{{- end }}

View File

@ -25,6 +25,9 @@ limitations under the License.
{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}}
{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}}
{{- $serviceUser := index . "serviceUser" | default $serviceName -}} {{- $serviceUser := index . "serviceUser" | default $serviceName -}}
{{- $secretBin := index . "secretBin" -}}
{{- $backoffLimit := index . "backoffLimit" | default "6" -}}
{{- $activeDeadlineSeconds := index . "activeDeadlineSeconds" -}}
{{- $serviceUserPretty := $serviceUser | replace "_" "-" -}} {{- $serviceUserPretty := $serviceUser | replace "_" "-" -}}
{{- $serviceAccountName := printf "%s-%s" $serviceUserPretty "ks-user" }} {{- $serviceAccountName := printf "%s-%s" $serviceUserPretty "ks-user" }}
@ -35,6 +38,10 @@ kind: Job
metadata: metadata:
name: {{ printf "%s-%s" $serviceUserPretty "ks-user" | quote }} name: {{ printf "%s-%s" $serviceUserPretty "ks-user" | quote }}
spec: spec:
backoffLimit: {{ $backoffLimit }}
{{- if $activeDeadlineSeconds }}
activeDeadlineSeconds: {{ $activeDeadlineSeconds }}
{{- end }}
template: template:
metadata: metadata:
labels: labels:
@ -52,6 +59,8 @@ spec:
imagePullPolicy: {{ $envAll.Values.images.pull_policy }} imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command: command:
- /bin/bash
- -c
- /tmp/ks-user.sh - /tmp/ks-user.sh
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
@ -80,7 +89,13 @@ spec:
- name: pod-tmp - name: pod-tmp
emptyDir: {} emptyDir: {}
- name: ks-user-sh - name: ks-user-sh
{{- if $secretBin }}
secret:
secretName: {{ $secretBin | quote }}
defaultMode: 0555
{{- else }}
configMap: configMap:
name: {{ $configMapBin | quote }} name: {{ $configMapBin | quote }}
defaultMode: 0555 defaultMode: 0555
{{- end }}
{{- end -}} {{- end -}}

View File

@ -20,6 +20,9 @@ limitations under the License.
{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}}
{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}}
{{- $serviceUser := index . "serviceUser" | default $serviceName -}} {{- $serviceUser := index . "serviceUser" | default $serviceName -}}
{{- $secretBin := index . "secretBin" -}}
{{- $backoffLimit := index . "backoffLimit" | default "6" -}}
{{- $activeDeadlineSeconds := index . "activeDeadlineSeconds" -}}
{{- $serviceUserPretty := $serviceUser | replace "_" "-" -}} {{- $serviceUserPretty := $serviceUser | replace "_" "-" -}}
{{- $serviceAccountName := printf "%s-%s" $serviceUserPretty "rabbit-init" }} {{- $serviceAccountName := printf "%s-%s" $serviceUserPretty "rabbit-init" }}
@ -30,6 +33,10 @@ kind: Job
metadata: metadata:
name: {{ printf "%s-%s" $serviceUserPretty "rabbit-init" | quote }} name: {{ printf "%s-%s" $serviceUserPretty "rabbit-init" | quote }}
spec: spec:
backoffLimit: {{ $backoffLimit }}
{{- if $activeDeadlineSeconds }}
activeDeadlineSeconds: {{ $activeDeadlineSeconds }}
{{- end }}
template: template:
metadata: metadata:
labels: labels:
@ -47,6 +54,8 @@ spec:
imagePullPolicy: {{ $envAll.Values.images.pull_policy | quote }} imagePullPolicy: {{ $envAll.Values.images.pull_policy | quote }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.rabbit_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.rabbit_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command: command:
- /bin/bash
- -c
- /tmp/rabbit-init.sh - /tmp/rabbit-init.sh
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
@ -74,8 +83,13 @@ spec:
- name: pod-tmp - name: pod-tmp
emptyDir: {} emptyDir: {}
- name: rabbit-init-sh - name: rabbit-init-sh
{{- if $secretBin }}
secret:
secretName: {{ $secretBin | quote }}
defaultMode: 0555
{{- else }}
configMap: configMap:
name: {{ $configMapBin | quote }} name: {{ $configMapBin | quote }}
defaultMode: 0555 defaultMode: 0555
{{- end }}
{{- end -}} {{- end -}}

View File

@ -25,6 +25,9 @@ limitations under the License.
{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}}
{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}}
{{- $configMapCeph := index . "configMapCeph" | default (printf "ceph-etc" ) -}} {{- $configMapCeph := index . "configMapCeph" | default (printf "ceph-etc" ) -}}
{{- $secretBin := index . "secretBin" -}}
{{- $backoffLimit := index . "backoffLimit" | default "6" -}}
{{- $activeDeadlineSeconds := index . "activeDeadlineSeconds" -}}
{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} {{- $serviceNamePretty := $serviceName | replace "_" "-" -}}
{{- $s3UserSecret := index $envAll.Values.secrets.rgw $serviceName -}} {{- $s3UserSecret := index $envAll.Values.secrets.rgw $serviceName -}}
{{- $s3Bucket := index . "s3Bucket" | default $serviceName }} {{- $s3Bucket := index . "s3Bucket" | default $serviceName }}
@ -39,6 +42,10 @@ metadata:
annotations: annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
spec: spec:
backoffLimit: {{ $backoffLimit }}
{{- if $activeDeadlineSeconds }}
activeDeadlineSeconds: {{ $activeDeadlineSeconds }}
{{- end }}
template: template:
metadata: metadata:
labels: labels:
@ -56,6 +63,8 @@ spec:
imagePullPolicy: {{ $envAll.Values.images.pull_policy }} imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.s3_bucket | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.s3_bucket | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command: command:
- /bin/bash
- -c
- /tmp/create-s3-bucket.sh - /tmp/create-s3-bucket.sh
env: env:
{{- with $env := dict "s3AdminSecret" $envAll.Values.secrets.rgw.admin }} {{- with $env := dict "s3AdminSecret" $envAll.Values.secrets.rgw.admin }}
@ -93,9 +102,15 @@ spec:
- name: pod-tmp - name: pod-tmp
emptyDir: {} emptyDir: {}
- name: s3-bucket-sh - name: s3-bucket-sh
{{- if $secretBin }}
secret:
secretName: {{ $secretBin | quote }}
defaultMode: 0555
{{- else }}
configMap: configMap:
name: {{ $configMapBin | quote }} name: {{ $configMapBin | quote }}
defaultMode: 0555 defaultMode: 0555
{{- end }}
- name: etcceph - name: etcceph
emptyDir: {} emptyDir: {}
- name: ceph-etc - name: ceph-etc

View File

@ -25,6 +25,9 @@ limitations under the License.
{{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}}
{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}}
{{- $configMapCeph := index . "configMapCeph" | default (printf "ceph-etc" ) -}} {{- $configMapCeph := index . "configMapCeph" | default (printf "ceph-etc" ) -}}
{{- $secretBin := index . "secretBin" -}}
{{- $backoffLimit := index . "backoffLimit" | default "6" -}}
{{- $activeDeadlineSeconds := index . "activeDeadlineSeconds" -}}
{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} {{- $serviceNamePretty := $serviceName | replace "_" "-" -}}
{{- $s3UserSecret := index $envAll.Values.secrets.rgw $serviceName -}} {{- $s3UserSecret := index $envAll.Values.secrets.rgw $serviceName -}}
@ -38,6 +41,10 @@ metadata:
annotations: annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
spec: spec:
backoffLimit: {{ $backoffLimit }}
{{- if $activeDeadlineSeconds }}
activeDeadlineSeconds: {{ $activeDeadlineSeconds }}
{{- end }}
template: template:
metadata: metadata:
labels: labels:
@ -75,6 +82,8 @@ spec:
imagePullPolicy: {{ $envAll.Values.images.pull_policy }} imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.s3_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.s3_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command: command:
- /bin/bash
- -c
- /tmp/create-s3-user.sh - /tmp/create-s3-user.sh
env: env:
{{- with $env := dict "s3AdminSecret" $envAll.Values.secrets.rgw.admin }} {{- with $env := dict "s3AdminSecret" $envAll.Values.secrets.rgw.admin }}
@ -108,9 +117,15 @@ spec:
- name: pod-tmp - name: pod-tmp
emptyDir: {} emptyDir: {}
- name: create-s3-user-sh - name: create-s3-user-sh
{{- if $secretBin }}
secret:
secretName: {{ $secretBin | quote }}
defaultMode: 0555
{{- else }}
configMap: configMap:
name: {{ $configMapBin | quote }} name: {{ $configMapBin | quote }}
defaultMode: 0555 defaultMode: 0555
{{- end }}
- name: ceph-keyring-sh - name: ceph-keyring-sh
configMap: configMap:
name: {{ $configMapBin | quote }} name: {{ $configMapBin | quote }}

View File

@ -26,7 +26,9 @@ limitations under the License.
{{- $podVolMounts := index . "podVolMounts" | default false -}} {{- $podVolMounts := index . "podVolMounts" | default false -}}
{{- $podVols := index . "podVols" | default false -}} {{- $podVols := index . "podVols" | default false -}}
{{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}}
{{- $secretBin := index . "secretBin" -}}
{{- $backoffLimit := index . "backoffLimit" | default "6" -}}
{{- $activeDeadlineSeconds := index . "activeDeadlineSeconds" -}}
{{- $serviceNamePretty := $serviceName | replace "_" "-" -}} {{- $serviceNamePretty := $serviceName | replace "_" "-" -}}
{{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "image-repo-sync" }} {{- $serviceAccountName := printf "%s-%s" $serviceNamePretty "image-repo-sync" }}
@ -37,6 +39,10 @@ kind: Job
metadata: metadata:
name: {{ printf "%s-%s" $serviceNamePretty "image-repo-sync" | quote }} name: {{ printf "%s-%s" $serviceNamePretty "image-repo-sync" | quote }}
spec: spec:
backoffLimit: {{ $backoffLimit }}
{{- if $activeDeadlineSeconds }}
activeDeadlineSeconds: {{ $activeDeadlineSeconds }}
{{- end }}
template: template:
metadata: metadata:
labels: labels:
@ -58,6 +64,8 @@ spec:
- name: IMAGE_SYNC_LIST - name: IMAGE_SYNC_LIST
value: "{{ include "helm-toolkit.utils.image_sync_list" $envAll }}" value: "{{ include "helm-toolkit.utils.image_sync_list" $envAll }}"
command: command:
- /bin/bash
- -c
- /tmp/image-repo-sync.sh - /tmp/image-repo-sync.sh
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
@ -75,9 +83,15 @@ spec:
- name: pod-tmp - name: pod-tmp
emptyDir: {} emptyDir: {}
- name: bootstrap-sh - name: bootstrap-sh
{{- if $secretBin }}
secret:
secretName: {{ $secretBin | quote }}
defaultMode: 0555
{{- else }}
configMap: configMap:
name: {{ $configMapBin | quote }} name: {{ $configMapBin | quote }}
defaultMode: 0555 defaultMode: 0555
{{- end }}
- name: docker-socket - name: docker-socket
hostPath: hostPath:
path: /var/run/docker.sock path: /var/run/docker.sock