Skip to content
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

implement GetOptions for Azure #4237

Merged
merged 1 commit into from
Aug 24, 2021

Conversation

bpineau
Copy link
Contributor

@bpineau bpineau commented Aug 3, 2021

Support per-VMSS (scaledown) settings as exposed by the cloudprovider's interface GetOptions() method.

For ref, providing similar GetOptions support for other providers:

@k8s-ci-robot k8s-ci-robot requested review from feiskyer and nilo19 August 3, 2021 16:16
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 3, 2021
@bpineau bpineau marked this pull request as draft August 19, 2021 13:22
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 19, 2021
@bpineau
Copy link
Contributor Author

bpineau commented Aug 19, 2021

Converted to draft until the corresponding GCE pull request gets in, so I can backport improvement suggested during GCE review there, and use global symbols defined in that other PR.

@bpineau bpineau force-pushed the autoscaling-options-azure branch from 31b82cf to 7c46e5c Compare August 23, 2021 21:10
@bpineau bpineau marked this pull request as ready for review August 23, 2021 21:12
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 23, 2021
@bpineau
Copy link
Contributor Author

bpineau commented Aug 23, 2021

Updated with feedback and constants from the GCE equivalent PR, ready for review.
/assign @marwanad

Copy link
Member

@marwanad marwanad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just a small comment and a question

@@ -246,6 +247,29 @@ func (m *AzureManager) GetNodeGroupForInstance(instance *azureRef) (cloudprovide
return m.azureCache.FindForInstance(instance, m.config.VMType)
}

// GetScaleSetOptions parse options extracted from VMSS tags and merges them with provided defaults
func (m *AzureManager) GetScaleSetOptions(scaleSetName string, defaults config.NodeGroupAutoscalingOptions) *config.NodeGroupAutoscalingOptions {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we propagate an error back from here? How are you handling those errors for other cloudprovider implementations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intent is not to impact operations on errors, but make them visible and auditable. Missing options tags is just fine (and likely). Likewise for incomplete/partial tags set. We log and ignore bogus (or similar-looking yet different, etc) tag values. That's similar for aws and gce cloudproviders.

if !reflect.DeepEqual(m.getAutoscalingOptions(ref), options) {
klog.V(4).Infof("Extracted autoscaling options from %q ScaleSet tags: %v", *vmss.Name, options)
}
newAutoscalingOptions[ref] = options
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should this be done in the above if check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're rebuilding that option cache from scratch (newAutoscalingOptions is empty before that loop) so we have to store both changed and previously known options there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh gotcha

@bpineau bpineau force-pushed the autoscaling-options-azure branch from 7c46e5c to 4b0d5f7 Compare August 24, 2021 07:45
Support per-VMSS (scaledown) settings as permited by the
cloudprovider's interface `GetOptions()` method.
@bpineau bpineau force-pushed the autoscaling-options-azure branch from 4b0d5f7 to 28cd49c Compare August 24, 2021 07:49
@marwanad
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 24, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bpineau, marwanad

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 24, 2021
@k8s-ci-robot k8s-ci-robot merged commit a498045 into kubernetes:master Aug 24, 2021
drmorr0 pushed a commit to airbnb/autoscaler that referenced this pull request Sep 1, 2021
drmorr0 pushed a commit to airbnb/autoscaler that referenced this pull request Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants