Skip to content

[release-v1.40] fix(status): report a StatefulSet available only once its pods are ready - #5355

Merged
tianfeng92 merged 1 commit into
tigera:release-v1.40from
tianfeng92:tian-ev7258-pick-v1.40
Oct 14, 2026
Merged

tianfeng92 merged 1 commit into
tigera:release-v1.40from
tianfeng92:tian-ev7258-pick-v1.40

Conversation

@tianfeng92

Copy link
Copy Markdown
Contributor

Cherry-pick of tigera/calico-private#14541 (EV-7258), the same change for the operator branch that ships Calico Enterprise v3.22.

What
TigeraStatus no longer reports a StatefulSet Available before its pods are ready, and a rollout no longer says "awaiting -1 replicas".

Why
The status manager compared spec.replicas with status.currentReplicas, which counts pods that exist whether or not they are ready. On this branch a running pod that is not ready is already reported Degraded by podsFailing, so the false Available shows while the pod is still Pending. The progressing message subtracted the wrong way round.

Fix
Check observedGeneration, then availableReplicas, then updatedReplicas, then a scale-down. The awaited count is spec minus available, and the check that skips podsFailing now reads availableReplicas. status.go is identical to master. The test file needed a hand merge.

Release Note
See below.

Test plan

  • go test ./pkg/controller/status/ passes, including the new StatefulSet tests.
  • The master change was verified on a 3.24 cluster and a master cluster (see tigera/calico-private#14541). This branch was not tested on a cluster.

Release note:

TigeraStatus no longer reports a StatefulSet-backed component as Available before its pods are ready.

AI assistance: Claude Code made the cherry-pick; reviewed by the author.

The status manager compared spec.replicas with status.currentReplicas, which
counts pods created at the current revision whether or not they are ready.
TigeraStatus went Available as soon as a pod existed, seconds before it passed
readiness, and the progressing message subtracted the wrong way round, so a
rollout reported "awaiting -1 replicas".

Check observedGeneration first, then availableReplicas, then updatedReplicas,
and count the replicas still awaited as spec minus available. The generation
message now names the StatefulSet instead of printing the whole object.

Comparing availableReplicas and updatedReplicas with spec only catches a
shortfall, so a StatefulSet scaling down from 3 to 1 with all 3 pods still
running read as Available. The old spec-versus-currentReplicas check had
reported it Progressing. Report it as scaling down while status.replicas is
above spec.

The check that skips pod diagnosis now reads availableReplicas, the same
signal the progressing checks use.

(cherry picked from commit 6438fcaf82e8a77340c0e6e1af75d3fefda9c7df in tigera/calico-private)
@marvin-tigera marvin-tigera added this to the v1.40.17 milestone Oct 14, 2026
@tianfeng92
tianfeng92 marked this pull request as ready for review October 14, 2026 20:02
@tianfeng92
tianfeng92 requested a review from a team as a code owner October 14, 2026 20:02
@tianfeng92
tianfeng92 merged commit 6cb9042 into tigera:release-v1.40 Oct 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants