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

@ -1,231 +1,231 @@
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: { { template "minio.fullname" . } }-post-job name: {{ template "minio.fullname" . }}-post-job
namespace: { { .Release.Namespace | quote } } namespace: {{ .Release.Namespace | quote }}
labels: labels:
app: { { template "minio.name" . } }-post-job app: {{ template "minio.name" . }}-post-job
chart: { { template "minio.chart" . } } chart: {{ template "minio.chart" . }}
release: { { .Release.Name } } release: {{ .Release.Name }}
heritage: { { .Release.Service } } heritage: {{ .Release.Service }}
annotations: annotations:
"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:
metadata: metadata:
labels: labels:
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:
runAsUser: { { .Values.postJob.securityContext.runAsUser } } runAsUser: {{ .Values.postJob.securityContext.runAsUser }}
runAsGroup: { { .Values.postJob.securityContext.runAsGroup } } runAsGroup: {{ .Values.postJob.securityContext.runAsGroup }}
fsGroup: { { .Values.postJob.securityContext.fsGroup } } fsGroup: {{ .Values.postJob.securityContext.fsGroup }}
{ { - end } } {{- end }}
volumes: volumes:
- name: minio-configuration - name: minio-configuration
projected: projected:
sources: sources:
- configMap: - configMap:
name: { { template "minio.fullname" . } } name: {{ template "minio.fullname" . }}
- secret: - secret:
name: { { template "minio.secretName" . } } name: {{ template "minio.secretName" . }}
{ { - 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 }}
- name: cert-secret-volume-mc - name: cert-secret-volume-mc
secret: secret:
secretName: { { .Values.tls.certSecret } } secretName: {{ .Values.tls.certSecret }}
items: items:
- key: { { .Values.tls.publicCrt } } - key: {{ .Values.tls.publicCrt }}
path: CAs/public.crt path: CAs/public.crt
{ { 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:
runAsUser: { { .Values.makeBucketJob.securityContext.runAsUser } } runAsUser: {{ .Values.makeBucketJob.securityContext.runAsUser }}
runAsGroup: { { .Values.makeBucketJob.securityContext.runAsGroup } } runAsGroup: {{ .Values.makeBucketJob.securityContext.runAsGroup }}
fsGroup: { { .Values.makeBucketJob.securityContext.fsGroup } } fsGroup: {{ .Values.makeBucketJob.securityContext.fsGroup }}
{ { - end } } {{- end }}
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 }}
env: env:
- name: MINIO_ENDPOINT - name: MINIO_ENDPOINT
value: { { template "minio.fullname" . } } value: {{ template "minio.fullname" . }}
- name: MINIO_PORT - name: MINIO_PORT
value: { { .Values.service.port | quote } } value: {{ .Values.service.port | quote }}
volumeMounts: volumeMounts:
- name: minio-configuration - name: minio-configuration
mountPath: /config mountPath: /config
{ { - if .Values.tls.enabled } } {{- if .Values.tls.enabled }}
- name: cert-secret-volume-mc - name: cert-secret-volume-mc
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:
runAsUser: { { .Values.makeUserJob.securityContext.runAsUser } } runAsUser: {{ .Values.makeUserJob.securityContext.runAsUser }}
runAsGroup: { { .Values.makeUserJob.securityContext.runAsGroup } } runAsGroup: {{ .Values.makeUserJob.securityContext.runAsGroup }}
fsGroup: { { .Values.makeUserJob.securityContext.fsGroup } } fsGroup: {{ .Values.makeUserJob.securityContext.fsGroup }}
{ { - end } } {{- end }}
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 }}
env: env:
- name: MINIO_ENDPOINT - name: MINIO_ENDPOINT
value: { { template "minio.fullname" . } } value: {{ template "minio.fullname" . }}
- name: MINIO_PORT - name: MINIO_PORT
value: { { .Values.service.port | quote } } value: {{ .Values.service.port | quote }}
volumeMounts: volumeMounts:
- name: minio-configuration - name: minio-configuration
mountPath: /config mountPath: /config
{ { - if .Values.tls.enabled } } {{- if .Values.tls.enabled }}
- name: cert-secret-volume-mc - name: cert-secret-volume-mc
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:
runAsUser: { { .Values.makePolicyJob.securityContext.runAsUser } } runAsUser: {{ .Values.makePolicyJob.securityContext.runAsUser }}
runAsGroup: { { .Values.makePolicyJob.securityContext.runAsGroup } } runAsGroup: {{ .Values.makePolicyJob.securityContext.runAsGroup }}
fsGroup: { { .Values.makePolicyJob.securityContext.fsGroup } } fsGroup: {{ .Values.makePolicyJob.securityContext.fsGroup }}
{ { - end } } {{- end }}
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 }}
env: env:
- name: MINIO_ENDPOINT - name: MINIO_ENDPOINT
value: { { template "minio.fullname" . } } value: {{ template "minio.fullname" . }}
- name: MINIO_PORT - name: MINIO_PORT
value: { { .Values.service.port | quote } } value: {{ .Values.service.port | quote }}
volumeMounts: volumeMounts:
- name: minio-configuration - name: minio-configuration
mountPath: /config mountPath: /config
{ { - if .Values.tls.enabled } } {{- if .Values.tls.enabled }}
- name: cert-secret-volume-mc - name: cert-secret-volume-mc
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:
runAsUser: { { .Values.customCommandJob.securityContext.runAsUser } } runAsUser: {{ .Values.customCommandJob.securityContext.runAsUser }}
runAsGroup: { { .Values.customCommandJob.securityContext.runAsGroup } } runAsGroup: {{ .Values.customCommandJob.securityContext.runAsGroup }}
fsGroup: { { .Values.customCommandJob.securityContext.fsGroup } } fsGroup: {{ .Values.customCommandJob.securityContext.fsGroup }}
{ { - end } } {{- end }}
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 }}
env: env:
- name: MINIO_ENDPOINT - name: MINIO_ENDPOINT
value: { { template "minio.fullname" . } } value: {{ template "minio.fullname" . }}
- name: MINIO_PORT - name: MINIO_PORT
value: { { .Values.service.port | quote } } value: {{ .Values.service.port | quote }}
volumeMounts: volumeMounts:
- name: minio-configuration - name: minio-configuration
mountPath: /config mountPath: /config
{ { - if .Values.tls.enabled } } {{- if .Values.tls.enabled }}
- name: cert-secret-volume-mc - name: cert-secret-volume-mc
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
image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}" image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}"
{ { - if .Values.makeServiceAccountJob.securityContext.enabled } } {{- if .Values.makeServiceAccountJob.securityContext.enabled }}
securityContext: securityContext:
runAsUser: { { .Values.makeServiceAccountJob.securityContext.runAsUser } } runAsUser: {{ .Values.makeServiceAccountJob.securityContext.runAsUser }}
runAsGroup: { { .Values.makeServiceAccountJob.securityContext.runAsGroup } } runAsGroup: {{ .Values.makeServiceAccountJob.securityContext.runAsGroup }}
fsGroup: { { .Values.makeServiceAccountJob.securityContext.fsGroup } } fsGroup: {{ .Values.makeServiceAccountJob.securityContext.fsGroup }}
{ { - end } } {{- end }}
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 }}
env: env:
- name: MINIO_ENDPOINT - name: MINIO_ENDPOINT
value: { { template "minio.fullname" . } } value: {{ template "minio.fullname" . }}
- name: MINIO_PORT - name: MINIO_PORT
value: { { .Values.service.port | quote } } value: {{ .Values.service.port | quote }}
volumeMounts: volumeMounts:
- name: minio-configuration - name: minio-configuration
mountPath: /config mountPath: /config
{ { - if .Values.tls.enabled } } {{- if .Values.tls.enabled }}
- name: cert-secret-volume-mc - name: cert-secret-volume-mc
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 }}