Skip to content

Commit

Permalink
Add RBAC permission on openshift
Browse files Browse the repository at this point in the history
  • Loading branch information
drivebyer committed Mar 21, 2023
1 parent f0a0d6e commit ffc1890
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* Set default MySQL server version to `5.7.35`
* Bump Orchestrator to `3.2.6`
* Change policy/v1beta1 to policy/v1
* Add RBAC permissions when deploying on OpenShift

### Removed

Expand Down
19 changes: 19 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- mysql.presslabs.org
resources:
- mysqlbackups/finalizers
verbs:
- update
- apiGroups:
- mysql.presslabs.org
resources:
Expand All @@ -98,10 +104,17 @@ rules:
- patch
- update
- watch
- apiGroups:
- mysql.presslabs.org
resources:
- mysqlclusters/finalizers
verbs:
- update
- apiGroups:
- mysql.presslabs.org
resources:
- mysqldatabases
- mysqldatabases/finalizers
- mysqldatabases/status
verbs:
- create
Expand All @@ -111,6 +124,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- mysql.presslabs.org
resources:
- mysqldatabases/finalizers
verbs:
- update
- apiGroups:
- mysql.presslabs.org
resources:
Expand Down
19 changes: 19 additions & 0 deletions deploy/charts/mysql-operator/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- mysql.presslabs.org
resources:
- mysqlbackups/finalizers
verbs:
- update
- apiGroups:
- mysql.presslabs.org
resources:
Expand All @@ -98,10 +104,17 @@ rules:
- patch
- update
- watch
- apiGroups:
- mysql.presslabs.org
resources:
- mysqlclusters/finalizers
verbs:
- update
- apiGroups:
- mysql.presslabs.org
resources:
- mysqldatabases
- mysqldatabases/finalizers
- mysqldatabases/status
verbs:
- create
Expand All @@ -111,6 +124,12 @@ rules:
- patch
- update
- watch
- apiGroups:
- mysql.presslabs.org
resources:
- mysqldatabases/finalizers
verbs:
- update
- apiGroups:
- mysql.presslabs.org
resources:
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/mysqlbackup/mysqlbackup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ type ReconcileMysqlBackup struct {
// Automatically generate RBAC rules to allow the Controller to read and write Deployments
// +kubebuilder:rbac:groups=batch,resources=jobs,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=mysql.presslabs.org,resources=mysqlbackups;mysqlbackups/status,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=mysql.presslabs.org,resources=mysqlbackups/finalizers,verbs=update

// Reconcile reads that state of the cluster for a MysqlBackup object and makes changes based on the state read
// and what is in the MysqlBackup.Spec
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/mysqlcluster/mysqlcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ type ReconcileMysqlCluster struct {
// +kubebuilder:rbac:groups=apps,resources=statefulsets,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core,resources=configmaps;secrets;services;events;jobs;pods;persistentvolumeclaims,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=mysql.presslabs.org,resources=mysqlclusters;mysqlclusters/status,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=mysql.presslabs.org,resources=mysqlclusters/finalizers,verbs=update
// +kubebuilder:rbac:groups=policy,resources=poddisruptionbudgets,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;watch;create;update;patch;delete

Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/mysqldatabase/db_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ type ReconcileMySQLDatabase struct {
var _ reconcile.Reconciler = &ReconcileMySQLDatabase{}

// Automatically generate RBAC rules to allow the Controller to read and write Deployments
// +kubebuilder:rbac:groups=mysql.presslabs.org,resources=mysqldatabases;mysqldatabases/status,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=mysql.presslabs.org,resources=mysqldatabases;mysqldatabases/status;mysqldatabases/finalizers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=mysql.presslabs.org,resources=mysqldatabases/finalizers,verbs=update

// Reconcile reads that state of the cluster for a Wordpress object and makes changes based on the state read
// and what is in the Wordpress.Spec
Expand Down

0 comments on commit ffc1890

Please sign in to comment.