fix: harden scheduler-k3s cron manifests and dockerfile run startup

The cron-id label could exceed Kubernetes' 63-byte cap when commands or
schedules were long, and an all-digit job-suffix or cron-id rendered as
an unquoted YAML scalar caused the API server to reject manifests. Run
pods built from dockerfiles also occasionally hit the 10s startup wait
on a cold image pull, even though the pod was scheduled correctly.

The cron-id is now stored as an annotation and a shorter hash is used as
the selector label. Every interpolated annotation and label value in the
cron-job and deployment templates is now quoted to prevent numeric
coercion, and the run-pod wait timeout is raised to 30 seconds.
This commit is contained in:
Jose Diaz-Gonzalez committed 2026-05-11 14:49:58 -04:00
1 parent d0588698f5
commit b66df28d96
7 files changed
+198 -38

No files matched your search

@@ -9,18 +9,18 @@ kind: CronJob
metadata:
annotations:
app.kubernetes.io/version: {{ $.Values.global.deployment_id | quote }}
dokku.com/builder-type: {{ $.Values.global.image.type }}
dokku.com/cron-id: {{ $config.cron.id }}
dokku.com/job-suffix: {{ $config.cron.suffix }}
dokku.com/builder-type: {{ $.Values.global.image.type | quote }}
dokku.com/cron-id: {{ $config.cron.id | quote }}
dokku.com/job-suffix: {{ $config.cron.suffix | quote }}
dokku.com/managed: "true"
kubectl.kubernetes.io/default-container: {{ $.Values.global.app_name }}-cron
kubectl.kubernetes.io/default-container: {{ printf "%s-cron" $.Values.global.app_name | quote }}
{{ include "print.annotations" (dict "config" $.Values.global "key" "cronjob") | indent 4 }}
{{ include "print.annotations" (dict "config" $config "key" "cronjob") | indent 4 }}
labels:
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-cron-{{ $config.cron.suffix }}
app.kubernetes.io/instance: {{ printf "%s-cron-%s" $.Values.global.app_name $config.cron.suffix | quote }}
app.kubernetes.io/name: cron
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
dokku.com/cron-id: {{ $config.cron.id }}
app.kubernetes.io/part-of: {{ $.Values.global.app_name | quote }}
dokku.com/cron-hash: {{ $config.cron.hash | quote }}
{{ include "print.labels" (dict "config" $.Values.global "key" "cronjob") | indent 4 }}
{{ include "print.labels" (dict "config" $config "key" "cronjob") | indent 4 }}
name: {{ $.Values.global.app_name }}-cron-{{ $config.cron.suffix }}
@@ -32,18 +32,18 @@ spec:
metadata:
annotations:
app.kubernetes.io/version: {{ $.Values.global.deployment_id | quote }}
dokku.com/builder-type: {{ $.Values.global.image.type }}
dokku.com/cron-id: {{ $config.cron.id }}
dokku.com/job-suffix: {{ $config.cron.suffix }}
dokku.com/builder-type: {{ $.Values.global.image.type | quote }}
dokku.com/cron-id: {{ $config.cron.id | quote }}
dokku.com/job-suffix: {{ $config.cron.suffix | quote }}
dokku.com/managed: "true"
kubectl.kubernetes.io/default-container: {{ $.Values.global.app_name }}-cron
kubectl.kubernetes.io/default-container: {{ printf "%s-cron" $.Values.global.app_name | quote }}
{{ include "print.annotations" (dict "config" $.Values.global "key" "job") | indent 8 }}
{{ include "print.annotations" (dict "config" $config "key" "job") | indent 8 }}
labels:
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-cron-{{ $config.cron.suffix }}
app.kubernetes.io/instance: {{ printf "%s-cron-%s" $.Values.global.app_name $config.cron.suffix | quote }}
app.kubernetes.io/name: cron
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
dokku.com/cron-id: {{ $config.cron.id }}
app.kubernetes.io/part-of: {{ $.Values.global.app_name | quote }}
dokku.com/cron-hash: {{ $config.cron.hash | quote }}
{{ include "print.labels" (dict "config" $.Values.global "key" "job") | indent 8 }}
{{ include "print.labels" (dict "config" $config "key" "job") | indent 8 }}
spec:
@@ -55,18 +55,18 @@ spec:
metadata:
annotations:
app.kubernetes.io/version: {{ $.Values.global.deployment_id | quote }}
dokku.com/builder-type: {{ $.Values.global.image.type }}
dokku.com/cron-id: {{ $config.cron.id }}
dokku.com/job-suffix: {{ $config.cron.suffix }}
dokku.com/builder-type: {{ $.Values.global.image.type | quote }}
dokku.com/cron-id: {{ $config.cron.id | quote }}
dokku.com/job-suffix: {{ $config.cron.suffix | quote }}
dokku.com/managed: "true"
kubectl.kubernetes.io/default-container: {{ $.Values.global.app_name }}-cron
kubectl.kubernetes.io/default-container: {{ printf "%s-cron" $.Values.global.app_name | quote }}
{{ include "print.annotations" (dict "config" $.Values.global "key" "pod") | indent 12 }}
{{ include "print.annotations" (dict "config" $config "key" "pod") | indent 12 }}
labels:
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-cron-{{ $config.cron.suffix }}
app.kubernetes.io/instance: {{ printf "%s-cron-%s" $.Values.global.app_name $config.cron.suffix | quote }}
app.kubernetes.io/name: cron
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
dokku.com/cron-id: {{ $config.cron.id }}
app.kubernetes.io/part-of: {{ $.Values.global.app_name | quote }}
dokku.com/cron-hash: {{ $config.cron.hash | quote }}
{{ include "print.labels" (dict "config" $.Values.global "key" "pod") | indent 12 }}
{{ include "print.labels" (dict "config" $config "key" "pod") | indent 12 }}
spec:
@@ -16,15 +16,15 @@ kind: Deployment
metadata:
annotations:
app.kubernetes.io/version: {{ $.Values.global.deployment_id | quote }}
dokku.com/builder-type: {{ $.Values.global.image.type }}
dokku.com/builder-type: {{ $.Values.global.image.type | quote }}
dokku.com/managed: "true"
kubectl.kubernetes.io/default-container: {{ $.Values.global.app_name }}-{{ $processName }}
kubectl.kubernetes.io/default-container: {{ printf "%s-%s" $.Values.global.app_name $processName | quote }}
{{ include "print.annotations" (dict "config" $.Values.global "key" "deployment") | indent 4 }}
{{ include "print.annotations" (dict "config" $config "key" "deployment") | indent 4 }}
labels:
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-{{ $processName }}
app.kubernetes.io/name: {{ $processName }}
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
app.kubernetes.io/instance: {{ printf "%s-%s" $.Values.global.app_name $processName | quote }}
app.kubernetes.io/name: {{ $processName | quote }}
app.kubernetes.io/part-of: {{ $.Values.global.app_name | quote }}
{{ include "print.labels" (dict "config" $.Values.global "key" "deployment") | indent 4 }}
{{ include "print.labels" (dict "config" $config "key" "deployment") | indent 4 }}
name: {{ $.Values.global.app_name }}-{{ $processName }}