Skip to content

Commit

Permalink
ignore azure csi topology label for similarity checks and populate it…
Browse files Browse the repository at this point in the history
… for scale from zero
  • Loading branch information
marwanad committed Dec 21, 2021
1 parent 259c1ac commit 2656992
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cluster-autoscaler/cloudprovider/azure/azure_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import (
"time"
)

const azureDiskTopologyKey string = "topology.disk.csi.azure.com/zone"

func buildInstanceOS(template compute.VirtualMachineScaleSet) string {
instanceOS := cloudprovider.DefaultOS
if template.VirtualMachineProfile != nil && template.VirtualMachineProfile.OsProfile != nil && template.VirtualMachineProfile.OsProfile.WindowsConfiguration != nil {
Expand All @@ -58,8 +60,10 @@ func buildGenericLabels(template compute.VirtualMachineScaleSet, nodeName string
}

result[apiv1.LabelTopologyZone] = strings.Join(failureDomains[:], cloudvolume.LabelMultiZoneDelimiter)
result[azureDiskTopologyKey] = strings.Join(failureDomains[:], cloudvolume.LabelMultiZoneDelimiter)
} else {
result[apiv1.LabelTopologyZone] = "0"
result[azureDiskTopologyKey] = ""
}

result[apiv1.LabelHostname] = nodeName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const AzureNodepoolLegacyLabel = "agentpool"
// AzureNodepoolLabel is an AKS label specifying which nodepool a particular node belongs to
const AzureNodepoolLabel = "kubernetes.azure.com/agentpool"

// AzureDiskTopologyKey is the topology key of Azure Disk CSI driver
const AzureDiskTopologyKey = "topology.disk.csi.azure.com/zone"

func nodesFromSameAzureNodePool(n1, n2 *schedulerframework.NodeInfo) bool {
n1AzureNodePool := n1.Node().Labels[AzureNodepoolLabel]
n2AzureNodePool := n2.Node().Labels[AzureNodepoolLabel]
Expand All @@ -48,6 +51,7 @@ func CreateAzureNodeInfoComparator(extraIgnoredLabels []string) NodeInfoComparat
}
azureIgnoredLabels[AzureNodepoolLegacyLabel] = true
azureIgnoredLabels[AzureNodepoolLabel] = true
azureIgnoredLabels[AzureDiskTopologyKey] = true
for _, k := range extraIgnoredLabels {
azureIgnoredLabels[k] = true
}
Expand Down

0 comments on commit 2656992

Please sign in to comment.