diff --git a/pkg/cluster/internal/validate/azure.go b/pkg/cluster/internal/validate/azure.go index b09ac34573..e5309033af 100644 --- a/pkg/cluster/internal/validate/azure.go +++ b/pkg/cluster/internal/validate/azure.go @@ -225,17 +225,10 @@ func validateAKSVersion(spec commons.Spec, creds *azidentity.ClientSecretCredent func validateAKSNodes(workerNodes commons.WorkerNodes) error { var isLetter = regexp.MustCompile(`^[a-z0-9]+$`).MatchString - hasNodeSystem := false for _, node := range workerNodes { if !isLetter(node.Name) || len(node.Name) >= AKSMaxNodeNameLength { return errors.New("AKS node names must be " + strconv.Itoa(AKSMaxNodeNameLength) + " characters or less & contain only lowercase alphanumeric characters") } - if len(node.Taints) == 0 && !node.Spot { - hasNodeSystem = true - } - } - if !hasNodeSystem { - return errors.New("at least one worker node must be non-spot and without taints") } return nil } diff --git a/pkg/cluster/internal/validate/common.go b/pkg/cluster/internal/validate/common.go index e065391b45..615318446b 100644 --- a/pkg/cluster/internal/validate/common.go +++ b/pkg/cluster/internal/validate/common.go @@ -59,6 +59,9 @@ func validateWorkers(wn commons.WorkerNodes) error { if err := validateWorkersTaints(wn); err != nil { return err } + if err := validateWorkersType(wn); err != nil { + return err + } return nil } @@ -126,6 +129,19 @@ func validateWorkersTaints(wns commons.WorkerNodes) error { return nil } +func validateWorkersType(wns commons.WorkerNodes) error { + hasNodeSystem := false + for _, wn := range wns { + if len(wn.Taints) == 0 && !wn.Spot { + hasNodeSystem = true + } + } + if !hasNodeSystem { + return errors.New("at least one worker node must be non spot and without taints") + } + return nil +} + func validateVolumeType(t string, supportedTypes []string) error { if t != "" && !commons.Contains(supportedTypes, t) { return errors.New("unsupported type: " + t + ". Supported types: " + fmt.Sprint(strings.Join(supportedTypes, ", ")))