Skip to content

Commit

Permalink
Update scaleset configuration params
Browse files Browse the repository at this point in the history
  • Loading branch information
mboersma committed Dec 6, 2022
1 parent 21fa5ec commit 6a4ef26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" + \
Expand Down
15 changes: 11 additions & 4 deletions azure/services/scalesets/scalesets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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,
Expand All @@ -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),
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 6a4ef26

Please sign in to comment.