Skip to content

Commit c0579af

Browse files
author
k8s-merge-robot
authored
Merge pull request kubernetes#27844 from hodovska/1336632-hpa_flag_tips
Automatic merge from submit-queue kubectl/autoscale: fix tips when validating --max flag While autoscaling, it was not clear what was the reason of failed --max flag validation. This fix divides reasons to: - value not provided or too low - value of max is lower than value of min bug 1336632 Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1336632
2 parents f78da7c + 59db75f commit c0579af

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: pkg/kubectl/cmd/autoscale.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,10 @@ func RunAutoscale(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []
197197
func validateFlags(cmd *cobra.Command) error {
198198
errs := []error{}
199199
max, min := cmdutil.GetFlagInt(cmd, "max"), cmdutil.GetFlagInt(cmd, "min")
200-
if max < 1 || max < min {
201-
errs = append(errs, fmt.Errorf("--max=MAXPODS is required, and must be at least 1 and --min=MINPODS"))
200+
if max < 1 {
201+
errs = append(errs, fmt.Errorf("--max=MAXPODS is required and must be at least 1"))
202+
} else if max < min {
203+
errs = append(errs, fmt.Errorf("--max=MAXPODS must be larger or equal to --min=MINPODS"))
202204
}
203205
return utilerrors.NewAggregate(errs)
204206
}

0 commit comments

Comments
 (0)