Skip to content

Commit

Permalink
Add RBAC permission for appcatalog
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Oct 3, 2018
1 parent 6c8c232 commit 30705d7
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
34 changes: 34 additions & 0 deletions chart/kubedb/templates/appcatalog-user-roles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{ if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: appscode:appcatalog:admin
labels:
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
rules:
- apiGroups:
- appcatalog.appscode.com
resources:
- "*"
verbs: ["*"]
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: appscode:appcatalog:view
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": before-hook-creation
rules:
- apiGroups:
- appcatalog.appscode.com
resources:
- "*"
verbs: ["get", "list", "watch"]
{{ end }}
5 changes: 5 additions & 0 deletions chart/kubedb/templates/cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ rules:
resources:
- "*"
verbs: ["*"]
- apiGroups:
- appcatalog.appscode.com
resources:
- "*"
verbs: ["*"]
- apiGroups:
- monitoring.coreos.com
resources:
Expand Down
26 changes: 26 additions & 0 deletions hack/deploy/appcatalog-user-roles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: appscode:appcatalog:admin
labels:
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rules:
- apiGroups:
- appcatalog.appscode.com
resources:
- "*"
verbs: ["*"]
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: appscode:appcatalog:view
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups:
- appcatalog.appscode.com
resources:
- "*"
verbs: ["get", "list", "watch"]
1 change: 1 addition & 0 deletions hack/deploy/kubedb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ if [ "$KUBEDB_ENABLE_RBAC" = true ]; then
${SCRIPT_LOCATION}hack/deploy/service-account.yaml | $ONESSL envsubst | kubectl apply -f -
${SCRIPT_LOCATION}hack/deploy/rbac-list.yaml | $ONESSL envsubst | kubectl auth reconcile -f -
${SCRIPT_LOCATION}hack/deploy/user-roles.yaml | $ONESSL envsubst | kubectl auth reconcile -f -
${SCRIPT_LOCATION}hack/deploy/appcatalog-user-roles.yaml | $ONESSL envsubst | kubectl auth reconcile -f -
fi

if [ "$KUBEDB_RUN_ON_MASTER" -eq 1 ]; then
Expand Down
5 changes: 5 additions & 0 deletions hack/deploy/rbac-list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ rules:
resources:
- "*"
verbs: ["*"]
- apiGroups:
- appcatalog.appscode.com
resources:
- "*"
verbs: ["*"]
- apiGroups:
- monitoring.coreos.com
resources:
Expand Down

0 comments on commit 30705d7

Please sign in to comment.