Skip to content

Commit

Permalink
Fixes #47 Make clusterRoleBinding optional
Browse files Browse the repository at this point in the history
  • Loading branch information
TJM authored and dtuite committed Jul 15, 2020
1 parent bd945ba commit da792e1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions helm_chart/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if and .Values.rbac.create (eq .Values.clusterRole.create true) -}}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
Expand All @@ -19,3 +20,4 @@ roleRef:
kind: ClusterRole
name: {{ include "kubewise.serviceAccountName" . }}
apiGroup: rbac.authorization.k8s.io
{{- end -}}
23 changes: 23 additions & 0 deletions helm_chart/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if and .Values.rbac.create (eq .Values.clusterRole.create false) -}}
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "kubewise.serviceAccountName" . }}
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["list", "get", "watch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "kubewise.serviceAccountName" . }}
subjects:
- kind: ServiceAccount
name: {{ include "kubewise.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
roleRef:
kind: Role
name: {{ include "kubewise.serviceAccountName" . }}
apiGroup: rbac.authorization.k8s.io
{{- end -}}
9 changes: 9 additions & 0 deletions helm_chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template
name: kubewise

rbac:
# Specifies whether RBAC resources should be created
create: true

# If create is `false` Kubewise will be restricted to the namespace
# where it is deployed, and no ClusterRole or ClusterRoleBinding will be created.
clusterRole:
create: true

podSecurityContext: {}
# fsGroup: 2000

Expand Down

0 comments on commit da792e1

Please sign in to comment.