Skip to content

Commit

Permalink
Merge pull request #24 from appuio/fix/apiserver-rbac
Browse files Browse the repository at this point in the history
Add missing RBAC permissions to the apiserver role
  • Loading branch information
glrf authored Jan 28, 2022
2 parents 9401159 + e5822f4 commit d0458e7
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apiserver/organization/members.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

// +kubebuilder:rbac:groups="appuio.io",resources=organizationmembers,verbs=get;list;watch;create;delete;patch;update;edit

// memberProvider is an abstraction for interacting with the OrganizationMembers Object
//go:generate go run github.com/golang/mock/mockgen -source=$GOFILE -destination=./mock/$GOFILE
type memberProvider interface {
Expand Down
6 changes: 6 additions & 0 deletions apiserver/organization/rolebindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=rolebindings,verbs=get;list;watch;create;delete;patch;update;edit

// Needed so that we are allowed to delegate the default clusterroles
// +kubebuilder:rbac:groups="rbac.appuio.io",resources=organizations,verbs=get;list;watch;create;delete;patch;update;edit
// +kubebuilder:rbac:groups="organization.appuio.io",resources=organizations,verbs=get;list;watch;create;delete;patch;update;edit

//go:generate go run github.com/golang/mock/mockgen -source=$GOFILE -destination=./mock/$GOFILE
type roleBindingCreator interface {
CreateRoleBindings(ctx context.Context, namespace string) error
Expand Down
52 changes: 52 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ rules:
- get
- list
- watch
- apiGroups:
- appuio.io
resources:
- organizationmembers
verbs:
- create
- delete
- edit
- get
- list
- patch
- update
- watch
- apiGroups:
- coordination.k8s.io
resources:
Expand All @@ -54,3 +67,42 @@ rules:
- get
- list
- watch
- apiGroups:
- organization.appuio.io
resources:
- organizations
verbs:
- create
- delete
- edit
- get
- list
- patch
- update
- watch
- apiGroups:
- rbac.appuio.io
resources:
- organizations
verbs:
- create
- delete
- edit
- get
- list
- patch
- update
- watch
- apiGroups:
- rbac.authorization.k8s.io
resources:
- rolebindings
verbs:
- create
- delete
- edit
- get
- list
- patch
- update
- watch

0 comments on commit d0458e7

Please sign in to comment.