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
+19 -4
View File
@@ -17,6 +17,7 @@ limitations under the License.
package v1
import (
asv2beta2 "k8s.io/api/autoscaling/v2beta2"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -459,22 +460,36 @@ type (
// +optional
ExecutorType ExecutorType `json:"ExecutorType"`
// +optional
// This is only for newdeploy to set up minimum replicas of deployment.
// +optional
MinScale int `json:"MinScale"`
// +optional
// This is only for newdeploy to set up maximum replicas of deployment.
// +optional
MaxScale int `json:"MaxScale"`
// Deprecated: use hpaMetrics instead.
// This is only for executor type newdeploy and container to set up target CPU utilization of HPA.
// Applicable for executor type newdeploy and container.
// +optional
// This is only for newdeploy to set up target CPU utilization of HPA.
TargetCPUPercent int `json:"TargetCPUPercent"`
// +optional
// This is the timeout setting for executor to wait for pod specialization.
// +optional
SpecializationTimeout int `json:"SpecializationTimeout"`
// hpaMetrics is the list of metrics used to determine the desired replica count of the Deployment
// created for the function.
// Applicable for executor type newdeploy and container.
// +optional
Metrics []asv2beta2.MetricSpec `json:"hpaMetrics,omitempty"`
// hpaBehavior is the behavior of HPA when scaling in up/down direction.
// Applicable for executor type newdeploy and container.
// +optional
Behavior *asv2beta2.HorizontalPodAutoscalerBehavior `json:"hpaBehavior,omitempty"`
}
// FunctionReferenceType refers to type of Function
FunctionReferenceType string
+4 -3
View File
@@ -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"))
}
+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
}
@@ -143,8 +143,10 @@ var map_ExecutionStrategy = map[string]string{
"ExecutorType": "ExecutorType is the executor type of function used. Defaults to \"poolmgr\".\n\nAvailable value:\n - poolmgr\n - newdeploy\n - container",
"MinScale": "This is only for newdeploy to set up minimum replicas of deployment.",
"MaxScale": "This is only for newdeploy to set up maximum replicas of deployment.",
"TargetCPUPercent": "This is only for newdeploy to set up target CPU utilization of HPA.",
"TargetCPUPercent": "Deprecated: use hpaMetrics instead. This is only for executor type newdeploy and container to set up target CPU utilization of HPA. Applicable for executor type newdeploy and container.",
"SpecializationTimeout": "This is the timeout setting for executor to wait for pod specialization.",
"hpaMetrics": "hpaMetrics is the list of metrics used to determine the desired replica count of the Deployment created for the function. Applicable for executor type newdeploy and container.",
"hpaBehavior": "hpaBehavior is the behavior of HPA when scaling in up/down direction. Applicable for executor type newdeploy and container.",
}
func (ExecutionStrategy) SwaggerDoc() map[string]string {
@@ -29,7 +29,6 @@ import (
multierror "github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"go.uber.org/zap"
asv2beta2 "k8s.io/api/autoscaling/v2beta2"
apiv1 "k8s.io/api/core/v1"
k8sErrs "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -490,8 +489,7 @@ func (caaf *Container) updateFunction(ctx context.Context, oldFn *fv1.Function,
return err
}
if oldFn.Spec.InvokeStrategy != newFn.Spec.InvokeStrategy {
if !reflect.DeepEqual(oldFn.Spec.InvokeStrategy, newFn.Spec.InvokeStrategy) {
// to support backward compatibility, if the function was created in default ns, we fall back to creating the
// deployment of the function in fission-function ns, so cleaning up resources there
ns := caaf.namespace
@@ -524,10 +522,13 @@ func (caaf *Container) updateFunction(ctx context.Context, oldFn *fv1.Function,
hpaChanged = true
}
if newFn.Spec.InvokeStrategy.ExecutionStrategy.TargetCPUPercent != oldFn.Spec.InvokeStrategy.ExecutionStrategy.TargetCPUPercent {
targetCpupercent := int32(newFn.Spec.InvokeStrategy.ExecutionStrategy.TargetCPUPercent)
hpaMetric := hpautils.ConvertTargetCPUToCustomMetric(targetCpupercent)
hpa.Spec.Metrics = []asv2beta2.MetricSpec{hpaMetric}
if !reflect.DeepEqual(newFn.Spec.InvokeStrategy.ExecutionStrategy.Metrics, oldFn.Spec.InvokeStrategy.ExecutionStrategy.Metrics) {
hpa.Spec.Metrics = newFn.Spec.InvokeStrategy.ExecutionStrategy.Metrics
hpaChanged = true
}
if !reflect.DeepEqual(newFn.Spec.InvokeStrategy.ExecutionStrategy.Behavior, oldFn.Spec.InvokeStrategy.ExecutionStrategy.Behavior) {
hpa.Spec.Behavior = newFn.Spec.InvokeStrategy.ExecutionStrategy.Behavior
hpaChanged = true
}
@@ -20,6 +20,7 @@ import (
"context"
"fmt"
"os"
"reflect"
"strconv"
"strings"
"sync"
@@ -29,7 +30,6 @@ import (
"github.com/pkg/errors"
"go.uber.org/zap"
autoscalingv1 "k8s.io/api/autoscaling/v1"
asv2beta2 "k8s.io/api/autoscaling/v2beta2"
apiv1 "k8s.io/api/core/v1"
k8sErrs "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -532,7 +532,7 @@ func (deploy *NewDeploy) updateFunction(ctx context.Context, oldFn *fv1.Function
deployChanged := false
if oldFn.Spec.InvokeStrategy != newFn.Spec.InvokeStrategy {
if !reflect.DeepEqual(oldFn.Spec.InvokeStrategy, newFn.Spec.InvokeStrategy) {
// to support backward compatibility, if the function was created in default ns, we fall back to creating the
// deployment of the function in fission-function ns, so cleaning up resources there
@@ -566,10 +566,13 @@ func (deploy *NewDeploy) updateFunction(ctx context.Context, oldFn *fv1.Function
hpaChanged = true
}
if newFn.Spec.InvokeStrategy.ExecutionStrategy.TargetCPUPercent != oldFn.Spec.InvokeStrategy.ExecutionStrategy.TargetCPUPercent {
targetCpupercent := int32(newFn.Spec.InvokeStrategy.ExecutionStrategy.TargetCPUPercent)
hpaMetric := hpautils.ConvertTargetCPUToCustomMetric(targetCpupercent)
hpa.Spec.Metrics = []asv2beta2.MetricSpec{hpaMetric}
if !reflect.DeepEqual(newFn.Spec.InvokeStrategy.ExecutionStrategy.Metrics, oldFn.Spec.InvokeStrategy.ExecutionStrategy.Metrics) {
hpa.Spec.Metrics = newFn.Spec.InvokeStrategy.ExecutionStrategy.Metrics
hpaChanged = true
}
if !reflect.DeepEqual(newFn.Spec.InvokeStrategy.ExecutionStrategy.Behavior, oldFn.Spec.InvokeStrategy.ExecutionStrategy.Behavior) {
hpa.Spec.Behavior = newFn.Spec.InvokeStrategy.ExecutionStrategy.Behavior
hpaChanged = true
}
+7 -2
View File
@@ -88,12 +88,16 @@ func (hpaops *HpaOperations) CreateOrGetHpa(ctx context.Context, hpaName string,
if maxRepl == 0 {
maxRepl = minRepl
}
targetCPU := int32(execStrategy.TargetCPUPercent)
targetCPU := int32(execStrategy.TargetCPUPercent) // nolint: staticcheck
var hpaMetrics []asv2beta2.MetricSpec
if targetCPU > 0 {
if targetCPU > 0 && targetCPU < 100 {
hpaMetrics = append(hpaMetrics, ConvertTargetCPUToCustomMetric(targetCPU))
}
if execStrategy.Metrics != nil {
hpaMetrics = append(hpaMetrics, execStrategy.Metrics...)
}
hpa := &asv2beta2.HorizontalPodAutoscaler{
ObjectMeta: metav1.ObjectMeta{
Name: hpaName,
@@ -105,6 +109,7 @@ func (hpaops *HpaOperations) CreateOrGetHpa(ctx context.Context, hpaName string,
MinReplicas: &minRepl,
MaxReplicas: maxRepl,
Metrics: hpaMetrics,
Behavior: execStrategy.Behavior,
},
}
+21 -25
View File
@@ -21,12 +21,14 @@ import (
"github.com/pkg/errors"
uuid "github.com/satori/go.uuid"
asv2beta2 "k8s.io/api/autoscaling/v2beta2"
apiv1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/executor/util/hpa"
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
"github.com/fission/fission/pkg/fission-cli/cmd"
"github.com/fission/fission/pkg/fission-cli/cmd/httptrigger"
@@ -38,9 +40,8 @@ import (
)
const (
DEFAULT_MIN_SCALE = 1
DEFAULT_TARGET_CPU_PERCENTAGE = 80
DEFAULT_CONCURRENCY = 500
DEFAULT_MIN_SCALE = 1
DEFAULT_CONCURRENCY = 500
)
type CreateSubCommand struct {
@@ -463,13 +464,6 @@ func getExecutionStrategy(fnExecutor fv1.ExecutorType, input cli.Input) (strateg
SpecializationTimeout: specializationTimeout,
}
} else {
targetCPU := DEFAULT_TARGET_CPU_PERCENTAGE
if input.IsSet(flagkey.RuntimeTargetcpu) {
targetCPU, err = getTargetCPU(input)
if err != nil {
return nil, err
}
}
minScale := DEFAULT_MIN_SCALE
if input.IsSet(flagkey.ReplicasMinscale) {
@@ -494,9 +488,16 @@ func getExecutionStrategy(fnExecutor fv1.ExecutorType, input cli.Input) (strateg
ExecutorType: fnExecutor,
MinScale: minScale,
MaxScale: maxScale,
TargetCPUPercent: targetCPU,
SpecializationTimeout: specializationTimeout,
}
if input.IsSet(flagkey.RuntimeTargetcpu) {
targetCPU, err := getTargetCPU(input)
if err != nil {
return nil, err
}
strategy.Metrics = []asv2beta2.MetricSpec{hpa.ConvertTargetCPUToCustomMetric(int32(targetCPU))}
}
}
return strategy, nil
@@ -547,27 +548,14 @@ func updateExecutionStrategy(input cli.Input, existingExecutionStrategy *fv1.Exe
SpecializationTimeout: specializationTimeout,
}
} else {
targetCPU := existingExecutionStrategy.TargetCPUPercent
minScale := existingExecutionStrategy.MinScale
maxScale := existingExecutionStrategy.MaxScale
if fnExecutor != oldExecutor { // from poolmanager to newdeploy
targetCPU = DEFAULT_TARGET_CPU_PERCENTAGE
minScale = DEFAULT_MIN_SCALE
maxScale = minScale
}
if input.IsSet(flagkey.RuntimeTargetcpu) {
targetCPU, err = getTargetCPU(input)
if err != nil {
return nil, err
}
} else {
if targetCPU <= 0 || targetCPU > 100 {
targetCPU = DEFAULT_TARGET_CPU_PERCENTAGE
}
}
if input.IsSet(flagkey.ReplicasMinscale) {
minScale = input.Int(flagkey.ReplicasMinscale)
}
@@ -593,9 +581,17 @@ func updateExecutionStrategy(input cli.Input, existingExecutionStrategy *fv1.Exe
ExecutorType: fnExecutor,
MinScale: minScale,
MaxScale: maxScale,
TargetCPUPercent: targetCPU,
SpecializationTimeout: specializationTimeout,
}
if input.IsSet(flagkey.RuntimeTargetcpu) {
targetCPU, err := getTargetCPU(input)
if err != nil {
return nil, err
}
strategy.Metrics = []asv2beta2.MetricSpec{hpa.ConvertTargetCPUToCustomMetric(int32(targetCPU))}
}
}
return strategy, nil
+8 -19
View File
@@ -21,8 +21,10 @@ import (
"testing"
"github.com/stretchr/testify/assert"
asv2beta2 "k8s.io/api/autoscaling/v2beta2"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/executor/util/hpa"
"github.com/fission/fission/pkg/fission-cli/cliwrapper/driver/dummy"
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
)
@@ -71,7 +73,6 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: DEFAULT_MIN_SCALE,
MaxScale: DEFAULT_MIN_SCALE,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -92,7 +93,6 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: DEFAULT_MIN_SCALE,
MaxScale: DEFAULT_MIN_SCALE,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -107,7 +107,6 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: DEFAULT_MIN_SCALE,
MaxScale: DEFAULT_MIN_SCALE,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -134,7 +133,6 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: 2,
MaxScale: 3,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -164,7 +162,6 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: 5,
MaxScale: 5,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -183,7 +180,6 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: DEFAULT_MIN_SCALE,
MaxScale: 3,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -211,7 +207,6 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: 2,
MaxScale: 5,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -230,7 +225,6 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: 2,
MaxScale: 5,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -240,7 +234,6 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: 2,
MaxScale: 9,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -257,7 +250,6 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: 2,
MaxScale: 5,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -267,7 +259,6 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: 2,
MaxScale: 5,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -286,7 +277,7 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: DEFAULT_MIN_SCALE,
MaxScale: DEFAULT_MIN_SCALE,
TargetCPUPercent: 50,
Metrics: []asv2beta2.MetricSpec{hpa.ConvertTargetCPUToCustomMetric(50)},
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -304,7 +295,7 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: 2,
MaxScale: 5,
TargetCPUPercent: 88,
Metrics: []asv2beta2.MetricSpec{hpa.ConvertTargetCPUToCustomMetric(88)},
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -314,7 +305,7 @@ func TestGetInvokeStrategy(t *testing.T) {
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: 2,
MaxScale: 5,
TargetCPUPercent: 20,
Metrics: []asv2beta2.MetricSpec{hpa.ConvertTargetCPUToCustomMetric(20)},
SpecializationTimeout: fv1.DefaultSpecializationTimeOut,
},
},
@@ -329,10 +320,9 @@ func TestGetInvokeStrategy(t *testing.T) {
existingInvokeStrategy: &fv1.InvokeStrategy{
StrategyType: fv1.StrategyTypeExecution,
ExecutionStrategy: fv1.ExecutionStrategy{
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: 2,
MaxScale: 5,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
ExecutorType: fv1.ExecutorTypeNewdeploy,
MinScale: 2,
MaxScale: 5,
},
},
expectedResult: &fv1.InvokeStrategy{
@@ -342,7 +332,6 @@ func TestGetInvokeStrategy(t *testing.T) {
MinScale: 2,
MaxScale: 5,
SpecializationTimeout: 200,
TargetCPUPercent: DEFAULT_TARGET_CPU_PERCENTAGE,
},
},
expectError: false,
+2 -3
View File
@@ -47,7 +47,7 @@ func (opts *ListSubCommand) do(input cli.Input) error {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n", "NAME", "ENV", "EXECUTORTYPE", "MINSCALE", "MAXSCALE", "MINCPU", "MAXCPU", "MINMEMORY", "MAXMEMORY", "TARGETCPU", "SECRETS", "CONFIGMAPS")
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n", "NAME", "ENV", "EXECUTORTYPE", "MINSCALE", "MAXSCALE", "MINCPU", "MAXCPU", "MINMEMORY", "MAXMEMORY", "SECRETS", "CONFIGMAPS")
for _, f := range fns {
secrets := f.Spec.Secrets
configMaps := f.Spec.ConfigMaps
@@ -59,7 +59,7 @@ func (opts *ListSubCommand) do(input cli.Input) error {
configMapList = append(configMapList, configMap.Name)
}
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n",
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n",
f.ObjectMeta.Name, f.Spec.Environment.Name,
f.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType,
f.Spec.InvokeStrategy.ExecutionStrategy.MinScale,
@@ -68,7 +68,6 @@ func (opts *ListSubCommand) do(input cli.Input) error {
f.Spec.Resources.Limits.Cpu().String(),
f.Spec.Resources.Requests.Memory().String(),
f.Spec.Resources.Limits.Memory().String(),
f.Spec.InvokeStrategy.ExecutionStrategy.TargetCPUPercent,
strings.Join(secretsList, ","),
strings.Join(configMapList, ","))
}
+2 -3
View File
@@ -218,7 +218,7 @@ func ShowFunctions(fns []fv1.Function) {
if len(fns) > 0 {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
fmt.Fprintf(w, "%v\n", "Functions:")
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n", "NAME", "ENV", "EXECUTORTYPE", "MINSCALE", "MAXSCALE", "MINCPU", "MAXCPU", "MINMEMORY", "MAXMEMORY", "TARGETCPU", "SECRETS", "CONFIGMAPS")
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n", "NAME", "ENV", "EXECUTORTYPE", "MINSCALE", "MAXSCALE", "MINCPU", "MAXCPU", "MINMEMORY", "MAXMEMORY", "SECRETS", "CONFIGMAPS")
for _, f := range fns {
secrets := f.Spec.Secrets
@@ -231,7 +231,7 @@ func ShowFunctions(fns []fv1.Function) {
configMapList = append(configMapList, configMap.Name)
}
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n",
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\t%v\n",
f.ObjectMeta.Name, f.Spec.Environment.Name,
f.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType,
f.Spec.InvokeStrategy.ExecutionStrategy.MinScale,
@@ -240,7 +240,6 @@ func ShowFunctions(fns []fv1.Function) {
f.Spec.Resources.Limits.Cpu().String(),
f.Spec.Resources.Requests.Memory().String(),
f.Spec.Resources.Limits.Memory().String(),
f.Spec.InvokeStrategy.ExecutionStrategy.TargetCPUPercent,
strings.Join(secretsList, ","),
strings.Join(configMapList, ","))
}