Skip to content

Commit

Permalink
Merge pull request #344 from Bregor/features/rbac
Browse files Browse the repository at this point in the history
RBAC support
  • Loading branch information
vdice authored May 31, 2017
2 parents 1377bd7 + c9769fe commit 0272d4b
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 1 deletion.
10 changes: 10 additions & 0 deletions charts/router/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 -}}
21 changes: 21 additions & 0 deletions charts/router/templates/router-clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if (.Values.global.use_rbac) -}}
{{- if (.Capabilities.APIVersions.Has (include "rbacAPIVersion" .)) -}}
kind: ClusterRole
apiVersion: {{ template "rbacAPIVersion" . }}
metadata:
name: deis:deis-router
labels:
app: deis-router
heritage: deis
rules:
- apiGroups: [""]
resources: ["services"]
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get"]
{{- end -}}
{{- end -}}
19 changes: 19 additions & 0 deletions charts/router/templates/router-clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if (.Values.global.use_rbac) -}}
{{- if (.Capabilities.APIVersions.Has (include "rbacAPIVersion" .)) -}}
kind: ClusterRoleBinding
apiVersion: {{ template "rbacAPIVersion" . }}
metadata:
name: deis:deis-router
labels:
app: deis-router
heritage: deis
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: deis:deis-router
subjects:
- kind: ServiceAccount
name: deis-router
namespace: {{ .Release.Namespace }}
{{- end -}}
{{- end -}}
15 changes: 15 additions & 0 deletions charts/router/templates/router-role.yaml
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" .)) -}}
apiVersion: {{ template "rbacAPIVersion" . }}
kind: Role
metadata:
labels:
app: deis-router
heritage: deis
name: deis-router
rules:
- apiGroups: ["extensions", "apps"]
resources: ["deployments"]
verbs: ["get"]
{{- end -}}
{{- end -}}
16 changes: 16 additions & 0 deletions charts/router/templates/router-rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if (.Values.global.use_rbac) -}}
{{- if (.Capabilities.APIVersions.Has (include "rbacAPIVersion" .)) -}}
kind: RoleBinding
apiVersion: {{ template "rbacAPIVersion" . }}
metadata:
name: deis-router
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: deis-router
subjects:
- kind: ServiceAccount
name: deis-router
namespace: {{ .Release.Namespace }}
{{- end -}}
{{- end -}}
4 changes: 3 additions & 1 deletion charts/router/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dhparam: ""
host_port:
enabled: false

# Service type default to LoadBalancer
# Service type default to LoadBalancer
# service_type: LoadBalancer

global:
Expand All @@ -32,3 +32,5 @@ global:
# - true: The Deis router will NOT be deployed. Inherently workflow will not be usable until a Kubernetes ingress controller is installed.
# - false: The default mode, and the default behavior of Deis workflow.
experimental_native_ingress: false
# Role-Based Access Control for Kubernetes >= 1.5
use_rbac: false

0 comments on commit 0272d4b

Please sign in to comment.