Commit 7aa966cb authored by Waqar Ahmed's avatar Waqar Ahmed

Add method to convert cron object to cron expression

parent 50218820
...@@ -61,3 +61,11 @@ Create the name of the service account to use ...@@ -61,3 +61,11 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }} {{- default "default" .Values.serviceAccount.name }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{/*
Convert cron schema object to cron format
*/}}
{{- define "cronExpression" }}
{{- printf "%s %s %s %s %s " .minute .hour .dom .month .dow }}
{{- end }}
...@@ -127,7 +127,7 @@ template: ...@@ -127,7 +127,7 @@ template:
CronJob Spec CronJob Spec
*/}} */}}
{{- define "cronJobSpec" }} {{- define "cronJobSpec" }}
schedule: {{ .Values.cronSchedule | quote }} schedule: {{ include "cronExpression" .Values.cronSchedule | quote }}
jobTemplate: jobTemplate:
spec: spec:
{{ include "jobSpec" . | nindent 4 }} {{ include "jobSpec" . | nindent 4 }}
......
...@@ -9,6 +9,6 @@ spec: ...@@ -9,6 +9,6 @@ spec:
{{ include "deploymentSpec" . | nindent 2 }} {{ include "deploymentSpec" . | nindent 2 }}
{{- else if eq (include "workloadIsCronJob" .) "true" }} {{- else if eq (include "workloadIsCronJob" .) "true" }}
{{ include "cronJobSpec" . | nindent 2 }} {{ include "cronJobSpec" . | nindent 2 }}
{{- else }}} {{- else }}
{{ include "jobSpec" . | nindent 2 }} {{ include "jobSpec" . | nindent 2 }}
{{- end }} {{- end }}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment