diff --git a/internal/certmanager/cm_controller.go b/internal/certmanager/cm_controller.go index 59a75ef904..4cbbe59146 100644 --- a/internal/certmanager/cm_controller.go +++ b/internal/certmanager/cm_controller.go @@ -40,6 +40,7 @@ import ( k8s_nginx "github.com/nginxinc/kubernetes-ingress/pkg/client/clientset/versioned" vsinformers "github.com/nginxinc/kubernetes-ingress/pkg/client/informers/externalversions" listers_v1 "github.com/nginxinc/kubernetes-ingress/pkg/client/listers/configuration/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" ) const ( @@ -146,6 +147,11 @@ func (c *CmController) processItem(ctx context.Context, key string) error { var vs *conf_v1.VirtualServer vs, err = nsi.vsLister.VirtualServers(namespace).Get(name) + // VS has been deleted + if apierrors.IsNotFound(err) { + return nil + } + if err != nil { return err } diff --git a/internal/externaldns/controller.go b/internal/externaldns/controller.go index 57d258bf96..02c38ce16f 100644 --- a/internal/externaldns/controller.go +++ b/internal/externaldns/controller.go @@ -13,6 +13,7 @@ import ( listersV1 "github.com/nginxinc/kubernetes-ingress/pkg/client/listers/configuration/v1" extdnslisters "github.com/nginxinc/kubernetes-ingress/pkg/client/listers/externaldns/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/tools/cache" @@ -165,10 +166,11 @@ func (c *ExtDNSController) runWorker(ctx context.Context) { if err := c.processItem(ctx, key); err != nil { glog.V(3).Infof("Re-queuing item due to error processing: %v", err) - c.queue.Add(obj) + c.queue.AddRateLimited(obj) return } glog.V(3).Infof("finished processing work item") + c.queue.Forget(obj) }() } } @@ -183,6 +185,11 @@ func (c *ExtDNSController) processItem(ctx context.Context, key string) error { nsi := getNamespacedInformer(namespace, c.informerGroup) vs, err = nsi.vsLister.VirtualServers(namespace).Get(name) + // VS has been deleted + if apierrors.IsNotFound(err) { + return nil + } + if err != nil { return err }