From b7100e58a24b97fe3166bd141fa582f0ed97b3a5 Mon Sep 17 00:00:00 2001 From: Ori Shoshan Date: Mon, 6 Nov 2023 21:29:49 -0600 Subject: [PATCH] Fix bug in new AWS reconciler where deleted pods would still be reconciled --- .../poduserpassword/db_credentials_pod_reconciler.go | 3 +++ .../service_account_pod/service_account_pod_reconciler.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/operator/controllers/poduserpassword/db_credentials_pod_reconciler.go b/src/operator/controllers/poduserpassword/db_credentials_pod_reconciler.go index a3ddc46..929c49a 100644 --- a/src/operator/controllers/poduserpassword/db_credentials_pod_reconciler.go +++ b/src/operator/controllers/poduserpassword/db_credentials_pod_reconciler.go @@ -66,6 +66,9 @@ func (e *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu var pod v1.Pod err := e.client.Get(ctx, req.NamespacedName, &pod) if err != nil { + if apierrors.IsNotFound(err) { + return ctrl.Result{}, nil + } return ctrl.Result{}, err } diff --git a/src/operator/controllers/service_account_pod/service_account_pod_reconciler.go b/src/operator/controllers/service_account_pod/service_account_pod_reconciler.go index fa81ac0..3855003 100644 --- a/src/operator/controllers/service_account_pod/service_account_pod_reconciler.go +++ b/src/operator/controllers/service_account_pod/service_account_pod_reconciler.go @@ -57,6 +57,9 @@ func (e *PodServiceAccountReconciler) Reconcile(ctx context.Context, req ctrl.Re var pod v1.Pod err := e.client.Get(ctx, req.NamespacedName, &pod) if err != nil { + if apierrors.IsNotFound(err) { + return ctrl.Result{}, nil + } return ctrl.Result{}, err }