Added hpa/v1 generator to kubectl autoscale
This commit is contained in:
@@ -25,10 +25,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
)
|
||||
|
||||
const (
|
||||
scaleSubResource = "scale"
|
||||
)
|
||||
|
||||
type HorizontalPodAutoscalerV1Beta1 struct{}
|
||||
|
||||
func (HorizontalPodAutoscalerV1Beta1) ParamNames() []GeneratorParam {
|
||||
@@ -46,6 +42,29 @@ func (HorizontalPodAutoscalerV1Beta1) ParamNames() []GeneratorParam {
|
||||
}
|
||||
|
||||
func (HorizontalPodAutoscalerV1Beta1) Generate(genericParams map[string]interface{}) (runtime.Object, error) {
|
||||
return generateHPA(genericParams)
|
||||
}
|
||||
|
||||
type HorizontalPodAutoscalerV1 struct{}
|
||||
|
||||
func (HorizontalPodAutoscalerV1) ParamNames() []GeneratorParam {
|
||||
return []GeneratorParam{
|
||||
{"default-name", true},
|
||||
{"name", false},
|
||||
{"scaleRef-kind", false},
|
||||
{"scaleRef-name", false},
|
||||
{"scaleRef-apiVersion", false},
|
||||
{"min", false},
|
||||
{"max", true},
|
||||
{"cpu-percent", false},
|
||||
}
|
||||
}
|
||||
|
||||
func (HorizontalPodAutoscalerV1) Generate(genericParams map[string]interface{}) (runtime.Object, error) {
|
||||
return generateHPA(genericParams)
|
||||
}
|
||||
|
||||
func generateHPA(genericParams map[string]interface{}) (runtime.Object, error) {
|
||||
params := map[string]string{}
|
||||
for key, value := range genericParams {
|
||||
strVal, isString := value.(string)
|
||||
|
Reference in New Issue
Block a user