Skip to content

Commit

Permalink
fix: fix rbac for operator
Browse files Browse the repository at this point in the history
  • Loading branch information
驱庸 committed Feb 11, 2022
1 parent ddb8659 commit 4964557
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 1 deletion.
78 changes: 78 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,84 @@ rules:
- get
- patch
- update
- apiGroups:
- cloud.oceanbase.com
resources:
- obzones
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- cloud.oceanbase.com
resources:
- obzones/finalizers
verbs:
- update
- apiGroups:
- cloud.oceanbase.com
resources:
- obzones/status
verbs:
- get
- patch
- update
- apiGroups:
- cloud.oceanbase.com
resources:
- rootservices
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- cloud.oceanbase.com
resources:
- rootservices/finalizers
verbs:
- update
- apiGroups:
- cloud.oceanbase.com
resources:
- rootservices/status
verbs:
- get
- patch
- update
- apiGroups:
- cloud.oceanbase.com
resources:
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- cloud.oceanbase.com
resources:
- services/finalizers
verbs:
- update
- apiGroups:
- cloud.oceanbase.com
resources:
- services/status
verbs:
- get
- patch
- update
- apiGroups:
- cloud.oceanbase.com
resources:
Expand Down
1 change: 0 additions & 1 deletion deploy/obcluster.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
apiVersion: cloud.oceanbase.com/v1
kind: OBCluster
metadata:
namespace: ob
name: ob-test
spec:
version: v3.1.2-10000392021123010
Expand Down
65 changes: 65 additions & 0 deletions deploy/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,58 @@ rules:
- get
- patch
- update
- apiGroups:
- cloud.oceanbase.com
resources:
- obzones
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- cloud.oceanbase.com
resources:
- obzones/finalizers
verbs:
- update
- apiGroups:
- cloud.oceanbase.com
resources:
- obzones/status
verbs:
- get
- patch
- update
- apiGroups:
- cloud.oceanbase.com
resources:
- rootservices
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- cloud.oceanbase.com
resources:
- rootservices/finalizers
verbs:
- update
- apiGroups:
- cloud.oceanbase.com
resources:
- rootservices/status
verbs:
- get
- patch
- update
- apiGroups:
- cloud.oceanbase.com
resources:
Expand Down Expand Up @@ -120,6 +172,18 @@ rules:
- get
- patch
- update
- apiGroups:
- ""
resources:
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
Expand Down Expand Up @@ -321,6 +385,7 @@ spec:
- --health-probe-bind-address=:8081
- --metrics-bind-address=127.0.0.1:8080
- --leader-elect
- --cluster-name=cn
command:
- /manager
image: oceanbase/obce-operator:v0.0.1
Expand Down
9 changes: 9 additions & 0 deletions pkg/controllers/observer/core/obcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,18 @@ type OBClusterCtrlOperator interface {
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=obclusters,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=obclusters/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=obclusters/finalizers,verbs=update
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=rootservices,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=rootservices/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=rootservices/finalizers,verbs=update
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=obzones,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=obzones/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=obzones/finalizers,verbs=update
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=statefulapps,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=statefulapps/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=statefulapps/finalizers,verbs=update
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=services,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=services/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=cloud.oceanbase.com,resources=services/finalizers,verbs=update
// +kubebuilder:rbac:groups="",resources=events,verbs=create;patch

func (r *OBClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
Expand Down

0 comments on commit 4964557

Please sign in to comment.