From 4bbc3ba7b1c93a23602aac570d2fd4d0a17a634b Mon Sep 17 00:00:00 2001 From: "yarntime@163.com" Date: Thu, 1 Dec 2016 16:09:05 +0800 Subject: [PATCH] check the value of min and max --- pkg/kubectl/autoscale.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/kubectl/autoscale.go b/pkg/kubectl/autoscale.go index 6e5f5a24e688a..2e266810cef59 100644 --- a/pkg/kubectl/autoscale.go +++ b/pkg/kubectl/autoscale.go @@ -97,6 +97,11 @@ func generateHPA(genericParams map[string]interface{}) (runtime.Object, error) { if err != nil { return nil, err } + + if min > max { + return nil, fmt.Errorf("'max' must be greater than or equal to 'min'.") + } + cpuString, found := params["cpu-percent"] cpu := -1 if found {