From 839ef015ae9dc0751a7d7b263a752c8524568c10 Mon Sep 17 00:00:00 2001 From: bmordeha Date: Tue, 7 May 2024 10:31:58 +0300 Subject: [PATCH] Do not release pods in terminating namespaces. When a namespace is in the 'Terminating' phase, it means that Kubernetes is in the process of removing all resources from that namespace. We should not attempt to release pods in such namespaces. Signed-off-by: bmordeha --- .../aaq-gate-controller/aaq-gate-controller.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/aaq-controller/aaq-gate-controller/aaq-gate-controller.go b/pkg/aaq-controller/aaq-gate-controller/aaq-gate-controller.go index 2b6b6bb5..aec9c5e8 100644 --- a/pkg/aaq-controller/aaq-gate-controller/aaq-gate-controller.go +++ b/pkg/aaq-controller/aaq-gate-controller/aaq-gate-controller.go @@ -260,10 +260,11 @@ func (ctrl *AaqGateController) Execute() bool { } func (ctrl *AaqGateController) execute(ns string) (error, enqueueState) { - _, err := ctrl.namespaceLister.Get(ns) - if kapierrors.IsNotFound(err) { + namespace, err := ctrl.namespaceLister.Get(ns) + if kapierrors.IsNotFound(err) || namespace.Status.Phase == v1.NamespaceTerminating { return nil, Forget } + aaqjqc, err := ctrl.createAndGetAaqjqc(ns) if err != nil { return err, Immediate