Skip to content

Commit

Permalink
authconfig deletion is not necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki authored and alexsnaps committed Nov 17, 2023
1 parent 170fe81 commit aebe2ec
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
26 changes: 0 additions & 26 deletions controllers/authpolicy_authconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 0 additions & 4 deletions controllers/authpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit aebe2ec

Please sign in to comment.