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

azure labels to skip in nodegroupset #6634

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cluster-autoscaler/processors/nodegroupset/azure_nodegroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ const AzureNodepoolLabel = "kubernetes.azure.com/agentpool"
// AzureDiskTopologyKey is the topology key of Azure Disk CSI driver
const AzureDiskTopologyKey = "topology.disk.csi.azure.com/zone"

// Those labels are added on the VMSS and shouldn't affect nodepool similarity
const aksEngineVersionLabel = "aksEngineVersion"
const creationSource = "creationSource"
const poolName = "poolName"
const resourceNameSuffix = "resourceNameSuffix"
const aksConsolidatedAdditionalProperties = "kubernetes.azure.com/consolidated-additional-properties"

// AKS node image version
const aksNodeImageVersion = "kubernetes.azure.com/node-image-version"

func nodesFromSameAzureNodePool(n1, n2 *schedulerframework.NodeInfo) bool {
n1AzureNodePool := n1.Node().Labels[AzureNodepoolLabel]
n2AzureNodePool := n2.Node().Labels[AzureNodepoolLabel]
Expand All @@ -53,6 +63,13 @@ func CreateAzureNodeInfoComparator(extraIgnoredLabels []string, ratioOpts config
azureIgnoredLabels[AzureNodepoolLegacyLabel] = true
azureIgnoredLabels[AzureNodepoolLabel] = true
azureIgnoredLabels[AzureDiskTopologyKey] = true
azureIgnoredLabels[aksEngineVersionLabel] = true
azureIgnoredLabels[creationSource] = true
azureIgnoredLabels[poolName] = true
azureIgnoredLabels[resourceNameSuffix] = true
azureIgnoredLabels[aksNodeImageVersion] = true
azureIgnoredLabels[aksConsolidatedAdditionalProperties] = true

for _, k := range extraIgnoredLabels {
azureIgnoredLabels[k] = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,27 @@ func TestIsAzureNodeInfoSimilar(t *testing.T) {
n1.ObjectMeta.Labels["agentpool"] = "foo"
n2.ObjectMeta.Labels["agentpool"] = "bar"
checkNodesSimilar(t, n1, n2, comparator, true)
// Different creationSource
n1.ObjectMeta.Labels["creationSource"] = "aks-aks-nodepool2-vmss"
n2.ObjectMeta.Labels["creationSource"] = "aks-aks-nodepool3-vmss"
checkNodesSimilar(t, n1, n2, comparator, true)
// Different node image version
n1.ObjectMeta.Labels["kubernetes.azure.com/node-image-version"] = "AKSUbuntu-1804gen2-2021.01.28"
n2.ObjectMeta.Labels["kubernetes.azure.com/node-image-version"] = "AKSUbuntu-1804gen2-2022.01.30"
checkNodesSimilar(t, n1, n2, comparator, true)
// Custom label
n1.ObjectMeta.Labels["example.com/ready"] = "true"
n2.ObjectMeta.Labels["example.com/ready"] = "false"
checkNodesSimilar(t, n1, n2, comparator, true)
// One node with aksConsolidatedAdditionalProperties label
n1.ObjectMeta.Labels[aksConsolidatedAdditionalProperties] = "foo"
checkNodesSimilar(t, n1, n2, comparator, true)
// Same aksConsolidatedAdditionalProperties
n2.ObjectMeta.Labels[aksConsolidatedAdditionalProperties] = "foo"
checkNodesSimilar(t, n1, n2, comparator, true)
// Different aksConsolidatedAdditionalProperties label
n2.ObjectMeta.Labels[aksConsolidatedAdditionalProperties] = "bar"
checkNodesSimilar(t, n1, n2, comparator, true)
}

func TestFindSimilarNodeGroupsAzureBasic(t *testing.T) {
Expand Down
Loading