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:
Sanket Sudake
2022-05-09 17:16:34 +05:30
committed by GitHub
parent 925f817e42
commit 39dd65b224
13 changed files with 496 additions and 77 deletions
+15 -2
View File
@@ -22,6 +22,7 @@ limitations under the License.
package v1
import (
v2beta2 "k8s.io/api/autoscaling/v2beta2"
corev1 "k8s.io/api/core/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@@ -313,6 +314,18 @@ func (in *EnvironmentSpec) DeepCopy() *EnvironmentSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExecutionStrategy) DeepCopyInto(out *ExecutionStrategy) {
*out = *in
if in.Metrics != nil {
in, out := &in.Metrics, &out.Metrics
*out = make([]v2beta2.MetricSpec, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Behavior != nil {
in, out := &in.Behavior, &out.Behavior
*out = new(v2beta2.HorizontalPodAutoscalerBehavior)
(*in).DeepCopyInto(*out)
}
return
}
@@ -442,7 +455,7 @@ func (in *FunctionSpec) DeepCopyInto(out *FunctionSpec) {
copy(*out, *in)
}
in.Resources.DeepCopyInto(&out.Resources)
out.InvokeStrategy = in.InvokeStrategy
in.InvokeStrategy.DeepCopyInto(&out.InvokeStrategy)
if in.IdleTimeout != nil {
in, out := &in.IdleTimeout, &out.IdleTimeout
*out = new(int)
@@ -580,7 +593,7 @@ func (in *IngressConfig) DeepCopy() *IngressConfig {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *InvokeStrategy) DeepCopyInto(out *InvokeStrategy) {
*out = *in
out.ExecutionStrategy = in.ExecutionStrategy
in.ExecutionStrategy.DeepCopyInto(&out.ExecutionStrategy)
return
}