Skip to content

Commit e05e77f

Browse files
authored
Fix scale to zero (for nodegroups) (#2310)
1 parent 3972a80 commit e05e77f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pkg/types/clusterconfig/cluster_config.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -908,10 +908,6 @@ func (cc *Config) validate(awsClient *aws.Client) error {
908908
ngNames := []string{}
909909
instances := []aws.InstanceTypeRequests{}
910910
for _, nodeGroup := range cc.NodeGroups {
911-
// setting max_instances to 0 during cluster creation is not permitted (but scaling max_instances to 0 afterwards is allowed)
912-
if nodeGroup.MaxInstances == 0 {
913-
return errors.Wrap(ErrorNodeGroupMaxInstancesIsZero(), NodeGroupsKey, nodeGroup.Name)
914-
}
915911
if !slices.HasString(ngNames, nodeGroup.Name) {
916912
ngNames = append(ngNames, nodeGroup.Name)
917913
} else {
@@ -1123,6 +1119,13 @@ func (cc *Config) ValidateOnInstall(awsClient *aws.Client) error {
11231119
return err
11241120
}
11251121

1122+
// setting max_instances to 0 during cluster creation is not permitted (but scaling max_instances to 0 afterwards is allowed)
1123+
for _, nodeGroup := range cc.NodeGroups {
1124+
if nodeGroup != nil && nodeGroup.MaxInstances == 0 {
1125+
return errors.Wrap(ErrorNodeGroupMaxInstancesIsZero(), NodeGroupsKey, nodeGroup.Name)
1126+
}
1127+
}
1128+
11261129
if cc.ClusterUID != "" {
11271130
return ErrorDisallowedField(ClusterUIDKey)
11281131
}

0 commit comments

Comments
 (0)