From a67b884cb3d0eb0a62140096de11f0986cf3a20f Mon Sep 17 00:00:00 2001 From: Francisco Augusto Date: Mon, 11 Sep 2023 15:03:48 +0200 Subject: [PATCH] Change unbalance validation (#277) * Change unbalance logic * Clean code * Clean code * Add validation * Fix validation --------- Co-authored-by: stg <65890694+stg-0@users.noreply.github.com> --- pkg/cluster/internal/validate/common.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/cluster/internal/validate/common.go b/pkg/cluster/internal/validate/common.go index 252b39c2b0..770f821131 100644 --- a/pkg/cluster/internal/validate/common.go +++ b/pkg/cluster/internal/validate/common.go @@ -109,12 +109,12 @@ func validateWorkersQuantity(workerNodes commons.WorkerNodes) error { if wn.NodeGroupMinSize < 0 { return errors.New("min_size in WorkerNodes " + wn.Name + ", must be equal or greater than 0") } - if wn.ZoneDistribution == "balanced" || wn.ZoneDistribution == "" { - if wn.AZ != "" { - return errors.New("az in WorkerNodes " + wn.Name + ", can not be set when HA is required") - } + if wn.AZ != "" && wn.ZoneDistribution != "" { + return errors.New("az and zone_distribution cannot be used at the same time") + } + if wn.ZoneDistribution == "balanced" || (wn.ZoneDistribution == "" && wn.AZ == "") { if wn.Quantity < 3 { - return errors.New("quantity in WorkerNodes " + wn.Name + ", must be equal or greater than 3 when HA is required") + return errors.New("quantity in WorkerNodes " + wn.Name + ", must be equal or greater than 3 when zone_distribution is balanced (default)") } } }