Skip to content

Commit

Permalink
🐛 Fix RBAC to allow IonosCloudMachine Controller updating secrets (#116)
Browse files Browse the repository at this point in the history
**What is the purpose of this pull request/Why do we need it?**
This PR gives the IonosCloudMachine Controller permissions to update
secrets. This was not possible before, which led to errors when the
controller was trying to update the secret.

**Description of changes:**
Fix RBAC to allow IonosCloudMachine controller to update secrets.

**Checklist:**
- [x] Includes
[emojis](https://github.com/kubernetes-sigs/kubebuilder-release-tools?tab=readme-ov-file#kubebuilder-project-versioning)
  • Loading branch information
jriedel-ionos authored May 7, 2024
1 parent 1b58f35 commit 8830c9a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ rules:
verbs:
- get
- list
- update
- watch
- apiGroups:
- authentication.k8s.io
Expand Down
2 changes: 2 additions & 0 deletions internal/controller/ionoscloudcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ type IonosCloudClusterReconciler struct {

//+kubebuilder:rbac:groups=cluster.x-k8s.io,resources=clusters;clusters/status,verbs=get;list;watch

//+kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch;update

// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
//
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/ionoscloudmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type IonosCloudMachineReconciler struct {
//+kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=ionoscloudmachines/finalizers,verbs=update

//+kubebuilder:rbac:groups=cluster.x-k8s.io,resources=machines;machines/status,verbs=get;list;watch
//+kubebuilder:rbac:groups="",resources=secrets;,verbs=get;list;watch
//+kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch;update
//+kubebuilder:rbac:groups="",resources=events,verbs=get;list;watch;create;update;patch

func (r *IonosCloudMachineReconciler) Reconcile(
Expand Down

0 comments on commit 8830c9a

Please sign in to comment.