Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#5055 from nojnhuh/aso-aks-nodes
Browse files Browse the repository at this point in the history
ASOAPI: truncate expected node label values at max length
  • Loading branch information
k8s-ci-robot authored Aug 5, 2024
2 parents c861d09 + a243992 commit 711d861
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions controllers/azureasomanagedmachinepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/utils/ptr"
infrav1alpha "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha1"
"sigs.k8s.io/cluster-api-provider-azure/pkg/mutators"
Expand Down Expand Up @@ -285,6 +286,12 @@ func (r *AzureASOManagedMachinePoolReconciler) reconcileNormal(ctx context.Conte
}

func expectedNodeLabels(poolName, nodeRG string) map[string]string {
if len(poolName) > validation.LabelValueMaxLength {
poolName = poolName[:validation.LabelValueMaxLength]
}
if len(nodeRG) > validation.LabelValueMaxLength {
nodeRG = nodeRG[:validation.LabelValueMaxLength]
}
return map[string]string{
"kubernetes.azure.com/agentpool": poolName,
"kubernetes.azure.com/cluster": nodeRG,
Expand Down

0 comments on commit 711d861

Please sign in to comment.