Skip to content

Commit

Permalink
Dynamically create stash-sidecar ClusterRole in operator (#221)
Browse files Browse the repository at this point in the history
Fixes #220
  • Loading branch information
tamalsaha authored Nov 12, 2017
1 parent 51530be commit d18c00b
Show file tree
Hide file tree
Showing 8 changed files with 238 additions and 104 deletions.
13 changes: 7 additions & 6 deletions chart/stable/stash/templates/cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ rules:
resources: ["*"]
verbs: ["*"]
- apiGroups:
- extensions
- apps
resources:
- replicasets
- daemonsets
- deployments
verbs: ["get", "list", "watch", "patch"]
- apiGroups:
- apps
- extensions
resources:
- deployments
- replicasets
- daemonsets
verbs: ["get", "list", "watch", "patch"]
- apiGroups: [""]
resources:
Expand All @@ -44,7 +44,7 @@ rules:
- apiGroups: [""]
resources:
- configmaps
verbs: ["delete"]
verbs: ["create", "update", "get", "delete"]
- apiGroups: [""]
resources:
- secrets
Expand All @@ -60,6 +60,7 @@ rules:
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterroles
- rolebindings
verbs: ["get", "create", "delete", "patch"]
{{ end }}
2 changes: 2 additions & 0 deletions chart/stable/stash/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ metadata:
app: "{{ template "stash.name" . }}"
heritage: "{{ .Release.Service }}"
release: "{{ .Release.Name }}"
initializers:
pending: []
spec:
replicas: {{ .Values.replicaCount }}
template:
Expand Down
6 changes: 3 additions & 3 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 11 additions & 44 deletions hack/deploy/with-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ rules:
resources: ["*"]
verbs: ["*"]
- apiGroups:
- extensions
- apps
resources:
- replicasets
- daemonsets
- deployments
verbs: ["get", "list", "watch", "patch"]
- apiGroups:
- apps
- extensions
resources:
- deployments
- replicasets
- daemonsets
verbs: ["get", "list", "watch", "patch"]
- apiGroups: [""]
resources:
Expand All @@ -40,7 +40,7 @@ rules:
- apiGroups: [""]
resources:
- configmaps
verbs: ["delete"]
verbs: ["create", "update", "get", "delete"]
- apiGroups: [""]
resources:
- secrets
Expand All @@ -56,6 +56,7 @@ rules:
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterroles
- rolebindings
verbs: ["get", "create", "delete", "patch"]
---
Expand Down Expand Up @@ -85,10 +86,12 @@ metadata:
apiVersion: apps/v1beta1
kind: Deployment
metadata:
labels:
app: stash
name: stash-operator
namespace: kube-system
labels:
app: stash
initializers:
pending: []
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -153,39 +156,3 @@ spec:
targetPort: http
selector:
app: stash
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
labels:
app: stash
name: stash-sidecar
rules:
- apiGroups:
- stash.appscode.com
resources: ["*"]
verbs: ["*"]
- apiGroups:
- apps
resources:
- deployments
verbs: ["get"]
- apiGroups:
- extensions
resources:
- daemonsets
- replicasets
verbs: ["get"]
- apiGroups: [""]
resources:
- replicationcontrollers
- secrets
verbs: ["get"]
- apiGroups: [""]
resources:
- configmaps
verbs: ["create", "update", "get"]
- apiGroups: [""]
resources:
- events
verbs: ["create"]
6 changes: 4 additions & 2 deletions hack/deploy/without-rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
apiVersion: apps/v1beta1
kind: Deployment
metadata:
labels:
app: stash
name: stash-operator
namespace: kube-system
labels:
app: stash
initializers:
pending: []
spec:
replicas: 1
selector:
Expand Down
97 changes: 97 additions & 0 deletions vendor/github.com/appscode/kutil/rbac/v1beta1/clusterrole.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d18c00b

Please sign in to comment.