-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent a PodAutoscaler's DesiredScale to turn to -1 #14866
Prevent a PodAutoscaler's DesiredScale to turn to -1 #14866
Conversation
Hi @SaschaSchwarze0. 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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
It seems that the failing test |
Yep, now that I don't have this change guarded by a flag anymore, I have to look at the results of all unit tests. Will check. |
e3f5c11
to
e3d76a8
Compare
I changed the test case. It was actually running into that code path where there are no metrics and now that means that it keeps the desiredScale rather than setting it to -1. |
/easycla |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #14866 +/- ##
==========================================
+ Coverage 84.02% 84.05% +0.03%
==========================================
Files 213 213
Lines 16796 16803 +7
==========================================
+ Hits 14112 14124 +12
+ Misses 2329 2323 -6
- Partials 355 356 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
I've been reviewing #14607 & #14573 which address bugs in the same part of the codebase as this PR. Those PRs fix the problem but they would introduce regressions if merged as is - so it's not solved yet. I'm creating e2e tests to catch these regressions - it would be good to run them against this PR when they land. It sorta feels like there might a 'holistic' solution for those PRs where we want to distinguish "I have no data for this revision" and "I have no data for this revision and I haven't tried to sample any" The latter scenario sounds seems to match what this PR is trying to fix. I'm going to hold this PR for now until I wrap up the other reviews and the e2e tests /hold |
@dprotaso can you give an update where we are standing here ? |
// later back to the correct value. The following condition omits this. | ||
if pc.want > -1 || pa.Status.DesiredScale == nil || *pa.Status.DesiredScale < 0 { | ||
pa.Status.DesiredScale = ptr.Int32(int32(pc.want)) | ||
} else { | ||
logger.Debugf("Ignoring change of desiredScale from %d to %d", *pa.Status.DesiredScale, pc.want) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any thoughts on flipping the condition and the blocks around?
I found it easier to reason about this code when I realized the else
condition is
pc.want == -1 && pa.Status.DesiredScale != nil && pa.Status.DesiredScale >= 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand it both ways. 8-) Changed it.
@@ -219,7 +219,15 @@ func (c *Reconciler) reconcileDecider(ctx context.Context, pa *autoscalingv1alph | |||
} | |||
|
|||
func computeStatus(ctx context.Context, pa *autoscalingv1alpha1.PodAutoscaler, pc podCounts, logger *zap.SugaredLogger) { | |||
pa.Status.DesiredScale, pa.Status.ActualScale = ptr.Int32(int32(pc.want)), ptr.Int32(int32(pc.ready)) | |||
pa.Status.ActualScale = ptr.Int32(int32(pc.ready)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering why ActualScale
is different then I saw we are deriving this number from querying the informer cache which is sync'd at startup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, that value is never incorrect.
e3d76a8
to
d08cde0
Compare
/hold cancel |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, SaschaSchwarze0 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
linter failed - I just updated the PR to use the right /lgtm |
kourier-tls flakes - #15052 |
Fixes #14669
Proposed Changes
Release Note