Skip to content

Commit

Permalink
Merge pull request #195 from Bregor/features/rbac
Browse files Browse the repository at this point in the history
RBAC support
  • Loading branch information
vdice committed May 31, 2017
2 parents ba10a4f + ff4058d commit b4b3aef
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if (.Values.global.use_rbac) -}}
{{- if (.Capabilities.APIVersions.Has (include "rbacAPIVersion" .)) -}}
kind: Role
apiVersion: {{ template "rbacAPIVersion" . }}
metadata:
name: deis-monitor-telegraf
labels:
app: deis-monitor-telegraf
heritage: deis
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get"]
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if (.Values.global.use_rbac) -}}
{{- if (.Capabilities.APIVersions.Has (include "rbacAPIVersion" .)) -}}
kind: RoleBinding
apiVersion: {{ template "rbacAPIVersion" . }}
metadata:
name: deis-monitor-telegraf
labels:
app: deis-monitor-telegraf
heritage: deis
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: deis-monitor-telegraf
subjects:
- kind: ServiceAccount
name: deis-monitor-telegraf
{{- end -}}
{{- end -}}
10 changes: 10 additions & 0 deletions charts/monitor/templates/_helpers.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{/*
Set apiVersion based on Kubernetes version
*/}}
{{- define "rbacAPIVersion" -}}
{{- if ge .Capabilities.KubeVersion.Minor "6" -}}
rbac.authorization.k8s.io/v1beta1
{{- else -}}
rbac.authorization.k8s.io/v1alpha1
{{- end -}}
{{- end -}}
2 changes: 2 additions & 0 deletions charts/monitor/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ global:
# - on-cluster: Run Redis within the Kubernetes cluster
# - off-cluster: Run Redis outside the Kubernetes cluster (configure in loggerRedis section)
logger_redis_location: "on-cluster"
# Role-Based Access Control for Kubernetes >= 1.5
use_rbac: false

0 comments on commit b4b3aef

Please sign in to comment.