Skip to content

Commit

Permalink
Merge pull request kubernetes#6634 from gandhipr/prachigandhi/azure-i…
Browse files Browse the repository at this point in the history
…gnore-nodegroupset

azure labels to skip in nodegroupset
  • Loading branch information
k8s-ci-robot committed Jun 7, 2024
2 parents bd8153b + 96c7948 commit 83db225
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
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

0 comments on commit 83db225

Please sign in to comment.