Skip to content

Commit

Permalink
Change unbalance validation (kubernetes-sigs#277)
Browse files Browse the repository at this point in the history
* Change unbalance logic

* Clean code

* Clean code

* Add validation

* Fix validation

---------

Co-authored-by: stg <[email protected]>
  • Loading branch information
kahun and stg-0 authored Sep 11, 2023
1 parent 6d4999f commit a67b884
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/cluster/internal/validate/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
}
}
}
Expand Down

0 comments on commit a67b884

Please sign in to comment.