-
Notifications
You must be signed in to change notification settings - Fork 52
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
[Do not merge] alternative approach to clear state when not leader anymore #75
Conversation
@@ -71,6 +71,7 @@ func (r *Autoscaler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu | |||
} | |||
|
|||
func (a *Autoscaler) Start() { | |||
a.LeaderElection.AfterOnStoppedLeading(a.Deployments.StopScalers) |
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.
cleanup desired scale and downscale when instance is not leader anymore
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 think this would break scale from 0 in the proxy which should still be possible
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 think this would break the h.Deployments.AtLeastOne(deploy)
call in the proxies that are not a leader.
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.
nvm it won't break that since it's a different flow. Currently all stop does is to stop the scale down timer.
s.scaleDownStarted = false // mark completed already | ||
desiredScale, currentScale := s.desiredScale, s.currentScale | ||
s.mtx.Unlock() | ||
if desiredScale == -1 || desiredScale == currentScale { |
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.
s.desiredScale could only be -1
right after initialization right? because there is this if earlier in scaler:
if current != -1 {
s.currentScale = current
}
if desired != -1 {
s.desiredScale = desired
}
asking to improve my understanding, this is not feedback to your code or a request for any changes
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.
changes make sense overall except stopping all scalers, I think that would break the h.Deployments.AtLeastOne(deploy)
call in the proxies that are not a leader.
will include this in #76 |
Based on #70
The autoscaler registers a callback on the elector when to stop scalers when not leader anymore.
This PR also contains changes to the scaler from #74