From 573e592f002c92a07f2e823b4aae4483e71445cf Mon Sep 17 00:00:00 2001 From: atheo89 Date: Wed, 6 Nov 2024 16:02:49 +0100 Subject: [PATCH] Swap deletion before creation on rbac controller --- .../controllers/notebook_rbac.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/odh-notebook-controller/controllers/notebook_rbac.go b/components/odh-notebook-controller/controllers/notebook_rbac.go index 73a2d98bb63..6f7ede54ac0 100644 --- a/components/odh-notebook-controller/controllers/notebook_rbac.go +++ b/components/odh-notebook-controller/controllers/notebook_rbac.go @@ -151,16 +151,16 @@ func (r *OpenshiftNotebookReconciler) reconcileRoleBinding( func (r *OpenshiftNotebookReconciler) ReconcileRoleBindings( notebook *nbv1.Notebook, ctx context.Context) error { - // Reconcile a RoleBinding for pipelines for the notebook service account roleBindingName := "elyra-pipelines-" + notebook.Name - if err := r.reconcileRoleBinding(notebook, ctx, roleBindingName, "Role", "ds-pipeline-user-access-dspa"); err != nil { - return err - } - // If the notebook is marked for deletion, remove the associated RoleBinding if !notebook.ObjectMeta.DeletionTimestamp.IsZero() { return r.deleteRoleBinding(ctx, roleBindingName, notebook.Namespace) } + // Reconcile a RoleBinding for pipelines for the notebook service account + if err := r.reconcileRoleBinding(notebook, ctx, roleBindingName, "Role", "ds-pipeline-user-access-dspa"); err != nil { + return err + } + return nil }