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 Apr 11, 2023
1 parent bf08f81 commit f2e9bc8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
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
3 changes: 3 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ rules:
- mysql.presslabs.org
resources:
- mysqlbackups
- mysqlbackups/finalizers
- mysqlbackups/status
verbs:
- create
Expand All @@ -89,6 +90,7 @@ rules:
- mysql.presslabs.org
resources:
- mysqlclusters
- mysqlclusters/finalizers
- mysqlclusters/status
verbs:
- create
Expand All @@ -102,6 +104,7 @@ rules:
- mysql.presslabs.org
resources:
- mysqldatabases
- mysqldatabases/finalizers
- mysqldatabases/status
verbs:
- create
Expand Down
3 changes: 3 additions & 0 deletions deploy/charts/mysql-operator/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ rules:
- mysql.presslabs.org
resources:
- mysqlbackups
- mysqlbackups/finalizers
- mysqlbackups/status
verbs:
- create
Expand All @@ -89,6 +90,7 @@ rules:
- mysql.presslabs.org
resources:
- mysqlclusters
- mysqlclusters/finalizers
- mysqlclusters/status
verbs:
- create
Expand All @@ -102,6 +104,7 @@ rules:
- mysql.presslabs.org
resources:
- mysqldatabases
- mysqldatabases/finalizers
- mysqldatabases/status
verbs:
- create
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/mysqlbackup/mysqlbackup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,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;mysqlbackups/status;mysqlbackups/finalizers,verbs=get;list;watch;create;update;patch;delete

// 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
2 changes: 1 addition & 1 deletion pkg/controller/mysqlcluster/mysqlcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ type ReconcileMysqlCluster struct {
// Automatically generate RBAC rules to allow the Controller to read and write Deployments
// +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;mysqlclusters/status;mysqlclusters/finalizers,verbs=get;list;watch;create;update;patch;delete
// +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
2 changes: 1 addition & 1 deletion pkg/controller/mysqldatabase/db_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ 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

// 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 f2e9bc8

Please sign in to comment.