-
Notifications
You must be signed in to change notification settings - Fork 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
Default min/max sizes for Azure VMSSs #6863
Conversation
Hi @rrangith. Thanks for your PR. I'm waiting for a kubernetes 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-sigs/prow repository. |
/assign @jackfrancis @feiskyer I presented this at the SIG Autoscaling meeting and they suggested I reach out to you. Can I please get a review? |
@@ -327,6 +329,8 @@ func (m *AzureManager) getFilteredScaleSets(filter []labelAutoDiscoveryConfig) ( | |||
klog.Warningf("ignoring vmss %q because of invalid minimum size specified for vmss: %s", *scaleSet.Name, err) | |||
continue | |||
} | |||
} else if cfgMinSize >= 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.
Should we invert the precedence here and have the previous min/max foo (scaleSet.Tags["min"]
and scaleSet.Tags["max"]
have the higher assignment precedence? I think that might be a better back-compat story.
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'm not sure I follow. We will read scaleSet.Tags["min"]
(which is the current behaviour), and then else if
that is not defined, we will check to see if there is a default cfgMinSize
(new behaviour), and then if neither are defined we will ignore the vmss (current behaviour).
So if a default is not specified, then the current behaviour will be maintained. And the explicit tags will always be given the higher assignment precedence since even if the default is specified, we will still use the the explicit tag value
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.
Ah yes my bad, thanks!
func matchDiscoveryConfig(labels map[string]*string, configs []labelAutoDiscoveryConfig) bool { | ||
// returns true if the VMSS's tags match the autodiscovery configs | ||
// if there are multiple min/max sizes defined, return the highest min value and the lowest max value | ||
func matchDiscoveryConfig(labels map[string]*string, configs []labelAutoDiscoveryConfig) (bool, int, int) { |
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 func (and the caller flow is starting to get a little opaque...)
Would returning a struct make this a bit more readable from the consumer side and make the func more maintainable? Is there a good chance that the configs we grab out of this will never grow beyond min + max?
(Love the new UT cases though!)
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.
sure I can change that to a struct!
/ok-to-test |
/retest-required |
/retest |
@rrangith have you built images from these source changes and tested in an Azure environment? I'm confident the E2E failures are not related to this PR, but would like to get some coverage before landing this. |
@jackfrancis yes, I built an image including these changes and tested in an environment. I confirmed that when you don't specify a default min/max the behaviour stays the same. And then when I defined a default min/max I confirmed that now VMSSs missing an explicit min/max tag were now considered and used the default. I also confirmed that the explicit min/max tag would take precedence over the default value |
return a struct
c938b65
to
333d438
Compare
@rrangith: 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-sigs/prow repository. I understand the commands that are listed here. |
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
/approve
Thank you @rrangith!
/retest |
Thanks for this, changes outside of the Azure cloudprovider implementation all look good to me. /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gjtempleton, jackfrancis, rrangith 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 type of PR is this?
/kind feature
What this PR does / why we need it:
Currently the autoscaler will ignore a VMSS if no min/max size is provided. This PR changes the behaviour so it will instead default to a
min
andmax
as part of the autodiscovery tags, similar to how GCP does itautoscaler/cluster-autoscaler/main.go
Line 182 in cf606a1
min
andmax
are optional for Azure and used as default values if a VMSS is missing itsmin
/max
tagsAzure has a limit of 50 tags per resource https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources#limitations. This change will allow people to save 2 tag spaces
What does this PR do
We will read scaleSet.Tags["min"] (which is the current behaviour), and then else if that is not defined, we will check to see if there is a default minSize (new behaviour), and then if neither are defined we will ignore the vmss (current behaviour).
So if a default is not specified, then the current behaviour will be maintained. And the explicit min/max tags will always be given the higher assignment precedence since even if the default is specified, we will still use the the explicit tag value
Testing
I built an image including these changes and tested in an environment. I confirmed that when you don't specify a default min/max the behaviour stays the same. And then when I defined a default min/max I confirmed that now VMSSs missing an explicit min/max tag were now considered and used the default. I also confirmed that the explicit min/max tag would take precedence over the default value
Which issue(s) this PR fixes:
Fixes #6864
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: