From e174f013dc7e46b4a759e0322c8d0ab669d9dc5f Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Thu, 8 Oct 2020 06:24:59 +0500 Subject: [PATCH] Add support for cronjob deployments --- charts/ix-chart/2009.0.1/questions.yaml | 11 ++++++++++- charts/ix-chart/2009.0.1/templates/deployment.yaml | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/charts/ix-chart/2009.0.1/questions.yaml b/charts/ix-chart/2009.0.1/questions.yaml index 89752e9bba5..53a53d3f0c6 100644 --- a/charts/ix-chart/2009.0.1/questions.yaml +++ b/charts/ix-chart/2009.0.1/questions.yaml @@ -1,7 +1,7 @@ # Workload type - variable: workloadType description: "Please specify type of workload to deploy" - lablel: "Workload Type" + label: "Workload Type" schema: type: string default: "Deployment" @@ -11,6 +11,15 @@ - "Job" - "CronJob" +# Cronjob schedule +- variable: cronSchedule + label: "Cron Schedule" + schema: + type: cron + show_if: [["workloadType", "=", "CronJob"]] + default: + minute: "5" + # Image related - variable: image description: "Docker Image Details" diff --git a/charts/ix-chart/2009.0.1/templates/deployment.yaml b/charts/ix-chart/2009.0.1/templates/deployment.yaml index ba216f7df47..a7f8398b4d5 100644 --- a/charts/ix-chart/2009.0.1/templates/deployment.yaml +++ b/charts/ix-chart/2009.0.1/templates/deployment.yaml @@ -12,7 +12,12 @@ spec: matchLabels: {{- include "ix-chart.selectorLabels" . | nindent 6 }} {{- end }} + {{- if ne (include "workloadIsCronJob" .) "true" }} template: + {{- else }} + schedule: {{ .Values.cronSchedule | quote }} + jobTemplate: + {{- end }} metadata: labels: {{- include "ix-chart.selectorLabels" . | nindent 8 }}