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

Add Load Balancer SKU name model config for Azure provider #10355

Merged
merged 1 commit into from
Jun 25, 2019

Conversation

timClicks
Copy link

@timClicks timClicks commented Jun 20, 2019

Juju 2.5 changed the default Azure Load Balancer SKU from Basic to Standard. Unfortunately, models created by Juju 2.4 get stuck when their controllers are upgraded.

This change introduces a model config parameter load-balancer-sku-name (name chosen to be consistent with the Azure SDK naming scheme) that allows for operators to select between Basic and Standard types. It also cleans up some of the internals of the Azure provider, which should make it friendlier to newcomers to the code.

QA steps

snap install juju # (if required)
snap switch juju channel=2.4/stable
/snap/juju/current/bin/juju bootstrap azure c-az
/snap/juju/current/bin/juju deploy ubuntu

(Assuming juju is this branch)

juju upgrade-model -m controller --build-agent
no prepackaged agent binaries available, using local agent binary 2.5.8.1 (built from source)
best version:
   2.5.8.1
started upgrade to 2.5.8.1
juju model-config -m controller load-balancer-sku-name=Basic
juju add-unit ubuntu

Documentation changes

Required. We need to document the new model config parameter.

Bug reference

@timClicks timClicks force-pushed the 2.5-azure-support-basic-sku branch from 78d092f to 74a2899 Compare June 20, 2019 20:42
@timClicks timClicks changed the base branch from develop to 2.5 June 21, 2019 00:08
@timClicks timClicks changed the title WIP Update Azure SKU names; support Load Balancer SKU name model config Add Load Balancer SKU name model config for Azure provider Jun 21, 2019
Copy link
Contributor

@babbageclunk babbageclunk left a comment

Choose a reason for hiding this comment

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

This looks great!

loadBalancerSkuName, ok := validated[configAttrLoadBalancerSkuName].(string)
if ok {
loadBalancerSkuNameTitle := strings.Title(loadBalancerSkuName)
if loadBalancerSkuName != loadBalancerSkuNameTitle {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice.

@@ -495,6 +495,7 @@ func (env *azureEnviron) StartInstance(ctx context.ProviderCallContext, args env
}
if seriesOS == os.Windows {
if instanceSpec.InstanceType.RootDisk < windowsMinRootDiskMB {
// TODO(tsm) add log message that the spec has been changed
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you still want to do this?

@@ -690,16 +689,20 @@ func (env *azureEnviron) createVirtualMachine(

publicIPAddressName := vmName + "-public-ip"
publicIPAddressId := fmt.Sprintf(`[resourceId('Microsoft.Network/publicIPAddresses', '%s')]`, publicIPAddressName)
publicIPAddressAllocationMethod := network.Static
if strings.ToLower(env.config.loadBalancerSkuName) == "basic" { // preserve the settings that were used in Juju 2.4 and earlier
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you're title-casing the setting when creating it, might make more sense to just compare to "Basic" here?

@@ -20,8 +20,6 @@ import (
"github.com/juju/juju/provider/common"
)

// Note: This provider/environment does *not* implement storage.
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean to remove this? It's still true - the root-disk-source setting is separate from the more general storage facilities.

Copy link
Author

Choose a reason for hiding this comment

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

Yes I did, but I'll revert.

func (s *configSuite) TestValidateInvalidLoadBalancerSkuName(c *gc.C) {
s.assertConfigInvalid(
c, testing.Attrs{"load-balancer-sku-name": "premium"},
`invalid load balancer SKU name "Premium", expected one of: \["Basic" "Standard"\]`,
Copy link
Contributor

Choose a reason for hiding this comment

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

does the case matter to the Azure end? Can we be more forgiving of case here?

Copy link
Author

Choose a reason for hiding this comment

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

We are. As you can see from the error message, we're transforming the input from "premium" to "Premium" on the user's behalf.

@timClicks timClicks force-pushed the 2.5-azure-support-basic-sku branch from 2a35fca to aa049a5 Compare June 24, 2019 22:49
@timClicks
Copy link
Author

$$merge$$

@timClicks
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants