From a4737bcac9c9b8b96415e057f773eb318bc1a3b6 Mon Sep 17 00:00:00 2001 From: Satish Matti Date: Tue, 3 Dec 2019 15:07:28 -0800 Subject: [PATCH] Cherrypick #963[Emit events only for non-nil ingresses] into release 1.8 --- pkg/controller/controller.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index f9844201f3..5a2f49c2fe 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -527,7 +527,8 @@ func (lbc *LoadBalancerController) sync(key string) error { frontendGCAlgorithm := frontendGCAlgorithm(ingExists, ing) // GC will find GCE resources that were used for this ingress and delete them. err := lbc.ingSyncer.GC(allIngresses, ing, frontendGCAlgorithm) - if err != nil { + // Skip emitting an event if ingress does not exist as we cannot retrieve ingress namespace. + if err != nil && ingExists { lbc.ctx.Recorder(ing.Namespace).Eventf(ing, apiv1.EventTypeWarning, "GC", fmt.Sprintf("Error during GC: %v", err)) } return err