You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rework PodAutoscaler conditions to better fit K8s readiness model #8540
area/APIAPI objects and controllersarea/autoscalekind/bugCategorizes issue or PR as related to a bug.kind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.
Currently, the PodAutoscaler's readiness is determined by the Active condition. That means, that a PodAutoscaler of a revision that is scaled to 0 will be NotReady.
That creates a slew of problems to the system. Most importantly: This status propagates to the Revision, creating a race condition between PodAutoscaler and Revision readiness. If a revision fails to observe the PodAutoscaler while it's still being scaled up, it will never become ready as has been seen in #8539. This has also been pointed out in #5076.
Proposal
We should make PA's readiness not rely on its Active condition at all. Instead, we could piggyback on the work that has been done to determine HasBeenActive, which is a sticky state. I think we want the PA to remain ready after it has seen initialScale and/or minScale and only change that status explicitly if we need to.
As such, I'd propose this order of operations:
Propagate InitiallyActive from an annotation to a condition.
Remove Active from the set of conditions determining readiness.
Fight off all the dragons that I forgot in this naive proposal and make the system work again 😅.
In terms of migration, I think we want to keep the Active condition, but just drop it from the set of terminal conditions eventually and lower the severity to Info.
I remember arguing with @vagababov about conditions at some point, but it may have been the split of logic between SKS and KPA.
Either way, I'm game to at least try this. I think the main thing to think about is whether the change needs to be stages across a release, and if so what our logistics should be. I'd also like to land this early in a cycle in case we don't find all of 3. in presubmit or review.
We should probably list out the scenarios/interaction between the PodAutoscaler and the Revision and their conditions
As an example: I have a revision with minScale set, it's currently scaled to 0. Based on the changes above the Revision is 'Ready'. If I start scaling up do any conditions change?
Does the activator look at conditions when triggering the scale up?
I think the invariant we want to have is that the revision only becomes ready if the PA has been ready once. Which takes into account minscale and whatnot.
The Revision should not become unready, if the PA becomes Inactive, where Inactive means that there is no more traffic to it. We can still surface the active condition in the revision though, it's already an informative condition there. The PA should only become NotReady if there's really an issue there (i.e. the autoscaler breaks or whatnot). We don't have such a condition coded in at all currently though, which makes InitiallyReady (or HasBeenReady as it was actually named) a one way road currently.
@markusthoemmes , after reading more of the knative implementation and the above proposal , I want to confirm whether the proposal is suggesting to remove active from KPA's .status.condition completely. By removing this, whether kpa .status.condistion.ready output will be fixed?
I am asking this since currently we noticed that KPA .status.condition.lastTransition always changes ... Then it is very hard to measure when KPA has its initial ready during a performance test.
@cdlliuy no Active won't be dropped from conditions completely but rather be moved to be just informational. Check #8569 for a first step. The new condition would be exactly what you'd need to, as its time would be set exactly once, when stuff became ready. After this change the time on the Ready condition should be stable too.
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.
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/test-infra repository.
area/APIAPI objects and controllersarea/autoscalekind/bugCategorizes issue or PR as related to a bug.kind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.
Activity
markusthoemmes commentedon Jul 7, 2020
In terms of migration, I think we want to keep the Active condition, but just drop it from the set of terminal conditions eventually and lower the severity to Info.
mattmoor commentedon Jul 7, 2020
I remember arguing with @vagababov about conditions at some point, but it may have been the split of logic between SKS and KPA.
Either way, I'm game to at least try this. I think the main thing to think about is whether the change needs to be stages across a release, and if so what our logistics should be. I'd also like to land this early in a cycle in case we don't find all of
3.in presubmit or review./assign @dprotaso @vagababov @taragu
Would be good to get your eyeballs on this too.
dprotaso commentedon Jul 7, 2020
Does anything key off of the
Activecondition besides revisions?dprotaso commentedon Jul 7, 2020
We should probably list out the scenarios/interaction between the PodAutoscaler and the Revision and their conditions
As an example: I have a revision with minScale set, it's currently scaled to 0. Based on the changes above the Revision is 'Ready'. If I start scaling up do any conditions change?
Does the activator look at conditions when triggering the scale up?
markusthoemmes commentedon Jul 7, 2020
The activator doesn't care at all in this case.
I think the invariant we want to have is that the revision only becomes ready if the PA has been ready once. Which takes into account minscale and whatnot.
The Revision should not become unready, if the PA becomes Inactive, where Inactive means that there is no more traffic to it. We can still surface the active condition in the revision though, it's already an informative condition there. The PA should only become NotReady if there's really an issue there (i.e. the autoscaler breaks or whatnot). We don't have such a condition coded in at all currently though, which makes
InitiallyReady(orHasBeenReadyas it was actually named) a one way road currently.dprotaso commentedon Jul 7, 2020
So effectively the 'Ready' on revision means the machinery is in place to receive the request. Would we not want that for initialScale = 0 situations?
This was me asking whether activator waits for minScale (potentially indirectly by observing conditions) prior to sending requests
vagababov commentedon Jul 7, 2020
I think Revision should be ready if PA has been able to attain
initialScaleand that should be a sticky condition. Once reached, we're good.1 remaining item
cdlliuy commentedon Jul 8, 2020
@markusthoemmes , after reading more of the knative implementation and the above proposal , I want to confirm whether the proposal is suggesting to remove
activefrom KPA's .status.condition completely. By removing this, whether kpa .status.condistion.ready output will be fixed?I am asking this since currently we noticed that KPA .status.condition.lastTransition always changes ... Then it is very hard to measure when KPA has its initial ready during a performance test.
markusthoemmes commentedon Jul 8, 2020
@cdlliuy no Active won't be dropped from conditions completely but rather be moved to be just informational. Check #8569 for a first step. The new condition would be exactly what you'd need to, as its time would be set exactly once, when stuff became ready. After this change the time on the
Readycondition should be stable too.vagababov commentedon Jul 29, 2020
The SKS readiness is now its own condition and should be easier to deal with PA status.
github-actions commentedon Oct 29, 2020
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with
/reopen. Mark the issue asfresh by adding the comment
/remove-lifecycle stale.markusthoemmes commentedon Nov 24, 2020
/unassign
My work piece here is done.
dprotaso commentedon Nov 24, 2020
@markusthoemmes are there any relevant issues/PRs of yours to tag besides #8569 ?
markusthoemmes commentedon Nov 24, 2020
@dprotaso no, I think that's it.
vagababov commentedon Nov 24, 2020
I'd go as far as to just close this for now.
vagababov commentedon Nov 24, 2020
If any additional work we're going to do it should in scope of v1 API
evankanderson commentedon Mar 22, 2021
/close
knative-prow-robot commentedon Mar 22, 2021
@evankanderson: Closing this issue.
Details
In response to this:
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/test-infra repository.