Skip to content

Commit

Permalink
Create Keystone roles for Swift RBAC
Browse files Browse the repository at this point in the history
Create the SwiftProjectReader and SwiftSystemReader default roles
that can be assigned to users to provide limited read access.
  • Loading branch information
cschwede committed Feb 21, 2024
1 parent 5490720 commit 7ab172b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions controllers/swiftproxy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,20 @@ func (r *SwiftProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request)
return ctrlResult, err
}

// Create OpenStack roles for Swift RBAC
os, _, err := keystonev1.GetAdminServiceClient(ctx, helper, keystoneAPI)
if err != nil {
return ctrl.Result{}, err
}
_, err = os.CreateRole(r.Log, "SwiftProjectReader")
if err != nil {
return ctrl.Result{}, err
}
_, err = os.CreateRole(r.Log, "SwiftSystemReader")
if err != nil {
return ctrl.Result{}, err
}

// Get the service password
sps, hash, err := secret.GetSecret(ctx, helper, instance.Spec.Secret, instance.Namespace)
if err != nil {
Expand Down

0 comments on commit 7ab172b

Please sign in to comment.