mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 18:54:06 +00:00
Merge pull request #26162 from jszczepkowski/kubectl-fix2
Automatic merge from submit-queue Fixed check in kubectl autoscale. ```release-note Fixed check in kubectl autoscale: cpu consumption can be higher than 100%. ``` []() Fixed check in kubectl autoscale: cpu consumption can be higher than 100%. Fixes #25815.
This commit is contained in:
commit
c805303644
@ -192,12 +192,9 @@ func RunAutoscale(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []
|
|||||||
|
|
||||||
func validateFlags(cmd *cobra.Command) error {
|
func validateFlags(cmd *cobra.Command) error {
|
||||||
errs := []error{}
|
errs := []error{}
|
||||||
max, min, cpu := cmdutil.GetFlagInt(cmd, "max"), cmdutil.GetFlagInt(cmd, "min"), cmdutil.GetFlagInt(cmd, "cpu-percent")
|
max, min := cmdutil.GetFlagInt(cmd, "max"), cmdutil.GetFlagInt(cmd, "min")
|
||||||
if max < 1 || max < min {
|
if max < 1 || max < min {
|
||||||
errs = append(errs, fmt.Errorf("--max=MAXPODS is required, and must be at least 1 and --min=MINPODS"))
|
errs = append(errs, fmt.Errorf("--max=MAXPODS is required, and must be at least 1 and --min=MINPODS"))
|
||||||
}
|
}
|
||||||
if cpu > 100 {
|
|
||||||
errs = append(errs, fmt.Errorf("CPU utilization (%%) cannot exceed 100"))
|
|
||||||
}
|
|
||||||
return utilerrors.NewAggregate(errs)
|
return utilerrors.NewAggregate(errs)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user