Skip to content

Commit

Permalink
Swap deletion before creation on rbac controller
Browse files Browse the repository at this point in the history
  • Loading branch information
atheo89 committed Nov 6, 2024
1 parent 5e6c775 commit 573e592
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/odh-notebook-controller/controllers/notebook_rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 573e592

Please sign in to comment.