Skip to content

Commit

Permalink
Merge pull request #11 from kool-dev/role_rolebinding
Browse files Browse the repository at this point in the history
Adding Role and RoleBinding Support
  • Loading branch information
dbpolito authored Jan 8, 2021
2 parents 91fcbde + 4db6e66 commit 879b2cf
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/generic/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v2
name: generic
description: Generic Chart
version: 1.2.4
version: 1.3.0
7 changes: 7 additions & 0 deletions charts/generic/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- if and (.Values.serviceAccount.create) (.Values.serviceAccount.role.create) -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: {{ include "generic.serviceAccountName" . }}
rules: {{ .Values.serviceAccount.role.rules | nindent 2 }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/generic/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if and (.Values.serviceAccount.create) (.Values.serviceAccount.role.create) -}}
{{- $serviceAccountName := include "generic.serviceAccountName" . -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: {{ $serviceAccountName }}
subjects:
- kind: ServiceAccount
name: {{ $serviceAccountName }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: Role
name: {{ $serviceAccountName }}
apiGroup: rbac.authorization.k8s.io
{{- end }}
6 changes: 5 additions & 1 deletion charts/generic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,13 @@ rollme: false

serviceAccount:
create: true
# annotations:
# annotations: {}
name: ""

role:
create: false
rules: []

# annotations: {}

# securityContext:
Expand Down

0 comments on commit 879b2cf

Please sign in to comment.