diff --git a/adapter/main.go b/adapter/main.go index 3d6b9810baf..77689bfd5bc 100644 --- a/adapter/main.go +++ b/adapter/main.go @@ -20,13 +20,14 @@ import ( "context" "flag" "fmt" - kedacontrollers "github.com/kedacore/keda/v2/controllers/keda" "os" "runtime" - "sigs.k8s.io/controller-runtime/pkg/controller" "strconv" "time" + kedacontrollers "github.com/kedacore/keda/v2/controllers/keda" + "sigs.k8s.io/controller-runtime/pkg/controller" + appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" k8sruntime "k8s.io/apimachinery/pkg/runtime" diff --git a/controllers/keda/metrics_adapter_controller.go b/controllers/keda/metrics_adapter_controller.go index 060e67bc7fc..aa75a6a7dd8 100644 --- a/controllers/keda/metrics_adapter_controller.go +++ b/controllers/keda/metrics_adapter_controller.go @@ -18,6 +18,7 @@ package keda import ( "context" + kedav1alpha1 "github.com/kedacore/keda/v2/apis/keda/v1alpha1" "github.com/kedacore/keda/v2/pkg/scaling" ctrl "sigs.k8s.io/controller-runtime" diff --git a/pkg/scaling/scale_handler.go b/pkg/scaling/scale_handler.go index b4af17bd2d2..6e04b60d90d 100644 --- a/pkg/scaling/scale_handler.go +++ b/pkg/scaling/scale_handler.go @@ -184,7 +184,7 @@ func (h *scaleHandler) GetScalersCache(scalableObject interface{}) (*cache.Scale return nil, err } - scalers, factories, err := h.buildScalers(withTriggers, podTemplateSpec, containerName) + scalers, factories := h.buildScalers(withTriggers, podTemplateSpec, containerName) if err != nil { h.logger.Error(err, "error building some scalers") } @@ -273,7 +273,7 @@ func (h *scaleHandler) checkScalers(ctx context.Context, scalableObject interfac } // buildScalers returns list of Scalers for the specified triggers -func (h *scaleHandler) buildScalers(withTriggers *kedav1alpha1.WithTriggers, podTemplateSpec *corev1.PodTemplateSpec, containerName string) ([]scalers.Scaler, []func() (scalers.Scaler, error), error) { +func (h *scaleHandler) buildScalers(withTriggers *kedav1alpha1.WithTriggers, podTemplateSpec *corev1.PodTemplateSpec, containerName string) ([]scalers.Scaler, []func() (scalers.Scaler, error)) { logger := h.logger.WithValues("type", withTriggers.Kind, "namespace", withTriggers.Namespace, "name", withTriggers.Name) var err error resolvedEnv := make(map[string]string) @@ -319,7 +319,7 @@ func (h *scaleHandler) buildScalers(withTriggers *kedav1alpha1.WithTriggers, pod factories = append(factories, factory) } - return scalersRes, factories, nil + return scalersRes, factories } func buildScaler(client client.Client, triggerType string, config *scalers.ScalerConfig) (scalers.Scaler, error) { diff --git a/pkg/scaling/scale_handler_test.go b/pkg/scaling/scale_handler_test.go index 66e934353b0..9112f58239c 100644 --- a/pkg/scaling/scale_handler_test.go +++ b/pkg/scaling/scale_handler_test.go @@ -19,6 +19,8 @@ package scaling import ( "context" "errors" + "testing" + "github.com/golang/mock/gomock" kedav1alpha1 "github.com/kedacore/keda/v2/apis/keda/v1alpha1" mock_scalers "github.com/kedacore/keda/v2/pkg/mock/mock_scaler" @@ -30,7 +32,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/record" logf "sigs.k8s.io/controller-runtime/pkg/log" - "testing" ) func TestCheckScaledObjectScalersWithError(t *testing.T) {