Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two identical Kubebuilders in different CRs with * #6820

Open
OdedViner opened this issue Aug 26, 2024 · 1 comment
Open

Two identical Kubebuilders in different CRs with * #6820

OdedViner opened this issue Aug 26, 2024 · 1 comment

Comments

@OdedViner
Copy link

OdedViner commented Aug 26, 2024

Bug Report

When there are two identical Kubebuilders [same groups ] in different CRs and the verb in one of them is * then we need to add a condition that verbs=* and not verbs=*+[list, update...]

In this example:

controllers/storagecluster/reconcile.go
// +kubebuilder:rbac:groups=storage.k8s.io,resources=storageclasses,verbs=*
func (r *StorageClusterReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {

controllers/storagerequest/storagerequest_controller.go
// +kubebuilder:rbac:groups=storage.k8s.io,resources=storageclasses,verbs=get;list;watch;create;update;patch;delete
func (r *StorageRequestReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {


config/rbac/role.yaml
- apiGroups:
  - storage.k8s.io
  resources:
  - storageclasses
  verbs:
  - '*'
  - create
  - delete
  - get
  - list
  - patch
  - update
  - watch
https://github.com/red-hat-storage/ocs-operator/blob/main/config/rbac/role.yaml#L409-L421

What did you do?

What did you expect to see?

astricks+[get,list,create]=astricks

What did you see instead? Under which circumstances?

Environment

Operator type:
Golang

Kubernetes cluster type:
Openshift

$ operator-sdk version

$ go version (if language is Go)
$ go version
go version go1.22.3 linux/amd64

$ kubectl version

Possible Solution

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@OdedViner and others