From 202706ae5f219de8bc061e0dcdedfed84fb81c19 Mon Sep 17 00:00:00 2001 From: Zbynek Roubalik Date: Tue, 7 Apr 2020 10:06:00 +0200 Subject: [PATCH] call handleScaledObject() directly Signed-off-by: Zbynek Roubalik --- pkg/handler/scale_loop.go | 20 ++------------------ pkg/util/gvkr.go | 1 - 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/pkg/handler/scale_loop.go b/pkg/handler/scale_loop.go index 6c2913734a8..59484c4a2bb 100644 --- a/pkg/handler/scale_loop.go +++ b/pkg/handler/scale_loop.go @@ -11,7 +11,7 @@ import ( func (h *ScaleHandler) HandleScaleLoop(ctx context.Context, scaledObject *kedav1alpha1.ScaledObject) { h.logger = h.logger.WithValues("ScaledObject.Namespace", scaledObject.Namespace, "ScaledObject.Name", scaledObject.Name) - h.handleScale(ctx, scaledObject) + h.handleScaledObject(ctx, scaledObject) var pollingInterval time.Duration if scaledObject.Spec.PollingInterval != nil { @@ -25,7 +25,7 @@ func (h *ScaleHandler) HandleScaleLoop(ctx context.Context, scaledObject *kedav1 for { select { case <-time.After(pollingInterval): - h.handleScale(ctx, scaledObject) + h.handleScaledObject(ctx, scaledObject) case <-ctx.Done(): h.logger.V(1).Info("Context for scaledObject canceled") return @@ -33,22 +33,6 @@ func (h *ScaleHandler) HandleScaleLoop(ctx context.Context, scaledObject *kedav1 } } -// handleScale contains the main logic for the ScaleHandler scaling logic. -// It'll check each trigger active status then call handleScaleOnScaleObject -func (h *ScaleHandler) handleScale(ctx context.Context, scaledObject *kedav1alpha1.ScaledObject) { - - // TODO refactor - - // switch scaledObject.Spec.ScaleType { - // case kedav1alpha1.ScaleTypeJob: - // h.handleScaleJob(ctx, scaledObject) - // break - // default: - h.handleScaledObject(ctx, scaledObject) - //} - return -} - // TODO refactor func (h *ScaleHandler) handleScaleJob(ctx context.Context, scaledObject *kedav1alpha1.ScaledObject) { //TODO: need to actually handle the scale here diff --git a/pkg/util/gvkr.go b/pkg/util/gvkr.go index 9ab9e608aaa..a9bdff7ce52 100644 --- a/pkg/util/gvkr.go +++ b/pkg/util/gvkr.go @@ -57,7 +57,6 @@ func ParseGVKR(restMapper meta.RESTMapper, apiVersion string, kind string) (Grou // if kind is not specified, we suppose that default one should be used if kind == "" { kind = defaultKind - resource = defaultResource } // get resource