fix(kubevirt-cdi-operator): add startupProbe to survive slow leader election

cdi-operator's controller-runtime starts the health probe HTTP server
(:8444) only after the leader election lease is acquired. On a fresh
cluster the lease can take 15–20 s, exceeding the liveness probe's
5s + 3×10s grace under load. Kubelet kills the container before the
probe can succeed; the pod loops in CrashLoopBackOff, CDI never
reconciles its CR, datavolumes.cdi.kubevirt.io stays unavailable, and
every downstream test that creates a DataVolume (tenant kubernetes
worker VMs, vm-instance) fails.

Add a startupProbe that hits /healthz with 30×5s grace (150 s total).
Once it succeeds once, liveness/readiness take over with their existing
strict config. No effect on healthy clusters; only relaxes the
ramp-up window.

Implemented as a patches/*.diff applied from the Makefile update
target, mirroring the fluxcd-operator pattern. Survives the next
upstream regen; if upstream restructures the area around the
readinessProbe/resources boundary the patch will fail loudly so the
maintainer notices.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
This commit is contained in:
Myasnikov DaniilandClaude Opus 4.7 committed 2026-05-19 19:11:21 +05:00
1 parent 3fbfc16624
commit 8f5d45e0eb
3 files changed
+28

No files matched your search

@@ -10,3 +10,4 @@ update:
wget https://github.com/kubevirt/containerized-data-importer/releases/download/$$VERSION/cdi-operator.yaml -O templates/cdi-operator.yaml
sed -i 's/namespace: cdi/namespace: cozy-kubevirt-cdi/g' templates/cdi-operator.yaml
awk -i inplace -v RS="---" '!/kind: Namespace/{printf "%s", $$0 RS}' templates/cdi-operator.yaml
patch --no-backup-if-mismatch -p1 < patches/startupProbe.diff
@@ -0,0 +1,19 @@
diff --git a/packages/system/kubevirt-cdi-operator/templates/cdi-operator.yaml b/packages/system/kubevirt-cdi-operator/templates/cdi-operator.yaml
index f46ba09e6..03ac3b3a2 100644
--- a/packages/system/kubevirt-cdi-operator/templates/cdi-operator.yaml
+++ b/packages/system/kubevirt-cdi-operator/templates/cdi-operator.yaml
@@ -5782,6 +5782,14 @@ spec:
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 10
+ startupProbe:
+ httpGet:
+ path: /healthz
+ port: 8444
+ scheme: HTTP
+ periodSeconds: 5
+ failureThreshold: 30
+ timeoutSeconds: 10
resources:
requests:
cpu: 100m
@@ -5782,6 +5782,14 @@ spec:
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 10
startupProbe:
httpGet:
path: /healthz
port: 8444
scheme: HTTP
periodSeconds: 5
failureThreshold: 30
timeoutSeconds: 10
resources:
requests:
cpu: 100m