Skip to content

fix(k8s): tolerate scale-to-zero during deployment readiness - #4075

Open
Elvand-Lie wants to merge 1 commit into
knative:mainfrom
Elvand-Lie:fix/wait-zero-replicas
Open

Elvand-Lie wants to merge 1 commit into
knative:mainfrom
Elvand-Lie:fix/wait-zero-replicas

Conversation

@Elvand-Lie

Copy link
Copy Markdown
Contributor

KEDA can scale a Deployment to zero while func waits after redeploy. The wait previously aborted when no active ReplicaSet supplied a pod-template-hash. Judge zero replicas by current-generation Deployment status, and retry inconsistent Deployment/ReplicaSet reads during scaling. API errors still fail and unresolved state still times out.

Idle zero-replica success does not establish that a pod of the new image ran. This changes the shared raw/keda wait; Knative uses its own Serving readiness. Remote deployments receive it after the func-util image is released.

Testing: exported wait and selector tests use a concrete Clientset with an httptest API server. They cover reconciled zero, stale/remaining status, scale-down between reads, healthy nonzero, timeout, cancellation and API errors. Main fails the reported hash-error regressions. Linux make test, make check, check-schema and check-embedded-fs passed. No valid revised Windows, live KEDA/cluster or macOS checks.

/kind bug
Fixes #4068

Raw and KEDA deployment readiness waits tolerate scale-to-zero and transient ReplicaSet changes instead of aborting on a missing pod-template-hash.
N/A

Judge zero replicas from reconciled Deployment status without looking
for an active ReplicaSet. Retry a missing pod-template-hash when scaler
updates make Deployment and ReplicaSet reads inconsistent. API failures
still propagate and unresolved state still times out.

Exercise the exported name and selector waits with a real Clientset and
an HTTP test server, including stale status, scale-down between reads,
healthy nonzero deployments, cancellation and API failures.

Fixes knative#4068

Assisted-by: OpenAI Codex and Claude Code
Signed-off-by: Elvand Lie Nababan <elvandlie@gmail.com>
@knative-prow knative-prow Bot added the kind/bug Bugs label Oct 11, 2026
@knative-prow
knative-prow Bot requested a review from dsimansk October 11, 2026 12:50
@knative-prow

knative-prow Bot commented Oct 11, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Elvand-Lie
Once this PR has been reviewed and has the lgtm label, please assign gauron99 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

@knative-prow
knative-prow Bot requested a review from jrangelramos October 11, 2026 12:50
@knative-prow knative-prow Bot added the size/L 🤖 PR changes 100-499 lines, ignoring generated files. label Oct 11, 2026
@knative-prow

knative-prow Bot commented Oct 11, 2026

Copy link
Copy Markdown

Hi @Elvand-Lie. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow knative-prow Bot added the needs-ok-to-test 🤖 Needs an org member to approve testing label Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Bugs needs-ok-to-test 🤖 Needs an org member to approve testing size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

k8s deployer: WaitForDeploymentAvailable errors on a 0-replica Deployment (keda scale-to-zero redeploy)

1 participant