From 21dbeb981009a79e3f91056c850db7fca10be566 Mon Sep 17 00:00:00 2001 From: faizanahmad055 Date: Fri, 8 Jan 2021 17:28:50 +0100 Subject: [PATCH] Remove redundant reload on resource creation Signed-off-by: faizanahmad055 --- internal/pkg/controller/controller.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/internal/pkg/controller/controller.go b/internal/pkg/controller/controller.go index eeb009f5..efed3228 100644 --- a/internal/pkg/controller/controller.go +++ b/internal/pkg/controller/controller.go @@ -57,12 +57,8 @@ func NewController( // Add function to add a new object to the queue in case of creating a resource func (c *Controller) Add(obj interface{}) { - if !c.resourceInIgnoredNamespace(obj) { - c.queue.Add(handler.ResourceCreatedHandler{ - Resource: obj, - Collectors: c.collectors, - }) - } + // Not required as reloader should update the resource in the event of any change and not in the event of any resource creation. + // This causes the issue where reloader reloads the pods when reloader itself gets restarted as it's queue is filled with all the k8s objects as new resources. } func (c *Controller) resourceInIgnoredNamespace(raw interface{}) bool {