Skip to content
This repository was archived by the owner on May 28, 2021. It is now read-only.

Fix RBAC by making more restrictive #113

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 59 additions & 3 deletions mysql-operator/templates/02-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,67 @@ metadata:
namespace: {{ .Values.operator.namespace}}{{ end }}
rules:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need two ClusterRoles: mysql-agent and mysql-operator as the components require different permissions (principle of least privilege).

We need a ServiceAccount mysql-operator and corresponding ClusterRoleBinding in the namespace into which the operator is being installed.

Users must create a ServiceAccount mysql-agent and RoleBinding to the ClusterRole mysql-agnet in each namespace they want to deploy clusters. We should not create this in the default namespace automatically but rather document the requirement clearly.

- apiGroups:
- "*"
- mysql.oracle.com
resources:
- "*"
- mysqlclusters
- mysqlbackups
- mysqlbackupschedules
- mysqlrestores
verbs: ["*"]
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a problem when cluster scoped. Can we remove this one?

- create
- delete
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be needed

- apiGroups:
- apps
resources:
- statefulsets
verbs:
- get
- list
- watch
- patch
- create
- update
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- update
- patch
- apiGroups:
- ""
resources:
- pods
verbs:
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- services
verbs:
- "*"
- get
- list
- watch
- create
- delete
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be needed

---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: {{ if .Values.operator.global }}Cluster{{ end }}RoleBinding
Expand Down