Skip to content

fix(controller): require missing stable RS before blue-green fast-track on empty selector - #4967

Open
pujitha24 wants to merge 1 commit into
argoproj:masterfrom
pujitha24:auto/issue-4750
Open

fix(controller): require missing stable RS before blue-green fast-track on empty selector#4967
pujitha24 wants to merge 1 commit into
argoproj:masterfrom
pujitha24:auto/issue-4750

Conversation

@pujitha24

Copy link
Copy Markdown

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional with a list of types and scopes found here, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I've signed my commits with DCO
  • My builds are green. Try syncing with master if they are not.
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • I have run all tests locally (including the flaky ones) and they pass on my workstation
  • I have used LLM/AI/Agent tools for this PR but I am responsible for all code of this PR
  • I understand what the code does and WHY/HOW it works in several scenarios
  • I know if my code is just adding new functionality or changing old functionality for existing users
  • My organization is added to USERS.md.

AI assistance: this change was drafted with Claude Code.

Fixes #4750

…ck on empty selector

Motivation:
In blue-green rollouts, isBlueGreenFastTracked() treated a missing
rollouts-pod-template-hash key on the active Service's selector as an
unconditional signal to fast-track the update: skip the blue-green pause
and (via reconcileActiveService) switch the active selector straight to
the incoming ReplicaSet's hash, bypassing prePromotionAnalysis and the
autoPromotionEnabled=false gate. This was only supposed to apply to a
genuine first-ever deploy, but the code never checked whether a stable
ReplicaSet already existed. If the active Service's selector was ever
missing/cleared for any other reason while a stable revision was already
recorded, the controller would misclassify the situation and promote an
unverified new ReplicaSet straight to active without any of the
configured safety gates.

This matches the report: an active service selector observed as empty
during a Progressing rollout with autoPromotionEnabled=false and
prePromotionAnalysis configured, followed by a SwitchService event
moving the selector directly to a bad revision's hash with no analysis
or manual approval in between.

Approach:
Gate the "missing selector key" fast-track branch in
isBlueGreenFastTracked() on c.stableRS == nil (the same signal
shouldFullPromote already uses elsewhere for "no stable ReplicaSet
recorded yet"). This is a narrowing change: it only removes
fast-tracking in the case where a stable ReplicaSet already exists,
which was never a correct case to fast-track through.

Note on scope: this change stops the controller from promoting an
unverified new ReplicaSet when the active selector is unexpectedly
empty. It does not restore active-service traffic on its own — while a
stable ReplicaSet exists and pause/prePromotionAnalysis have not yet
completed, the active selector stays as-is (still empty in that
scenario) rather than jumping to the new ReplicaSet. It also does not
address what causes the active Service's selector to become empty in
the first place; that is a separate, unconfirmed question raised in the
report.

Validation:
- go build ./... (clean)
- go vet ./rollout/... (clean)
- go test ./rollout/... -count=1 (all packages pass)
- Targeted regression test: with rollout/bluegreen.go reverted (git
  stash) to the pre-fix code, `go test ./rollout/...
  -run TestBlueGreenFastTrackRequiresNoStableRS -v` fails on the
  "ExistingStableRSIsNotFastTrackedDespiteEmptySelector" subtest
  exactly as expected (isBlueGreenFastTracked wrongly returns true).
  Restoring the fix makes the same test pass. No e2e/live-cluster
  reproduction was run; this is a pure controller-logic defect fully
  covered by the failing-then-passing unit test above.

Report: argoproj#4750
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
@pujitha24
pujitha24 requested a review from a team as a code owner August 10, 2026 12:25
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.13%. Comparing base (f2c5c2b) to head (ceffa71).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4967      +/-   ##
==========================================
- Coverage   85.17%   85.13%   -0.05%     
==========================================
  Files         166      166              
  Lines       19453    19453              
==========================================
- Hits        16570    16562       -8     
- Misses       2030     2034       +4     
- Partials      853      857       +4     
Flag Coverage Δ
e2e 52.98% <0.00%> (-0.04%) ⬇️
unit-tests 81.64% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

Published E2E Test Results

  4 files    4 suites   4h 7m 49s ⏱️
149 tests 138 ✅  7 💤 4 ❌
600 runs  568 ✅ 28 💤 4 ❌

For more details on these failures, see this check.

Results for commit ceffa71.

@github-actions

Copy link
Copy Markdown
Contributor

Published Unit Test Results

2 628 tests   2 628 ✅  3m 30s ⏱️
  131 suites      0 💤
    1 files        0 ❌

Results for commit ceffa71.

@pujitha24

Copy link
Copy Markdown
Author

This is rebased and green whenever someone has a moment to take a look — happy to make any changes that would help review go smoother.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant