fix: fail Deployment tracking fast on ReplicaSet pod-create errors
Closed
SH
25d ago+2649+2649+0123456789012345678901234567890123456789-122-122-012345678901234567890123456789
This PR makes the Deployment tracker observe ReplicaSet pod-create failures such as FailedCreate ... exceeded quota instead of waiting for the tracking timeout.
The ReplicaSet controller reports these failures on the ReplicaSet, while the Deployment tracker previously watched only the Deployment object and its events. StatefulSet and DaemonSet tracking are unaffected because their controllers report FailedCreate on the object kubedog already watches.
Behavior
- Read
FailedCreatefrom the durableReplicaSetReplicaFailurecondition. This catches failures that predate informer startup and works withKUBEDOG_DISABLE_EVENTS=1. - Treat invalid specs and quota failures with no rollout path to release quota as fatal immediately.
- Keep rollout-recoverable quota failures counted against the allowed-failures budget. The first classification stays latched until the condition clears and reappears, because Kubernetes can retain a stale
FailedCreatecondition while retrying. - Account for
TerminatingReplicaswhen deciding whether an old ReplicaSet can release quota for the rollout. - Wait for the complete initial ReplicaSet snapshot before classifying failures.
- Track ReplicaSet incarnations by UID, handle same-name replacement, and preserve failures across selector leave/reentry without accepting stale events.
- Preserve informer ordering with unbuffered, cancellation-aware sends so cleanup cannot leave the shared informer goroutine blocked.
- Keep the original failure reason and message in the reported diagnostic.
- Mark a fatal resource state as failed only for fail modes that should stop the deploy process.
IgnoreAndContinueDeployProcessremains unchanged.
Only ReplicaSets controlled by the tracked Deployment are considered, because label selectors alone are not unique.
Verification
go build ./...go test ./...- Race-enabled tests for the Deployment, ReplicaSet, dynamic tracker, and utility packages
go veton the changed package trees- Lifecycle coverage for initial sync, failure classification, recovery, UID replacement, selector reentry, stale conditions, successor promotion, and informer cleanup
- kind reproduction with a
ResourceQuotaofpods: 0: tracking previously waited for the timeout and now returns the originalFailedCreatequota diagnostic within seconds