-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
🌱 MS: improve replica defaulting for autoscaler #9649
🌱 MS: improve replica defaulting for autoscaler #9649
Conversation
Welcome @aiden-von! |
Hi @aiden-von. Thanks for your PR. I'm waiting for a kubernetes-sigs 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. |
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.
Thanks!
/ok-to-test
/area machineset
cb12306
to
8d7ca40
Compare
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.
this generally makes sense to me and the code looks good.
my main concern is the replicas automatically getting set to minimum, but i think the documentation with this PR is good so, hopefully, users won't be too surprised.
/lgtm
LGTM label has been added. Git tree hash: 34ee03e67f19ed5cd7d97b7e1e1322cfa55bac1d
|
@killianmuldoon, @elmiko |
No worries you didn't miss anything. Just pretty busy recently so nobody got around to review the PR yet |
Thank you for being responsive @sbueringer :) |
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.
Just a few nits.
The replica calculation is a bit duplicate to the one for MD, but maybe it's easier to copy instead of refactoring to one generic func (so fine for me as is)
docs/book/src/tasks/automated-machine-management/autoscaling.md
Outdated
Show resolved
Hide resolved
88f3d1a
to
63c1ee1
Compare
In general looks good. Looks like the gci linter reports some findings: https://github.com/kubernetes-sigs/cluster-api/actions/runs/6944695786/job/18892668156
(you can try if make lint-fix just fixes them) Please also directly squash when you resolve these issues |
Thank you for review and fast responsive. |
/lgtm so far :) |
LGTM label has been added. Git tree hash: eaae21e402eb42ec8576f1be964159f478b8c268
|
// Notes: | ||
// - While the min size and max size annotations of the autoscaler provide the best UX, other autoscalers can use the | ||
// DefaultReplicasAnnotation if they have similar use cases. | ||
func calculateMachineSetReplicas(ctx context.Context, oldMS *clusterv1.MachineSet, newMS *clusterv1.MachineSet, dryRun bool) (int32, error) { |
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.
have we considered passing oldReplicas, newReplicas through the signature of this function instead of the machineSet resources and reuse it for both MD and MS? It seems the objects are only needed for if oldMD == nil { which would actually be the same code path than case oldMD.Spec.Replicas == nil:
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.
If we just use one generic function instead of duplicating I would prefer to pass in oldObject (or oldMDorMS) of type runtime.Object instead of merging the two code paths of oldMS == nil & oldMS.Spec.Replicas in the func
(Because those are actual different cases even if the result that we use minSize is the same and I think it would be better to have that logic clear in our code)
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.
ok cool, let's keep current implementation since it seems to have general lgtm and this code is unlikely to change often.
63c1ee1
to
addb065
Compare
@aiden-von: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
(failing apidiff job is fine, It's just surfacing a change to an exported type and I think this one is fine) |
/lgtm |
Thank you!! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbueringer 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 |
What this PR does / why we need it: MachineSet.spec.replicas defaulting should take into account autoscaler min/max size if defined. This PR applies the same default replicas policy of MD to MS.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #8085