From 8f5d45e0eb822bd34607be658ff3d93a7630d05e Mon Sep 17 00:00:00 2001 From: Myasnikov Daniil Date: Mon, 18 May 2026 13:03:42 +0500 Subject: [PATCH] fix(kubevirt-cdi-operator): add startupProbe to survive slow leader election MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Myasnikov Daniil --- .../system/kubevirt-cdi-operator/Makefile | 1 + .../patches/startupProbe.diff | 19 +++++++++++++++++++ .../templates/cdi-operator.yaml | 8 ++++++++ 3 files changed, 28 insertions(+) create mode 100644 packages/system/kubevirt-cdi-operator/patches/startupProbe.diff diff --git a/packages/system/kubevirt-cdi-operator/Makefile b/packages/system/kubevirt-cdi-operator/Makefile index 7232216fc..8d12f4e8d 100644 --- a/packages/system/kubevirt-cdi-operator/Makefile +++ b/packages/system/kubevirt-cdi-operator/Makefile @@ -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 diff --git a/packages/system/kubevirt-cdi-operator/patches/startupProbe.diff b/packages/system/kubevirt-cdi-operator/patches/startupProbe.diff new file mode 100644 index 000000000..85d86e849 --- /dev/null +++ b/packages/system/kubevirt-cdi-operator/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 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