mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix(region): node pool instance min count
This commit is contained in:
@@ -63,9 +63,9 @@ type SKubeNodePool struct {
|
||||
NetworkIds *api.SKubeNetworkIds `list:"user" update:"user" create:"required"`
|
||||
InstanceTypes *api.SInstanceTypes `list:"user" update:"user" create:"required"`
|
||||
|
||||
MinInstanceCount int `nullable:"false" list:"user" create:"optional" default:"2"`
|
||||
MinInstanceCount int `nullable:"false" list:"user" create:"optional" default:"0"`
|
||||
MaxInstanceCount int `nullable:"false" list:"user" create:"optional" default:"2"`
|
||||
DesiredInstanceCount int `nullable:"false" list:"user" create:"optional" default:"2"`
|
||||
DesiredInstanceCount int `nullable:"false" list:"user" create:"optional" default:"0"`
|
||||
|
||||
RootDiskSizeGb int `nullable:"false" list:"user" create:"optional" default:"100"`
|
||||
|
||||
@@ -333,6 +333,15 @@ func (manager *SKubeNodePoolManager) ValidateCreateData(ctx context.Context, use
|
||||
}
|
||||
}
|
||||
|
||||
if input.DesiredInstanceCount > 0 {
|
||||
if input.MinInstanceCount > input.DesiredInstanceCount {
|
||||
return nil, httperrors.NewOutOfRangeError("min_instance_count must less or equal to desired_instance_count")
|
||||
}
|
||||
if input.MaxInstanceCount < input.DesiredInstanceCount {
|
||||
return nil, httperrors.NewOutOfRangeError("max_instance_count must greater than or equal to desired_instance_count")
|
||||
}
|
||||
}
|
||||
|
||||
region, err := cluster.GetRegion()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user