Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict RBAC permissions #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
31 changes: 31 additions & 0 deletions deploy/cluster_role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ext-postgres-operator
rules:
- apiGroups:
- ""
resources:
- secrets
verbs:
- '*'
- apiGroups:
- apps
resourceNames:
- ext-postgres-operator
resources:
- deployments/finalizers
verbs:
- update
- apiGroups:
- db.movetokube.com
resources:
- '*'
verbs:
- '*'
- apiGroups:
- monitoring.coreos.com
resources:
- servicemonitors
verbs:
- '*'
11 changes: 11 additions & 0 deletions deploy/cluster_role_binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ext-postgres-operator
subjects:
- kind: ServiceAccount
name: ext-postgres-operator
roleRef:
kind: ClusterRole
name: ext-postgres-operator
apiGroup: rbac.authorization.k8s.io
2 changes: 2 additions & 0 deletions deploy/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ resources:
- crds/db.movetokube.com_postgres_crd.yaml
- crds/db.movetokube.com_postgresusers_crd.yaml
- operator.yaml
- cluster_role.yaml
- cluster_role_binding.yaml
- role.yaml
- role_binding.yaml
- service_account.yaml
32 changes: 9 additions & 23 deletions deploy/role.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,26 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
kind: Role
metadata:
name: ext-postgres-operator
rules:
- apiGroups:
- ""
resources:
- pods
- services
- endpoints
- persistentvolumeclaims
- events
- configmaps
- secrets
- services
verbs:
- '*'
- apiGroups:
- apps
resources:
- deployments
- daemonsets
- replicasets
- statefulsets
verbs:
- '*'
- apiGroups:
- apps
resourceNames:
- ext-postgres-operator
- ""
resources:
- deployments/finalizers
- pods
verbs:
- update
- 'get'
- apiGroups:
- db.movetokube.com
- "apps"
resources:
- '*'
- replicasets
- deployments
verbs:
- '*'
- 'get'
4 changes: 2 additions & 2 deletions deploy/role_binding.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
kind: ClusterRoleBinding
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ext-postgres-operator
subjects:
- kind: ServiceAccount
name: ext-postgres-operator
roleRef:
kind: ClusterRole
kind: Role
name: ext-postgres-operator
apiGroup: rbac.authorization.k8s.io