Skip to content

Commit

Permalink
Optionally run a command when completing jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhibbert committed Jun 1, 2022
1 parent f7cecf0 commit 3e9b92a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
5 changes: 5 additions & 0 deletions helm/minio/templates/post-install-create-bucket-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ spec:
- name: minio-mc
image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}"
imagePullPolicy: {{ .Values.mcImage.pullPolicy }}
{{- if .Values.makeBucketJob.exitCommand }}
command: ["/bin/sh", "-c"]
args: ["/bin/sh /config/initialize; x=$(echo $?); {{ .Values.makeBucketJob.exitCommand }} && exit $x" ]
{{- else }}
command: ["/bin/sh", "/config/initialize"]
{{- end }}
env:
- name: MINIO_ENDPOINT
value: {{ template "minio.fullname" . }}
Expand Down
5 changes: 5 additions & 0 deletions helm/minio/templates/post-install-create-policy-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ spec:
- name: minio-mc
image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}"
imagePullPolicy: {{ .Values.mcImage.pullPolicy }}
{{- if .Values.makePolicyJob.exitCommand }}
command: ["/bin/sh", "-c"]
args: ["/bin/sh /config/add-policy; x=$(echo $?); {{ .Values.makePolicyJob.exitCommand }} && exit $x" ]
{{- else }}
command: ["/bin/sh", "/config/add-policy"]
{{- end }}
env:
- name: MINIO_ENDPOINT
value: {{ template "minio.fullname" . }}
Expand Down
5 changes: 5 additions & 0 deletions helm/minio/templates/post-install-create-user-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ spec:
- name: minio-mc
image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}"
imagePullPolicy: {{ .Values.mcImage.pullPolicy }}
{{- if .Values.makeUserJob.exitCommand }}
command: ["/bin/sh", "-c"]
args: ["/bin/sh /config/add-user; x=$(echo $?); {{ .Values.makeUserJob.exitCommand }} && exit $x" ]
{{- else }}
command: ["/bin/sh", "/config/add-user"]
{{- end }}
env:
- name: MINIO_ENDPOINT
value: {{ template "minio.fullname" . }}
Expand Down
5 changes: 5 additions & 0 deletions helm/minio/templates/post-install-custom-command.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ spec:
- name: minio-mc
image: "{{ .Values.mcImage.repository }}:{{ .Values.mcImage.tag }}"
imagePullPolicy: {{ .Values.mcImage.pullPolicy }}
{{- if .Values.customCommandJob.exitCommand }}
command: ["/bin/sh", "-c"]
args: ["/bin/sh /config/custom-command; x=$(echo $?); {{ .Values.customCommandJob.exitCommand }} && exit $x" ]
{{- else }}
command: ["/bin/sh", "/config/custom-command"]
{{- end }}
env:
- name: MINIO_ENDPOINT
value: {{ template "minio.fullname" . }}
Expand Down
12 changes: 10 additions & 2 deletions helm/minio/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ makePolicyJob:
nodeSelector: {}
tolerations: []
affinity: {}
# Command to run after the main command on exit
exitCommand: ""

## List of users to be created after minio install
##
Expand Down Expand Up @@ -338,6 +340,8 @@ makeUserJob:
nodeSelector: {}
tolerations: []
affinity: {}
# Command to run after the main command on exit
exitCommand: ""

## List of buckets to be created after minio install
##
Expand Down Expand Up @@ -372,7 +376,9 @@ makeBucketJob:
nodeSelector: {}
tolerations: []
affinity: {}

# Command to run after the main command on exit
exitCommand: ""

## List of command to run after minio install
## NOTE: the mc command TARGET is always "myminio"
customCommands:
Expand All @@ -393,7 +399,9 @@ customCommandJob:
nodeSelector: {}
tolerations: []
affinity: {}

# Command to run after the main command on exit
exitCommand: ""

## Use this field to add environment variables relevant to MinIO server. These fields will be passed on to MinIO container(s)
## when Chart is deployed
environment:
Expand Down

0 comments on commit 3e9b92a

Please sign in to comment.