Skip to content

Commit

Permalink
Add rbac permissions to access ResourceType on resource server
Browse files Browse the repository at this point in the history
This add nonResourceURLs permissions to get and list
/o2ims-infrastructureInventory/v1/resourceTypes endpoint

Signed-off-by: Marcelo Guerrero <[email protected]>
  • Loading branch information
mlguerrero12 committed Nov 29, 2024
1 parent d44d3be commit edb61f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bundle/manifests/oran-o2ims.clusterserviceversion.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ kind: ClusterRole
metadata:
name: manager-role
rules:
- nonResourceURLs:
- /o2ims-infrastructureInventory/v1/resourceTypes
verbs:
- get
- list
- apiGroups:
- ""
resources:
Expand Down
10 changes: 10 additions & 0 deletions internal/controllers/inventory_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import (
//+kubebuilder:rbac:groups="",resources=nodes,verbs=get;list;watch
//+kubebuilder:rbac:groups="internal.open-cluster-management.io",resources=managedclusterinfos,verbs=get;list;watch
//+kubebuilder:rbac:groups="config.openshift.io",resources=clusterversions,verbs=get;list;watch
//+kubebuilder:rbac:urls="/o2ims-infrastructureInventory/v1/resourceTypes",verbs=get;list

// Reconciler reconciles a Inventory object
type Reconciler struct {
Expand Down Expand Up @@ -1040,6 +1041,15 @@ func (t *reconcilerTask) createAlarmServerClusterRole(ctx context.Context) error
"watch",
},
},
{
NonResourceURLs: []string{
"/o2ims-infrastructureInventory/v1/resourceTypes",
},
Verbs: []string{
"get",
"list",
},
},
},
}

Expand Down

0 comments on commit edb61f7

Please sign in to comment.