Files
gh-vukhanhtruong-claude-roc…/skills/helm-scaffold/assets/templates/cronjob/cronjob.yaml
2025-11-30 09:05:12 +08:00

67 lines
2.4 KiB
YAML

apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "CHARTNAME.fullname" . }}
labels:
{{- include "CHARTNAME.labels" . | nindent 4 }}
spec:
schedule: {{ .Values.cronJob.schedule | quote }}
{{- if .Values.cronJob.concurrencyPolicy }}
concurrencyPolicy: {{ .Values.cronJob.concurrencyPolicy }}
{{- end }}
{{- if .Values.cronJob.successfulJobsHistoryLimit }}
successfulJobsHistoryLimit: {{ .Values.cronJob.successfulJobsHistoryLimit }}
{{- end }}
{{- if .Values.cronJob.failedJobsHistoryLimit }}
failedJobsHistoryLimit: {{ .Values.cronJob.failedJobsHistoryLimit }}
{{- end }}
jobTemplate:
spec:
{{- if .Values.cronJob.backoffLimit }}
backoffLimit: {{ .Values.cronJob.backoffLimit }}
{{- end }}
{{- if .Values.cronJob.activeDeadlineSeconds }}
activeDeadlineSeconds: {{ .Values.cronJob.activeDeadlineSeconds }}
{{- end }}
template:
metadata:
labels:
{{- include "CHARTNAME.selectorLabels" . | nindent 12 }}
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 12 }}
{{- end }}
spec:
restartPolicy: {{ .Values.cronJob.restartPolicy | default "OnFailure" }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 12 }}
{{- end }}
serviceAccountName: {{ include "CHARTNAME.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 12 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 14 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.cronJob.command }}
command:
{{- toYaml .Values.cronJob.command | nindent 14 }}
{{- end }}
{{- if .Values.cronJob.args }}
args:
{{- toYaml .Values.cronJob.args | nindent 14 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 14 }}
{{- with .Values.env }}
env:
{{- toYaml . | nindent 14 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}