From aebe2ec63e1bfad0f391c329a9c9f6ede36086d9 Mon Sep 17 00:00:00 2001 From: Eguzki Astiz Lezaun Date: Thu, 16 Nov 2023 23:10:25 +0100 Subject: [PATCH] authconfig deletion is not necessary --- controllers/authpolicy_authconfig.go | 26 -------------------------- controllers/authpolicy_controller.go | 4 ---- 2 files changed, 30 deletions(-) diff --git a/controllers/authpolicy_authconfig.go b/controllers/authpolicy_authconfig.go index f244f8356..8c4265f90 100644 --- a/controllers/authpolicy_authconfig.go +++ b/controllers/authpolicy_authconfig.go @@ -42,32 +42,6 @@ func (r *AuthPolicyReconciler) reconcileAuthConfigs(ctx context.Context, ap *api return nil } -func (r *AuthPolicyReconciler) deleteAuthConfigs(ctx context.Context, ap *api.AuthPolicy) error { - logger, err := logr.FromContext(ctx) - if err != nil { - return err - } - - logger.Info("Removing Authorino's AuthConfigs") - - authConfig := &authorinoapi.AuthConfig{ - ObjectMeta: metav1.ObjectMeta{ - Name: authConfigName(client.ObjectKeyFromObject(ap)), - Namespace: ap.Namespace, - }, - } - - if err := r.DeleteResource(ctx, authConfig); err != nil { - if apierrors.IsNotFound(err) { - return nil - } - logger.Error(err, "failed to delete Authorino's AuthConfig") - return err - } - - return nil -} - func (r *AuthPolicyReconciler) desiredAuthConfig(ctx context.Context, ap *api.AuthPolicy, targetNetworkObject client.Object) (*authorinoapi.AuthConfig, error) { logger, _ := logr.FromContext(ctx) logger = logger.WithName("desiredAuthConfig") diff --git a/controllers/authpolicy_controller.go b/controllers/authpolicy_controller.go index 2e21b454d..efa719830 100644 --- a/controllers/authpolicy_controller.go +++ b/controllers/authpolicy_controller.go @@ -174,10 +174,6 @@ func (r *AuthPolicyReconciler) deleteResources(ctx context.Context, ap *api.Auth return err } - if err := r.deleteAuthConfigs(ctx, ap); err != nil { - return err - } - // remove direct back ref if targetNetworkObject != nil { if err := r.deleteNetworkResourceDirectBackReference(ctx, targetNetworkObject); err != nil {