serving icon indicating copy to clipboard operation
serving copied to clipboard

KPA initial scale can exceed max-scale and prevent activation

Open jahnavigajjala-3 opened this issue 1 month ago • 1 comments

Description

The KPA scaler does not consistently enforce max-scale when applying a revision's initial scale.

When initialScale exceeds a configured positive maxScale, the initial-scale adjustment can raise minScale above maxScale. This violates the bounds expected by the scaler and can cause the revision to scale beyond its configured maximum.

There is also a related activation-threshold inconsistency. The KPA's activeThreshold() uses the initial scale without capping it at maxScale. If the scaler is limited to fewer replicas than the activation threshold requires, the PodAutoscaler may remain in the Activating state until timing out.

Steps to reproduce

Configure a revision with:

  • initial-scale: "5"
  • max-scale: "2"

Observe the desired replica count and PodAutoscaler activation behavior.

Expected behavior

  • The initial desired scale should not exceed a configured positive maxScale.
  • The activation threshold should be consistent with the effective scale bounds.
  • maxScale = 0 should continue to mean unlimited.
  • Existing behavior for unreachable revisions and already-initialized scale targets should remain unchanged.

Actual behavior

The initial-scale adjustment can exceed the configured maximum. The activation threshold can also require more ready replicas than the maximum allows, potentially leaving the PodAutoscaler stuck in Activating.

Proposed fix

Clamp the initial scale to the configured positive maximum and ensure the KPA activation threshold uses a consistent effective bound. Add regression tests covering maximum-scale enforcement, unlimited maximum scale, and activation readiness.

I have reproduced the behavior and am validating a fix with regression tests.

jahnavigajjala-3 avatar Oct 18 '26 15:10 jahnavigajjala-3

Opened #16742. /assign

amarkdotdev avatar Nov 03 '26 19:11 amarkdotdev