fix: skip canary steps and fast-promote when spec.replicas is 0 - #4950
fix: skip canary steps and fast-promote when spec.replicas is 0#4950zachaller wants to merge 2 commits into
Conversation
Signed-off-by: Zach Aller <zachaller@users.noreply.github.com>
Published E2E Test Results 4 files 4 suites 4h 12m 17s ⏱️ For more details on these failures, see this check. Results for commit f208dd5. ♻️ This comment has been updated with latest results. |
Published Unit Test Results2 627 tests 2 627 ✅ 3m 31s ⏱️ Results for commit f208dd5. ♻️ This comment has been updated with latest results. |
Signed-off-by: Zach Aller <zachaller@users.noreply.github.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4950 +/- ##
==========================================
- Coverage 85.15% 85.14% -0.01%
==========================================
Files 166 166
Lines 19437 19458 +21
==========================================
+ Hits 16551 16567 +16
- Misses 2031 2035 +4
- Partials 855 856 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| if isScalingEvent { | ||
| if isScalingEvent && !c.needsZeroReplicaFastTrackReconcile() { |
There was a problem hiding this comment.
Need a better way to do this that does not block scaling only reconciles



Summary
When a canary Rollout has
spec.replicas: 0and a new version is deployed, the controller now skips canary steps and immediately promotes the new ReplicaSet as stable. Previously, percentage-based steps were no-ops but explicit steps still ran — notablypausecould suspend the rollout indefinitely, andsetCanaryScale.replicascould spawn unexpected pods (e.g. scaling to 1 while the rollout was scaled down).This matches the expected behavior for scaled-down workloads: with no pods to validate, canary progression adds no value. The new version becomes stable so that traffic routing (VirtualServices, Services, etc.) is already pointed at the correct hash when replicas are scaled back up.
Changes
shouldFullPromote: whenspec.replicas == 0and an update is in progress, promote immediately with reason"Zero replicas - skipping canary steps"reconcileCanaryPause: skip pause steps at zero replicasCalculateReplicaCountsForTrafficRoutedCanary: ignore explicitsetCanaryScale.replicaswhenspec.replicas == 0Only applies when
spec.replicasis explicitly set to0(not nil/default).Checklist:
"fix(controller): Updates such and such. Fixes #1234".