This repository was archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 546
fix(defaults): Checks for set backoff and rate limit values #3890
Closed
thomastaylor312
wants to merge
1
commit into
Azure:master
from
thomastaylor312:fix/hardcoded_defaults
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -351,30 +351,33 @@ func setOrchestratorDefaults(cs *api.ContainerService, isUpdate bool) { | |
| o.KubernetesConfig.ServiceCIDR = DefaultKubernetesServiceCIDR | ||
| } | ||
| // Enforce sane cloudprovider backoff defaults, if CloudProviderBackoff is true in KubernetesConfig | ||
| o.KubernetesConfig.CloudProviderBackoff = true | ||
| if o.KubernetesConfig.CloudProviderBackoffDuration == 0 { | ||
| o.KubernetesConfig.CloudProviderBackoffDuration = DefaultKubernetesCloudProviderBackoffDuration | ||
| } | ||
| if o.KubernetesConfig.CloudProviderBackoffExponent == 0 { | ||
| o.KubernetesConfig.CloudProviderBackoffExponent = DefaultKubernetesCloudProviderBackoffExponent | ||
| } | ||
| if o.KubernetesConfig.CloudProviderBackoffJitter == 0 { | ||
| o.KubernetesConfig.CloudProviderBackoffJitter = DefaultKubernetesCloudProviderBackoffJitter | ||
| } | ||
| if o.KubernetesConfig.CloudProviderBackoffRetries == 0 { | ||
| o.KubernetesConfig.CloudProviderBackoffRetries = DefaultKubernetesCloudProviderBackoffRetries | ||
| if o.KubernetesConfig.CloudProviderBackoff { | ||
| if o.KubernetesConfig.CloudProviderBackoffDuration == 0 { | ||
| o.KubernetesConfig.CloudProviderBackoffDuration = DefaultKubernetesCloudProviderBackoffDuration | ||
| } | ||
| if o.KubernetesConfig.CloudProviderBackoffExponent == 0 { | ||
| o.KubernetesConfig.CloudProviderBackoffExponent = DefaultKubernetesCloudProviderBackoffExponent | ||
| } | ||
| if o.KubernetesConfig.CloudProviderBackoffJitter == 0 { | ||
| o.KubernetesConfig.CloudProviderBackoffJitter = DefaultKubernetesCloudProviderBackoffJitter | ||
| } | ||
| if o.KubernetesConfig.CloudProviderBackoffRetries == 0 { | ||
| o.KubernetesConfig.CloudProviderBackoffRetries = DefaultKubernetesCloudProviderBackoffRetries | ||
| } | ||
| } | ||
|
|
||
| k8sSemVer, _ := semver.Make(k8sVersion) | ||
| minVersion, _ := semver.Make("1.6.6") | ||
| // Enforce sane cloudprovider rate limit defaults, if CloudProviderRateLimit is true in KubernetesConfig | ||
| // For k8s version greater or equal to 1.6.6, we will set the default CloudProviderRate* settings | ||
| o.KubernetesConfig.CloudProviderRateLimit = true | ||
| if o.KubernetesConfig.CloudProviderRateLimit && k8sSemVer.GTE(minVersion) { | ||
| if o.KubernetesConfig.CloudProviderRateLimitQPS == 0 { | ||
| o.KubernetesConfig.CloudProviderRateLimitQPS = DefaultKubernetesCloudProviderRateLimitQPS | ||
| } | ||
| if o.KubernetesConfig.CloudProviderRateLimitBucket == 0 { | ||
| o.KubernetesConfig.CloudProviderRateLimitBucket = DefaultKubernetesCloudProviderRateLimitBucket | ||
| if o.KubernetesConfig.CloudProviderRateLimit && k8sSemVer.GTE(minVersion) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question with |
||
| if o.KubernetesConfig.CloudProviderRateLimitQPS == 0 { | ||
| o.KubernetesConfig.CloudProviderRateLimitQPS = DefaultKubernetesCloudProviderRateLimitQPS | ||
| } | ||
| if o.KubernetesConfig.CloudProviderRateLimitBucket == 0 { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we have a helper method to get the values for these? The helper method would return a default value is the said field has nil or its equivalent as its value.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These were pre-existing. I do think that would be a good idea though. |
||
| o.KubernetesConfig.CloudProviderRateLimitBucket = DefaultKubernetesCloudProviderRateLimitBucket | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
where is the default for CloudProviderBackoff being set if it's 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.
It is a bool, so the zero value is
falseThere 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.
IMO we should still set it to the default constant https://github.com/Azure/acs-engine/blob/master/pkg/acsengine/const.go#L82 in case we ever decide to change that default
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 agree, but that probably shouldn't be set here. It could be the user has set it to
falseor that it defaulted tofalse