Skip to content

Commit

Permalink
[stable/kube2iam]: add rbac support (helm#1286)
Browse files Browse the repository at this point in the history
* add rbac support

* solve and edge-case when turning off rbac
  • Loading branch information
SamClinckspoor authored and Vic Iglesias committed Jul 6, 2017
1 parent 5b482a4 commit 52c60ec
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stable/kube2iam/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: kube2iam
version: 0.3.0
version: 0.3.1
description: Provide IAM credentials to pods based on annotations.
keywords:
- kube2iam
Expand Down
1 change: 1 addition & 0 deletions stable/kube2iam/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Parameter | Description | Default
`podAnnotations` | annotations to be added to pods | `{}`
`resources` | pod resource requests & limits | `{}`
`verbose` | Enable verbose output | `false`
`rbac.enabled` | Enable role and serviceaccount creation | `false`
`updateStrategy` | The strategy for daemon set updates, e.g. `RollingUpdate` (requires Kubernetes 1.6+) | not set

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
Expand Down
5 changes: 5 additions & 0 deletions stable/kube2iam/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ spec:
app: {{ template "name" . }}
release: {{ .Release.Name }}
spec:
{{- if .Values.rbac.enabled }}
serviceAccountName: {{ template "fullname" . }}
{{- else }}
serviceAccountName: default
{{- end }}
containers:
- name: kube2iam
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
Expand Down
19 changes: 19 additions & 0 deletions stable/kube2iam/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.rbac.enabled -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "fullname" . }}
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- watch
- list
{{- end -}}
19 changes: 19 additions & 0 deletions stable/kube2iam/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.rbac.enabled -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
11 changes: 11 additions & 0 deletions stable/kube2iam/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.rbac.enabled -}}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "fullname" . }}
{{- end -}}
3 changes: 3 additions & 0 deletions stable/kube2iam/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ resources: {}
# memory: 16Mi

verbose: false

rbac:
enabled: false

0 comments on commit 52c60ec

Please sign in to comment.