Add support for custom metrics for HPA (#2423)
* Add support for custom metrics for HPA * Cleanup TargetCPUPercent references from possible places * HPA v2beta has 80% default cpu limit if not set Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@@ -270,7 +271,7 @@ func (spec FunctionSpec) Validate() error {
|
||||
result = multierror.Append(result, c.Validate())
|
||||
}
|
||||
|
||||
if spec.InvokeStrategy != (InvokeStrategy{}) {
|
||||
if !reflect.DeepEqual(spec.InvokeStrategy, InvokeStrategy{}) {
|
||||
result = multierror.Append(result, spec.InvokeStrategy.Validate())
|
||||
}
|
||||
|
||||
@@ -309,7 +310,7 @@ func (es ExecutionStrategy) Validate() error {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorUnsupportedType, "ExecutionStrategy.ExecutorType", es.ExecutorType, "not a valid executor type"))
|
||||
}
|
||||
|
||||
if es.ExecutorType == ExecutorTypeNewdeploy {
|
||||
if es.ExecutorType == ExecutorTypeNewdeploy || es.ExecutorType == ExecutorTypeContainer {
|
||||
if es.MinScale < 0 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.MinScale", es.MinScale, "minimum scale must be greater than or equal to 0"))
|
||||
}
|
||||
@@ -322,7 +323,7 @@ func (es ExecutionStrategy) Validate() error {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.MaxScale", es.MaxScale, "maximum scale must be greater than or equal to minimum scale"))
|
||||
}
|
||||
|
||||
if es.TargetCPUPercent <= 0 || es.TargetCPUPercent > 100 {
|
||||
if es.TargetCPUPercent < 0 || es.TargetCPUPercent > 100 {
|
||||
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, "ExecutionStrategy.TargetCPUPercent", es.TargetCPUPercent, "TargetCPUPercent must be a value between 1 - 100"))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user