You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add full support for Kubernetes startup probes with proper initialDelaySeconds
handling. Startup probes now:
- Respect initialDelaySeconds configuration before first execution
- Run in background without blocking container startup
- Block readiness and liveness probes until successful
- Support both HTTP and Exec probe types
- Include proper cleanup and error handling
Changes:
- Update ContainerCommand struct to include startupProbes field
- Extend translateKubernetesProbes to handle startup probe translation
- Implement runStartupProbe and waitForStartupProbes functions
- Update probe metadata storage/loading for startup probe counts
- Add startup probe example demonstrating 300s initial delay
- Fix probe script generation to properly sequence probe execution
Startup probes follow Kubernetes semantics where they must succeed before
other probes begin execution, preventing premature readiness/liveness checks
during application initialization.
Signed-off-by: Diego Ciangottini <diego.ciangottini@pg.infn.it>
if [ $consecutive_failures -ge $failure_threshold ]; then
297
+
printf "%%s\n" "$(date -Is --utc) ${probe_name} probe failed for ${container_name} after ${failure_threshold} attempts - container should be restarted" >&2
298
+
echo "FAILED_THRESHOLD" > "$probe_status_file"
299
+
return 1
300
+
fi
301
+
fi
302
+
303
+
sleep "$period"
304
+
done
305
+
}
306
+
307
+
waitForStartupProbes() {
308
+
local container_name="$1"
309
+
local startup_probe_count="$2"
310
+
311
+
if [ "$startup_probe_count" -eq 0 ]; then
312
+
return 0
313
+
fi
314
+
315
+
printf "%%s\n" "$(date -Is --utc) Waiting for startup probes to succeed before starting other probes for ${container_name}..."
316
+
317
+
while true; do
318
+
local all_startup_probes_successful=true
319
+
320
+
for i in $(seq 0 $((startup_probe_count - 1))); do
321
+
local probe_status_file="${workingPath}/startup-probe-${container_name}-${i}.status"
322
+
if [ ! -f "$probe_status_file" ]; then
323
+
all_startup_probes_successful=false
324
+
break
325
+
fi
326
+
327
+
local status=$(cat "$probe_status_file")
328
+
if [ "$status" != "SUCCESS" ]; then
329
+
if [ "$status" = "FAILED_THRESHOLD" ]; then
330
+
printf "%%s\n" "$(date -Is --utc) Startup probe failed for ${container_name} - other probes will not start" >&2
331
+
return 1
332
+
fi
333
+
all_startup_probes_successful=false
334
+
break
335
+
fi
336
+
done
337
+
338
+
if [ "$all_startup_probes_successful" = true ]; then
339
+
printf "%%s\n" "$(date -Is --utc) All startup probes successful for ${container_name} - other probes can now start"
340
+
return 0
341
+
fi
342
+
343
+
sleep 1
344
+
done
345
+
}
346
+
234
347
`)
235
348
349
+
// Generate startup probe calls - these run in background but block other probes
0 commit comments