Skip to content

Conversation

@aviralgarg05
Copy link

Revisions with initialScale > 1 that are no longer referenced by any Route (routingState = 'reserve', mapped to Reachability = Unreachable) were previously unable to scale down to 0, causing resource waste when old revisions were replaced by new ones.

This change modifies the initialScale logic in scaler.go to ignore the initialScale constraint when a revision's Reachability is Unreachable. This allows revisions in reserve state to scale down to 0 immediately, freeing up resources promptly when they are no longer needed.

The fix adds a check for pa.Spec.Reachability != ReachabilityUnreachable before applying the initialScale constraint, ensuring that:

  • Revisions with routingState = 'reserve' can scale down to 0 immediately
  • The initialScale logic only applies to revisions that are still referenced by Routes (routingState = 'active')
  • Resources are freed promptly when old revisions are replaced

A new test case has been added to verify the behavior: revisions with initialScale > 1 and Reachability = Unreachable can now scale to 0.

Fixes #16260

Proposed Changes

Release Note

NONE

…to scale to 0

Revisions with initialScale > 1 that are no longer referenced by any
Route (routingState = 'reserve', mapped to Reachability = Unreachable)
were previously unable to scale down to 0, causing resource waste when
old revisions were replaced by new ones.

This change modifies the initialScale logic in scaler.go to ignore the
initialScale constraint when a revision's Reachability is Unreachable.
This allows revisions in reserve state to scale down to 0 immediately,
freeing up resources promptly when they are no longer needed.

The fix adds a check for pa.Spec.Reachability != ReachabilityUnreachable
before applying the initialScale constraint, ensuring that:
- Revisions with routingState = 'reserve' can scale down to 0 immediately
- The initialScale logic only applies to revisions that are still
  referenced by Routes (routingState = 'active')
- Resources are freed promptly when old revisions are replaced

A new test case has been added to verify the behavior: revisions with
initialScale > 1 and Reachability = Unreachable can now scale to 0.

Fixes knative#16260
@knative-prow knative-prow bot requested review from dsimansk and skonto January 7, 2026 13:55
@knative-prow
Copy link

knative-prow bot commented Jan 7, 2026

Welcome @aviralgarg05! It looks like this is your first PR to knative/serving 🎉

@knative-prow
Copy link

knative-prow bot commented Jan 7, 2026

Hi @aviralgarg05. Thanks for your PR.

I'm waiting for a github.com 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. Regular contributors should join the org to skip this step.

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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 7, 2026
@knative-prow
Copy link

knative-prow bot commented Jan 7, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revisions with initialScale > 1 that are no longer referenced by any Route cannot scale down to 0

1 participant