job.tpl 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. apiVersion: batch/v1
  2. kind: CronJob
  3. metadata:
  4. name: {{.Name}}
  5. namespace: {{.Namespace}}
  6. spec:
  7. successfulJobsHistoryLimit: {{.SuccessfulJobsHistoryLimit}}
  8. schedule: "{{.Schedule}}"
  9. jobTemplate:
  10. spec:
  11. template:
  12. spec:{{if .ServiceAccount}}
  13. serviceAccountName: {{.ServiceAccount}}{{end}}
  14. {{end}}containers:
  15. - name: {{.Name}}
  16. image: # todo image url
  17. resources:
  18. requests:
  19. cpu: {{.RequestCpu}}m
  20. memory: {{.RequestMem}}Mi
  21. limits:
  22. cpu: {{.LimitCpu}}m
  23. memory: {{.LimitMem}}Mi
  24. command:
  25. - ./{{.ServiceName}}
  26. - -f
  27. - ./{{.Name}}.yaml
  28. volumeMounts:
  29. - name: timezone
  30. mountPath: /etc/localtime
  31. imagePullSecrets:
  32. - name: # registry secret, if no, remove this
  33. restartPolicy: OnFailure
  34. volumes:
  35. - name: timezone
  36. hostPath:
  37. path: /usr/share/zoneinfo/Asia/Shanghai