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

Closed
OdedViner opened this issue Aug 26, 2024 · 2 comments
Closed

Two identical Kubebuilders in different CRs with * #6820

OdedViner opened this issue Aug 26, 2024 · 2 comments

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

@acornett21
Copy link
Contributor

Hi @OdedViner since this is about kubebuilder, this issue is probably best opened in that project.

@OdedViner
Copy link
Author

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

4 participants
@OdedViner @acornett21 and others