Skip to content

fix: don't default null replicas/readyReplicas in Readiness checks - #4905

Open
sureshmelvinsigera wants to merge 1 commit into
kubernetes-client:masterfrom
sureshmelvinsigera:fix/readiness-null-replicas
Open

fix: don't default null replicas/readyReplicas in Readiness checks#4905
sureshmelvinsigera wants to merge 1 commit into
kubernetes-client:masterfrom
sureshmelvinsigera:fix/readiness-null-replicas

Conversation

@sureshmelvinsigera

Copy link
Copy Markdown
Contributor

isReplicaSetReady and isReplicationControllerReady silently treated a null spec.replicas as 1 and null status.readyReplicas as 0, which can misreport readiness. isStatefulSetReady already had this exact issue fixed by a maintainer in a prior review - this applies the same fix to the two remaining copy-pasted methods, plus regression tests.

See bc40df9 ("Addressed comment") for the original StatefulSet fix this mirrors.

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sureshmelvinsigera
Once this PR has been reviewed and has the lgtm label, please assign brendandburns for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 11, 2026
@sureshmelvinsigera
sureshmelvinsigera force-pushed the fix/readiness-null-replicas branch from 27ea3a3 to ae9a305 Compare September 11, 2026 03:15
@sureshmelvinsigera

Copy link
Copy Markdown
Contributor Author

Fixed two of the regression tests (nullReadyReplicas cases). They used replicas=3, which passed under both old and new code and didn't actually catch the bug. Changed to replicas=0, which is the case where the old default (readyReplicas=null becomes 0) would wrongly report ready.

isReplicaSetReady and isReplicationControllerReady silently treated a
null spec.replicas as 1 and null status.readyReplicas as 0, which can
misreport readiness. isStatefulSetReady already had this exact issue
fixed by a maintainer in a prior review - this applies the same fix
to the two remaining copy-pasted methods, plus regression tests.
@sureshmelvinsigera
sureshmelvinsigera force-pushed the fix/readiness-null-replicas branch from ae9a305 to b9afedb Compare September 11, 2026 03:29
@brendandburns

Copy link
Copy Markdown
Contributor

Some of this is philosophical, I guess. Is a replica set with zero replicas "ready" or not?

Can you check what client-go does in this case? That's probably as close to a spec as there exists for this question.

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

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants