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:
PingWang 2016-08-12 16:19:48 +08:00
parent 431e7ce1ab
commit bc3b74a499

View File

@ -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)
}