Skip to content

Commit

Permalink
default image & node selector for jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
joy2fun committed Jun 17, 2024
1 parent 354acb5 commit 440e5c9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/templates/cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
spec:
restartPolicy: Never
containers:
- image: {{ $.Values.cron.image }}
- image: {{ $.Values.cron.image | default "bitnami/kubectl:latest" }}
imagePullPolicy: IfNotPresent
env:
- name: KUBERNETES_SERVICE_HOST
Expand All @@ -25,6 +25,10 @@ spec:
- -c
- {{ .command }}
serviceAccountName: {{ $.Values.cron.serviceAccountName }}
{{- with $.Values.cron.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
schedule: "{{ .schedule }}"
{{- end }}
{{- end }}
6 changes: 5 additions & 1 deletion app/templates/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
containers:
{{- range $index, $task := .Values.tasks.commands }}
- name: task-{{ $index }}-{{ $task.name }}
image: {{ .Values.tasks.image }}
image: {{ $.Values.tasks.image | default "bitnami/kubectl:latest" }}
imagePullPolicy: IfNotPresent
resources:
limits:
Expand All @@ -33,4 +33,8 @@ spec:
- while true; do {{ $task.command }}; sleep {{ $task.sleep | default 10 }} ; done
{{- end }}
serviceAccountName: {{ .Values.tasks.serviceAccountName }}
{{- with .Values.tasks.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ cron:
enabled: false
serviceAccountName: job
image: bitnami/kubectl:latest
nodeSelector: {}
jobs:
- schedule: "* * * * *"
name: "job"
Expand All @@ -61,6 +62,7 @@ tasks:
enabled: false
serviceAccountName: job
image: bitnami/kubectl:latest
nodeSelector: {}
commands:
- name: whoami
sleep: 10
Expand Down

0 comments on commit 440e5c9

Please sign in to comment.