Explorar o código

Add support for cronjob deployments

Waqar Ahmed %!s(int64=4) %!d(string=hai) anos
pai
achega
e174f013dc

+ 10 - 1
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"

+ 5 - 0
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 }}