helm: Fix post job template (#16236)

This commit is contained in:
mruzicka 2022-12-18 17:01:22 +01:00 committed by GitHub
parent 3ae1f9d852
commit 6197ba851b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,7 @@ metadata:
"helm.sh/hook": post-install,post-upgrade "helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation "helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
{{- with .Values.postJob.annotations }} {{- with .Values.postJob.annotations }}
{ { toYaml . | indent 4 } } {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
template: template:
@ -21,26 +21,26 @@ spec:
app: {{ template "minio.name" . }}-job app: {{ template "minio.name" . }}-job
release: {{ .Release.Name }} release: {{ .Release.Name }}
{{- if .Values.podLabels }} {{- if .Values.podLabels }}
{ { toYaml .Values.podLabels | indent 8 } } {{- toYaml .Values.podLabels | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.postJob.podAnnotations }} {{- if .Values.postJob.podAnnotations }}
annotations: annotations:
{ { toYaml .Values.postJob.podAnnotations | indent 8 } } {{- toYaml .Values.postJob.podAnnotations | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
restartPolicy: OnFailure restartPolicy: OnFailure
{ { - include "minio.imagePullSecrets" . | indent 6 } } {{- include "minio.imagePullSecrets" . | nindent 6 }}
{{- if .Values.nodeSelector }} {{- if .Values.nodeSelector }}
nodeSelector: nodeSelector:
{ { toYaml .Values.postJob.nodeSelector | indent 8 } } {{- toYaml .Values.postJob.nodeSelector | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.postJob.affinity }} {{- with .Values.postJob.affinity }}
affinity: affinity:
{ { toYaml . | indent 8 } } {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.postJob.tolerations }} {{- with .Values.postJob.tolerations }}
tolerations: tolerations:
{ { toYaml . | indent 8 } } {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.postJob.securityContext.enabled }} {{- if .Values.postJob.securityContext.enabled }}
securityContext: securityContext:
@ -59,10 +59,10 @@ volumes:
{{- range .Values.users }} {{- range .Values.users }}
{{- if .existingSecret }} {{- if .existingSecret }}
- secret: - secret:
name: { { tpl .existingSecret $global } } name: {{ tpl .existingSecret $ }}
items: items:
- key: {{ .existingSecretKey }} - key: {{ .existingSecretKey }}
path: secrets/{{ tpl .existingSecretKey $global }} path: secrets/{{ tpl .existingSecretKey $ }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.tls.enabled }} {{- if .Values.tls.enabled }}
@ -75,7 +75,7 @@ volumes:
{{ end }} {{ end }}
containers: containers:
{{- if .Values.buckets }} {{- if .Values.buckets }}
- name: minio-makeBucket - name: minio-make-bucket
image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}" image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}"
{{- if .Values.makeBucketJob.securityContext.enabled }} {{- if .Values.makeBucketJob.securityContext.enabled }}
securityContext: securityContext:
@ -86,7 +86,7 @@ containers:
imagePullPolicy: {{ .Values.mcImage.pullPolicy }} imagePullPolicy: {{ .Values.mcImage.pullPolicy }}
{{- if .Values.makeBucketJob.exitCommand }} {{- if .Values.makeBucketJob.exitCommand }}
command: [ "/bin/sh", "-c" ] command: [ "/bin/sh", "-c" ]
args: [ "/bin/sh /config/initialize; x=$(echo $?); {{ .Values.makeBucketJob.exitCommand }} && exit $x" ] args: [ "/bin/sh /config/initialize; EV=$?; {{ .Values.makeBucketJob.exitCommand }} && exit $EV" ]
{{- else }} {{- else }}
command: [ "/bin/sh", "/config/initialize" ] command: [ "/bin/sh", "/config/initialize" ]
{{- end }} {{- end }}
@ -103,10 +103,10 @@ containers:
mountPath: {{ .Values.configPathmc }}certs mountPath: {{ .Values.configPathmc }}certs
{{ end }} {{ end }}
resources: resources:
{ { toYaml .Values.makeBucketJob.resources | indent 10 } } {{- toYaml .Values.makeBucketJob.resources | nindent 12 }}
{{- end }} {{- end }}
{{- if .Values.users }} {{- if .Values.users }}
- name: minio-makeUser - name: minio-make-user
image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}" image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}"
{{- if .Values.makeUserJob.securityContext.enabled }} {{- if .Values.makeUserJob.securityContext.enabled }}
securityContext: securityContext:
@ -117,7 +117,7 @@ containers:
imagePullPolicy: {{ .Values.mcImage.pullPolicy }} imagePullPolicy: {{ .Values.mcImage.pullPolicy }}
{{- if .Values.makeUserJob.exitCommand }} {{- if .Values.makeUserJob.exitCommand }}
command: [ "/bin/sh", "-c" ] command: [ "/bin/sh", "-c" ]
args: [ "/bin/sh /config/add-user; x=$(echo $?); {{ .Values.makeUserJob.exitCommand }} && exit $x" ] args: [ "/bin/sh /config/add-user; EV=$?; {{ .Values.makeUserJob.exitCommand }} && exit $EV" ]
{{- else }} {{- else }}
command: [ "/bin/sh", "/config/add-user" ] command: [ "/bin/sh", "/config/add-user" ]
{{- end }} {{- end }}
@ -134,10 +134,10 @@ containers:
mountPath: {{ .Values.configPathmc }}certs mountPath: {{ .Values.configPathmc }}certs
{{ end }} {{ end }}
resources: resources:
{ { toYaml .Values.makeUserJob.resources | indent 10 } } {{- toYaml .Values.makeUserJob.resources | nindent 12 }}
{{- end }} {{- end }}
{{- if .Values.policies }} {{- if .Values.policies }}
- name: minio-makePolicy - name: minio-make-policy
image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}" image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}"
{{- if .Values.makePolicyJob.securityContext.enabled }} {{- if .Values.makePolicyJob.securityContext.enabled }}
securityContext: securityContext:
@ -148,7 +148,7 @@ containers:
imagePullPolicy: {{ .Values.mcImage.pullPolicy }} imagePullPolicy: {{ .Values.mcImage.pullPolicy }}
{{- if .Values.makePolicyJob.exitCommand }} {{- if .Values.makePolicyJob.exitCommand }}
command: [ "/bin/sh", "-c" ] command: [ "/bin/sh", "-c" ]
args: [ "/bin/sh /config/add-policy; x=$(echo $?); {{ .Values.makePolicyJob.exitCommand }} && exit $x" ] args: [ "/bin/sh /config/add-policy; EV=$?; {{ .Values.makePolicyJob.exitCommand }} && exit $EV" ]
{{- else }} {{- else }}
command: [ "/bin/sh", "/config/add-policy" ] command: [ "/bin/sh", "/config/add-policy" ]
{{- end }} {{- end }}
@ -165,10 +165,10 @@ containers:
mountPath: {{ .Values.configPathmc }}certs mountPath: {{ .Values.configPathmc }}certs
{{ end }} {{ end }}
resources: resources:
{ { toYaml .Values.makePolicyJob.resources | indent 10 } } {{- toYaml .Values.makePolicyJob.resources | nindent 12 }}
{{- end }} {{- end }}
{{- if .Values.customCommands }} {{- if .Values.customCommands }}
- name: minio-customCommand - name: minio-custom-command
image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}" image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}"
{{- if .Values.customCommandJob.securityContext.enabled }} {{- if .Values.customCommandJob.securityContext.enabled }}
securityContext: securityContext:
@ -179,7 +179,7 @@ containers:
imagePullPolicy: {{ .Values.mcImage.pullPolicy }} imagePullPolicy: {{ .Values.mcImage.pullPolicy }}
{{- if .Values.customCommandJob.exitCommand }} {{- if .Values.customCommandJob.exitCommand }}
command: [ "/bin/sh", "-c" ] command: [ "/bin/sh", "-c" ]
args: [ "/bin/sh /config/custom-command; x=$(echo $?); {{ .Values.customCommandJob.exitCommand }} && exit $x" ] args: [ "/bin/sh /config/custom-command; EV=$?; {{ .Values.customCommandJob.exitCommand }} && exit $EV" ]
{{- else }} {{- else }}
command: [ "/bin/sh", "/config/custom-command" ] command: [ "/bin/sh", "/config/custom-command" ]
{{- end }} {{- end }}
@ -196,7 +196,7 @@ containers:
mountPath: {{ .Values.configPathmc }}certs mountPath: {{ .Values.configPathmc }}certs
{{ end }} {{ end }}
resources: resources:
{ { toYaml .Values.customCommandJob.resources | indent 10 } } {{- toYaml .Values.customCommandJob.resources | nindent 12 }}
{{- end }} {{- end }}
{{- if .Values.svcaccts }} {{- if .Values.svcaccts }}
- name: minio-make-svcacct - name: minio-make-svcacct
@ -210,7 +210,7 @@ containers:
imagePullPolicy: {{ .Values.mcImage.pullPolicy }} imagePullPolicy: {{ .Values.mcImage.pullPolicy }}
{{- if .Values.makeServiceAccountJob.exitCommand }} {{- if .Values.makeServiceAccountJob.exitCommand }}
command: [ "/bin/sh", "-c" ] command: [ "/bin/sh", "-c" ]
args: ["/bin/sh /config/add-svcacct; x=$(echo $?); {{ .Values.makeServiceAccountJob.exitCommand }} && exit $x" ] args: ["/bin/sh /config/add-svcacct; EV=$?; {{ .Values.makeServiceAccountJob.exitCommand }} && exit $EV" ]
{{- else }} {{- else }}
command: ["/bin/sh", "/config/add-svcacct"] command: ["/bin/sh", "/config/add-svcacct"]
{{- end }} {{- end }}
@ -227,5 +227,5 @@ containers:
mountPath: {{ .Values.configPathmc }}certs mountPath: {{ .Values.configPathmc }}certs
{{ end }} {{ end }}
resources: resources:
{{ toYaml .Values.makeServiceAccountJob.resources | indent 10 }} {{- toYaml .Values.makeServiceAccountJob.resources | nindent 12 }}
{{- end }} {{- end }}