From 9dd1af9b6414691e91d9410e279967ae86413c25 Mon Sep 17 00:00:00 2001 From: Sina Date: Mon, 11 Dec 2023 12:36:30 +0330 Subject: [PATCH] removed extra error check and owned service --- .../basic_authenticator/basicauthenticator_controller.go | 2 +- internal/controller/basic_authenticator/provision.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/controller/basic_authenticator/basicauthenticator_controller.go b/internal/controller/basic_authenticator/basicauthenticator_controller.go index 65bc3e2..f2413f8 100644 --- a/internal/controller/basic_authenticator/basicauthenticator_controller.go +++ b/internal/controller/basic_authenticator/basicauthenticator_controller.go @@ -65,7 +65,6 @@ func (r *BasicAuthenticatorReconciler) Reconcile(ctx context.Context, req ctrl.R func (r *BasicAuthenticatorReconciler) initVars(request ctrl.Request) { r.basicAuthenticatorNamespace = request.Namespace //configmap name and credential name's value would be set in reconcile loop - } // SetupWithManager sets up the controller with the Manager. @@ -75,6 +74,7 @@ func (r *BasicAuthenticatorReconciler) SetupWithManager(mgr ctrl.Manager) error Owns(&appv1.Deployment{}). Owns(&corev1.ConfigMap{}). Owns(&corev1.Secret{}). + Owns(&corev1.Service{}). Watches( &source.Kind{Type: &appv1.Deployment{}}, handler.EnqueueRequestsFromMapFunc(r.findExternallyManagedDeployments), diff --git a/internal/controller/basic_authenticator/provision.go b/internal/controller/basic_authenticator/provision.go index 0a536fb..b1829b0 100644 --- a/internal/controller/basic_authenticator/provision.go +++ b/internal/controller/basic_authenticator/provision.go @@ -244,10 +244,8 @@ func (r *BasicAuthenticatorReconciler) createDeploymentAuthenticator(ctx context r.logger.Info("created deployment") r.deploymentLabel = newDeployment.Spec.Selector } else if err != nil { - if err != nil { - r.logger.Error(err, "failed to fetch deployment") - return subreconciler.RequeueWithError(err) - } + r.logger.Error(err, "failed to fetch deployment") + return subreconciler.RequeueWithError(err) } else { //update deployment targetReplica := newDeployment.Spec.Replicas