Skip to content

Commit 6408130

Browse files
committed
#50 support Job and CronJob
1 parent f32f8c8 commit 6408130

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

examples/app/templates/cron-job.yaml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,13 @@ spec:
1414
- /bin/sh
1515
- -c
1616
- date; echo Hello from the Kubernetes cluster
17-
image: busybox:1.28
18-
imagePullPolicy: IfNotPresent
17+
env:
18+
- name: KUBERNETES_CLUSTER_DOMAIN
19+
value: {{ quote .Values.kubernetesClusterDomain }}
20+
image: {{ .Values.cronJob.hello.image.repository }}:{{ .Values.cronJob.hello.image.tag
21+
| default .Chart.AppVersion }}
22+
imagePullPolicy: {{ .Values.cronJob.hello.imagePullPolicy }}
1923
name: hello
24+
resources: {}
2025
restartPolicy: OnFailure
21-
template:
22-
spec:
23-
containers:
24-
- command:
25-
- /bin/sh
26-
- -c
27-
- date; echo Hello from the Kubernetes cluster
28-
env:
29-
- name: KUBERNETES_CLUSTER_DOMAIN
30-
value: {{ quote .Values.kubernetesClusterDomain }}
31-
image: {{ .Values.cronJob.hello.image.repository }}:{{ .Values.cronJob.hello.image.tag
32-
| default .Chart.AppVersion }}
33-
imagePullPolicy: {{ .Values.cronJob.hello.imagePullPolicy }}
34-
name: hello
35-
resources: {}
36-
restartPolicy: OnFailure
3726
schedule: {{ .Values.cronJob.schedule | quote }}

pkg/processor/job/cron.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func (p cron) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructure
115115
return true, nil, err
116116
}
117117

118-
err = unstructured.SetNestedMap(specMap, podSpecMap, "jobTemplate", "template", "spec")
118+
err = unstructured.SetNestedMap(specMap, podSpecMap, "jobTemplate", "spec", "template", "spec")
119119
if err != nil {
120120
return true, nil, fmt.Errorf("%w: unable to template job spec", err)
121121
}

0 commit comments

Comments
 (0)