2025-07-04 01:46:03 -04:00
|
|
|
{{- range $processName, $config := .Values.processes }}
|
2025-07-02 02:20:39 -04:00
|
|
|
{{- if not (and (hasKey $config "cron") (hasKey $config.cron "id")) }}
|
2025-08-22 02:30:19 -04:00
|
|
|
# Skip {{ $processName }} as it is not a cron job
|
2025-07-02 02:20:39 -04:00
|
|
|
{{- continue }}
|
|
|
|
|
{{- end }}
|
2024-01-23 01:29:50 -05:00
|
|
|
---
|
|
|
|
|
apiVersion: batch/v1
|
|
|
|
|
kind: CronJob
|
|
|
|
|
metadata:
|
|
|
|
|
annotations:
|
2024-11-03 14:27:09 -05:00
|
|
|
app.kubernetes.io/version: {{ $.Values.global.deployment_id | quote }}
|
2026-05-11 14:49:58 -04:00
|
|
|
dokku.com/builder-type: {{ $.Values.global.image.type | quote }}
|
2026-05-24 02:50:09 -04:00
|
|
|
dokku.com/cron-hash: {{ $config.cron.hash | quote }}
|
2026-05-11 14:49:58 -04:00
|
|
|
dokku.com/cron-id: {{ $config.cron.id | quote }}
|
|
|
|
|
dokku.com/job-suffix: {{ $config.cron.suffix | quote }}
|
2024-01-23 01:29:50 -05:00
|
|
|
dokku.com/managed: "true"
|
2026-05-11 14:49:58 -04:00
|
|
|
kubectl.kubernetes.io/default-container: {{ printf "%s-cron" $.Values.global.app_name | quote }}
|
2024-02-28 12:42:40 -05:00
|
|
|
{{ include "print.annotations" (dict "config" $.Values.global "key" "cronjob") | indent 4 }}
|
|
|
|
|
{{ include "print.annotations" (dict "config" $config "key" "cronjob") | indent 4 }}
|
2024-01-23 01:29:50 -05:00
|
|
|
labels:
|
2026-05-11 14:49:58 -04:00
|
|
|
app.kubernetes.io/instance: {{ printf "%s-cron-%s" $.Values.global.app_name $config.cron.suffix | quote }}
|
2024-01-23 01:29:50 -05:00
|
|
|
app.kubernetes.io/name: cron
|
2026-05-11 14:49:58 -04:00
|
|
|
app.kubernetes.io/part-of: {{ $.Values.global.app_name | quote }}
|
|
|
|
|
dokku.com/cron-hash: {{ $config.cron.hash | quote }}
|
2024-02-28 12:42:40 -05:00
|
|
|
{{ include "print.labels" (dict "config" $.Values.global "key" "cronjob") | indent 4 }}
|
|
|
|
|
{{ include "print.labels" (dict "config" $config "key" "cronjob") | indent 4 }}
|
2024-01-23 01:29:50 -05:00
|
|
|
name: {{ $.Values.global.app_name }}-cron-{{ $config.cron.suffix }}
|
2024-02-05 16:50:00 -05:00
|
|
|
namespace: {{ $.Values.global.namespace }}
|
2024-01-23 01:29:50 -05:00
|
|
|
spec:
|
2025-09-21 18:12:25 -04:00
|
|
|
concurrencyPolicy: {{ $config.cron.concurrency_policy }}
|
2024-01-23 01:29:50 -05:00
|
|
|
failedJobsHistoryLimit: 10
|
|
|
|
|
jobTemplate:
|
|
|
|
|
metadata:
|
|
|
|
|
annotations:
|
2024-11-03 14:27:09 -05:00
|
|
|
app.kubernetes.io/version: {{ $.Values.global.deployment_id | quote }}
|
2026-05-11 14:49:58 -04:00
|
|
|
dokku.com/builder-type: {{ $.Values.global.image.type | quote }}
|
2026-05-24 02:50:09 -04:00
|
|
|
dokku.com/cron-hash: {{ $config.cron.hash | quote }}
|
2026-05-11 14:49:58 -04:00
|
|
|
dokku.com/cron-id: {{ $config.cron.id | quote }}
|
|
|
|
|
dokku.com/job-suffix: {{ $config.cron.suffix | quote }}
|
2024-01-23 01:29:50 -05:00
|
|
|
dokku.com/managed: "true"
|
2026-05-11 14:49:58 -04:00
|
|
|
kubectl.kubernetes.io/default-container: {{ printf "%s-cron" $.Values.global.app_name | quote }}
|
2024-02-28 12:42:40 -05:00
|
|
|
{{ include "print.annotations" (dict "config" $.Values.global "key" "job") | indent 8 }}
|
|
|
|
|
{{ include "print.annotations" (dict "config" $config "key" "job") | indent 8 }}
|
2024-01-23 01:29:50 -05:00
|
|
|
labels:
|
2026-05-11 14:49:58 -04:00
|
|
|
app.kubernetes.io/instance: {{ printf "%s-cron-%s" $.Values.global.app_name $config.cron.suffix | quote }}
|
2024-01-23 01:29:50 -05:00
|
|
|
app.kubernetes.io/name: cron
|
2026-05-11 14:49:58 -04:00
|
|
|
app.kubernetes.io/part-of: {{ $.Values.global.app_name | quote }}
|
|
|
|
|
dokku.com/cron-hash: {{ $config.cron.hash | quote }}
|
2024-02-28 12:42:40 -05:00
|
|
|
{{ include "print.labels" (dict "config" $.Values.global "key" "job") | indent 8 }}
|
|
|
|
|
{{ include "print.labels" (dict "config" $config "key" "job") | indent 8 }}
|
2024-01-23 01:29:50 -05:00
|
|
|
spec:
|
|
|
|
|
backoffLimit: 0
|
|
|
|
|
podReplacementPolicy: Failed
|
2024-01-23 07:25:51 -05:00
|
|
|
ttlSecondsAfterFinished: 60
|
2026-08-12 13:11:34 -04:00
|
|
|
activeDeadlineSeconds: {{ $config.cron.active_deadline_seconds | default 86400 }}
|
2024-01-23 01:29:50 -05:00
|
|
|
template:
|
|
|
|
|
metadata:
|
|
|
|
|
annotations:
|
2024-11-03 14:27:09 -05:00
|
|
|
app.kubernetes.io/version: {{ $.Values.global.deployment_id | quote }}
|
2026-05-11 14:49:58 -04:00
|
|
|
dokku.com/builder-type: {{ $.Values.global.image.type | quote }}
|
2026-05-24 02:50:09 -04:00
|
|
|
dokku.com/cron-hash: {{ $config.cron.hash | quote }}
|
2026-05-11 14:49:58 -04:00
|
|
|
dokku.com/cron-id: {{ $config.cron.id | quote }}
|
|
|
|
|
dokku.com/job-suffix: {{ $config.cron.suffix | quote }}
|
2024-01-23 01:29:50 -05:00
|
|
|
dokku.com/managed: "true"
|
2026-05-11 14:49:58 -04:00
|
|
|
kubectl.kubernetes.io/default-container: {{ printf "%s-cron" $.Values.global.app_name | quote }}
|
2024-02-28 12:42:40 -05:00
|
|
|
{{ include "print.annotations" (dict "config" $.Values.global "key" "pod") | indent 12 }}
|
|
|
|
|
{{ include "print.annotations" (dict "config" $config "key" "pod") | indent 12 }}
|
2024-01-23 01:29:50 -05:00
|
|
|
labels:
|
2026-05-11 14:49:58 -04:00
|
|
|
app.kubernetes.io/instance: {{ printf "%s-cron-%s" $.Values.global.app_name $config.cron.suffix | quote }}
|
2024-01-23 01:29:50 -05:00
|
|
|
app.kubernetes.io/name: cron
|
2026-05-11 14:49:58 -04:00
|
|
|
app.kubernetes.io/part-of: {{ $.Values.global.app_name | quote }}
|
|
|
|
|
dokku.com/cron-hash: {{ $config.cron.hash | quote }}
|
2024-02-28 12:42:40 -05:00
|
|
|
{{ include "print.labels" (dict "config" $.Values.global "key" "pod") | indent 12 }}
|
|
|
|
|
{{ include "print.labels" (dict "config" $config "key" "pod") | indent 12 }}
|
2024-01-23 01:29:50 -05:00
|
|
|
spec:
|
2026-08-07 02:38:46 -04:00
|
|
|
{{- if and (hasKey $.Values.global "security_context") $.Values.global.security_context.sysctls }}
|
|
|
|
|
securityContext:
|
|
|
|
|
sysctls:
|
|
|
|
|
{{- range $.Values.global.security_context.sysctls }}
|
|
|
|
|
- name: {{ .name }}
|
|
|
|
|
value: {{ .value | quote }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- end }}
|
2024-01-23 01:29:50 -05:00
|
|
|
containers:
|
|
|
|
|
- args:
|
|
|
|
|
{{- range $config.args }}
|
|
|
|
|
- {{ . }}
|
|
|
|
|
{{- end }}
|
2026-04-30 21:29:11 -04:00
|
|
|
{{- if eq $.Values.global.image.type "pack" }}
|
|
|
|
|
command:
|
|
|
|
|
- launcher
|
|
|
|
|
{{- end }}
|
2024-01-23 01:29:50 -05:00
|
|
|
envFrom:
|
|
|
|
|
- secretRef:
|
2026-04-29 09:46:29 -04:00
|
|
|
name: config-{{ $.Values.global.app_name }}
|
2024-01-23 01:29:50 -05:00
|
|
|
optional: true
|
|
|
|
|
image: {{ $.Values.global.image.name }}
|
|
|
|
|
imagePullPolicy: Always
|
|
|
|
|
name: {{ $.Values.global.app_name }}-cron
|
|
|
|
|
{{- if and $config.resources (or $config.resources.limits $config.resources.requests) }}
|
|
|
|
|
resources:
|
|
|
|
|
{{- if $config.resources.limits }}
|
|
|
|
|
limits:
|
|
|
|
|
{{- if $config.resources.limits.cpu }}
|
|
|
|
|
cpu: {{ $config.resources.limits.cpu }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- if $config.resources.limits.memory }}
|
|
|
|
|
memory: {{ $config.resources.limits.memory }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- if $config.resources.requests }}
|
|
|
|
|
requests:
|
|
|
|
|
{{- if $config.resources.requests.cpu }}
|
|
|
|
|
cpu: {{ $config.resources.requests.cpu }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- if $config.resources.requests.memory }}
|
|
|
|
|
memory: {{ $config.resources.requests.memory }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- end }}
|
2025-09-12 18:09:33 -04:00
|
|
|
{{- if hasKey $.Values.global "security_context" }}
|
|
|
|
|
securityContext:
|
|
|
|
|
{{- if $.Values.global.security_context.privileged }}
|
|
|
|
|
privileged: true
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- if hasKey $.Values.global.security_context "capabilities" }}
|
|
|
|
|
capabilities:
|
|
|
|
|
{{- if hasKey $.Values.global.security_context.capabilities "add" }}
|
|
|
|
|
add:
|
|
|
|
|
{{- range $.Values.global.security_context.capabilities.add }}
|
|
|
|
|
- {{ . }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- if hasKey $.Values.global.security_context.capabilities "drop" }}
|
|
|
|
|
drop:
|
|
|
|
|
{{- range $.Values.global.security_context.capabilities.drop }}
|
|
|
|
|
- {{ . }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- end }}
|
2025-09-12 19:19:04 -04:00
|
|
|
{{- end }}
|
2025-09-12 18:09:33 -04:00
|
|
|
{{- end }}
|
2024-01-23 01:29:50 -05:00
|
|
|
{{- if $.Values.global.image.working_dir }}
|
|
|
|
|
workingDir: {{ $.Values.global.image.working_dir }}
|
|
|
|
|
{{- end }}
|
2026-04-29 14:49:15 -04:00
|
|
|
{{- if $config.volumes }}
|
|
|
|
|
volumeMounts:
|
|
|
|
|
{{- range $volume := $config.volumes }}
|
|
|
|
|
- name: {{ $volume.name }}
|
|
|
|
|
mountPath: {{ $volume.mount_path }}
|
|
|
|
|
{{- if $volume.sub_path }}
|
|
|
|
|
subPath: {{ $volume.sub_path }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- if $volume.read_only }}
|
|
|
|
|
readOnly: true
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- end }}
|
2024-01-23 01:29:50 -05:00
|
|
|
{{- if $.Values.global.image.image_pull_secrets }}
|
2024-02-12 17:15:37 -05:00
|
|
|
imagePullSecrets:
|
|
|
|
|
- name: {{ $.Values.global.image.image_pull_secrets }}
|
2024-01-23 01:29:50 -05:00
|
|
|
{{- end }}
|
|
|
|
|
restartPolicy: Never
|
2024-02-05 16:44:20 -05:00
|
|
|
serviceAccountName: {{ $.Values.global.app_name }}
|
2026-04-29 14:49:15 -04:00
|
|
|
{{- if $config.volumes }}
|
|
|
|
|
volumes:
|
|
|
|
|
{{- range $volume := $config.volumes }}
|
|
|
|
|
- name: {{ $volume.name }}
|
|
|
|
|
{{- if $volume.empty_dir }}
|
|
|
|
|
emptyDir:
|
|
|
|
|
{{- if $volume.empty_dir.medium }}
|
|
|
|
|
medium: {{ $volume.empty_dir.medium }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- if $volume.empty_dir.size_limit }}
|
|
|
|
|
sizeLimit: {{ $volume.empty_dir.size_limit }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- if $volume.persistent_claim }}
|
|
|
|
|
persistentVolumeClaim:
|
|
|
|
|
claimName: {{ $volume.persistent_claim.claim_name }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- end }}
|
|
|
|
|
{{- end }}
|
2024-01-23 01:29:50 -05:00
|
|
|
schedule: {{ $config.cron.schedule }}
|
|
|
|
|
startingDeadlineSeconds: 60
|
|
|
|
|
successfulJobsHistoryLimit: 10
|
2025-09-21 19:48:11 -04:00
|
|
|
suspend: {{ $config.cron.suspend }}
|
2024-01-23 04:42:20 -05:00
|
|
|
timeZone: Etc/UTC
|
2025-07-02 02:20:39 -04:00
|
|
|
{{- end }}
|