Skip to content

Commit

Permalink
Merge pull request #133 from shoplineapp/feature/add-cronjob-pod-sche…
Browse files Browse the repository at this point in the history
…dule-config

feat: add toleration and nodeselector on cronwf
  • Loading branch information
bluesky6529 authored Nov 2, 2023
2 parents cb49604 + e8fdba3 commit 44efdd2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cronjob/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
description: Helm chart with simple cronjob template
name: cronjob
version: 0.6.4
version: 0.7.0
appVersion: 0.0.1
tillerVersion: ">=2.14.3"
27 changes: 19 additions & 8 deletions cronjob/templates/_argo_cron_workflow.tpl
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
{{- define "cronjob.argo_cron_workflow" -}}
workflowSpec:
podMetadata:
labels:
name: {{ .Values.name }}
annotations:
{{- range $key, $value := .Values.annotations }}
{{ $key | quote }} : {{ $value | quote }}
{{- end }}
workflowMetadata:
labels:
name: {{ .Values.name }}
{{- range $key, $value := .Values.annotations }}
{{ $key | quote }} : {{ $value | quote }}
{{- end }}
annotations:
{{- range $key, $value := .Values.annotations }}
{{ $key | quote }} : {{ $value | quote }}
{{- end }}
{{- if .Values.serviceaccount }}
serviceAccountName: {{ .Values.serviceaccount.name | default (printf "%s-pod-service-account" .Values.name) }}
{{- else if .Values.serviceAccount }}
serviceAccountName: {{ .Values.name }}-pod-service-account
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 6 }}
{{- end }}
# If .Values.job.timeout equal to null, the pod will be kill ONLY the job is done. Otherwise, the pod will kill after the value you set
{{- if and (.Values.job) (.Values.job.timeout) }}
activeDeadlineSeconds: {{.Values.job.timeout }}
Expand Down Expand Up @@ -89,11 +105,6 @@
- name: template
metadata:
namespace: {{ .Release.Namespace }}
annotations:
cronjob_name: {{ .Values.name }}
{{- range $key, $value := .Values.annotations }}
{{ $key | quote }} : {{ $value | quote }}
{{- end }}
container:
image: '{{ required "image.repository must be provided" .Values.image.repository }}:{{ required "image.tag must be provided" .Values.image.tag }}'
{{- if .Values.command }}
Expand Down
13 changes: 12 additions & 1 deletion cronjob/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,15 @@ pdb:
enable: false
# Note: You can specify only one of maxUnavailable and minAvailable in a single PodDisruptionBudget, and if you setting both will only set maxUnavailable.
# minAvailable: 9999
# maxUnavailable: 0
# maxUnavailable: 0

nodeSelector: {}
# nodeSelector:
# nodegroup: ec-eks-db-cpu-node-autoscaling-group

tolerations: []
# tolerations:
# - key: "shop-callback-node"
# operator: "Equal"
# value: "true"
# effect: "NoSchedule"

0 comments on commit 44efdd2

Please sign in to comment.