mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Add validation conditions for autoscale
Signed-off-by: PingWang <wang.ping5@zte.com.cn> delete --min judgment Signed-off-by: PingWang <wang.ping5@zte.com.cn>
This commit is contained in:
parent
431e7ce1ab
commit
bc3b74a499
@ -198,9 +198,10 @@ func validateFlags(cmd *cobra.Command) error {
|
||||
errs := []error{}
|
||||
max, min := cmdutil.GetFlagInt(cmd, "max"), cmdutil.GetFlagInt(cmd, "min")
|
||||
if max < 1 {
|
||||
errs = append(errs, fmt.Errorf("--max=MAXPODS is required and must be at least 1"))
|
||||
} else if max < min {
|
||||
errs = append(errs, fmt.Errorf("--max=MAXPODS must be larger or equal to --min=MINPODS"))
|
||||
errs = append(errs, fmt.Errorf("--max=MAXPODS is required and must be at least 1, max: %d", max))
|
||||
}
|
||||
if max < min {
|
||||
errs = append(errs, fmt.Errorf("--max=MAXPODS must be larger or equal to --min=MINPODS, max: %d, min: %d", max, min))
|
||||
}
|
||||
return utilerrors.NewAggregate(errs)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user