From 6a4ef266495f2160e65c44f4899cba06055b313e Mon Sep 17 00:00:00 2001 From: Matt Boersma Date: Tue, 6 Dec 2022 13:17:58 -0700 Subject: [PATCH] Update scaleset configuration params --- Tiltfile | 1 + azure/services/scalesets/scalesets.go | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Tiltfile b/Tiltfile index 2e3bfb78d09..ffb8f541b06 100644 --- a/Tiltfile +++ b/Tiltfile @@ -358,6 +358,7 @@ def deploy_worker_templates(template, substitutions): else: calico_values = "./templates/addons/calico/values.yaml" flavor_cmd += "; " + helm_cmd + " repo add projectcalico https://projectcalico.docs.tigera.io/charts; " + helm_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig install calico projectcalico/tigera-operator -f " + calico_values + " --namespace tigera-operator --create-namespace; kubectl --kubeconfig ./${CLUSTER_NAME}.kubeconfig apply -f ./templates/addons/calico/felix-override.yaml" + # TODO: remove extra config once the azure-cloud-provider Helm chart release support VMSS Flex. if "external-cloud-provider" in flavor_name or "flex" in flavor_name: flavor_cmd += "; " + helm_cmd + " --kubeconfig ./${CLUSTER_NAME}.kubeconfig install --repo https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/helm/repo cloud-provider-azure --generate-name --set infra.clusterName=${CLUSTER_NAME}" + \ " --set cloudControllerManager.imageRepository=selfhostedk8s.azurecr.io --set cloudControllerManager.imageTag=d8d65f1" + \ diff --git a/azure/services/scalesets/scalesets.go b/azure/services/scalesets/scalesets.go index dc20e55c485..8837a485cc0 100644 --- a/azure/services/scalesets/scalesets.go +++ b/azure/services/scalesets/scalesets.go @@ -454,6 +454,7 @@ func (s *Service) buildVMSSFromSpec(ctx context.Context, vmssSpec azure.ScaleSet return compute.VirtualMachineScaleSet{}, err } + orchestrationMode := getOrchestrationMode(s.Scope.ScaleSetSpec().OrchestrationMode) vmss := compute.VirtualMachineScaleSet{ Location: to.StringPtr(s.Scope.Location()), Sku: &compute.Sku{ @@ -464,11 +465,9 @@ func (s *Service) buildVMSSFromSpec(ctx context.Context, vmssSpec azure.ScaleSet Zones: to.StringSlicePtr(vmssSpec.FailureDomains), Plan: s.generateImagePlan(ctx), VirtualMachineScaleSetProperties: &compute.VirtualMachineScaleSetProperties{ - OrchestrationMode: getOrchestrationMode(s.Scope.ScaleSetSpec().OrchestrationMode), - Overprovision: to.BoolPtr(false), + OrchestrationMode: orchestrationMode, PlatformFaultDomainCount: to.Int32Ptr(platformFaultDomainCount), SinglePlacementGroup: to.BoolPtr(false), - UpgradePolicy: &compute.UpgradePolicy{Mode: compute.UpgradeModeManual}, VirtualMachineProfile: &compute.VirtualMachineScaleSetVMProfile{ OsProfile: osProfile, StorageProfile: storageProfile, @@ -479,7 +478,6 @@ func (s *Service) buildVMSSFromSpec(ctx context.Context, vmssSpec azure.ScaleSet }, }, NetworkProfile: &compute.VirtualMachineScaleSetNetworkProfile{ - // NetworkAPIVersion: compute.NetworkAPIVersionTwoZeroTwoZeroHyphenMinusOneOneHyphenMinusZeroOne, NetworkInterfaceConfigurations: &[]compute.VirtualMachineScaleSetNetworkConfiguration{ { Name: to.StringPtr(vmssSpec.Name), @@ -514,6 +512,15 @@ func (s *Service) buildVMSSFromSpec(ctx context.Context, vmssSpec azure.ScaleSet }, } + if orchestrationMode == compute.OrchestrationModeUniform { + vmss.VirtualMachineScaleSetProperties.Overprovision = to.BoolPtr(false) + vmss.VirtualMachineScaleSetProperties.UpgradePolicy = &compute.UpgradePolicy{Mode: compute.UpgradeModeManual} + } + if orchestrationMode == compute.OrchestrationModeFlexible { + vmss.VirtualMachineScaleSetProperties.VirtualMachineProfile.NetworkProfile.NetworkAPIVersion = + compute.NetworkAPIVersionTwoZeroTwoZeroHyphenMinusOneOneHyphenMinusZeroOne + } + // Assign Identity to VMSS if vmssSpec.Identity == infrav1.VMIdentitySystemAssigned { vmss.Identity = &compute.VirtualMachineScaleSetIdentity{