Skip to content

Commit 0272d4b

Browse files
authored
Merge pull request #344 from Bregor/features/rbac
RBAC support
2 parents 1377bd7 + c9769fe commit 0272d4b

6 files changed

+84
-1
lines changed

charts/router/templates/_helpers.tmpl

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{/*
2+
Set apiVersion based on Kubernetes version
3+
*/}}
4+
{{- define "rbacAPIVersion" -}}
5+
{{- if ge .Capabilities.KubeVersion.Minor "6" -}}
6+
rbac.authorization.k8s.io/v1beta1
7+
{{- else -}}
8+
rbac.authorization.k8s.io/v1alpha1
9+
{{- end -}}
10+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- if (.Values.global.use_rbac) -}}
2+
{{- if (.Capabilities.APIVersions.Has (include "rbacAPIVersion" .)) -}}
3+
kind: ClusterRole
4+
apiVersion: {{ template "rbacAPIVersion" . }}
5+
metadata:
6+
name: deis:deis-router
7+
labels:
8+
app: deis-router
9+
heritage: deis
10+
rules:
11+
- apiGroups: [""]
12+
resources: ["services"]
13+
verbs: ["get", "list"]
14+
- apiGroups: [""]
15+
resources: ["secrets"]
16+
verbs: ["get"]
17+
- apiGroups: [""]
18+
resources: ["endpoints"]
19+
verbs: ["get"]
20+
{{- end -}}
21+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- if (.Values.global.use_rbac) -}}
2+
{{- if (.Capabilities.APIVersions.Has (include "rbacAPIVersion" .)) -}}
3+
kind: ClusterRoleBinding
4+
apiVersion: {{ template "rbacAPIVersion" . }}
5+
metadata:
6+
name: deis:deis-router
7+
labels:
8+
app: deis-router
9+
heritage: deis
10+
roleRef:
11+
apiGroup: rbac.authorization.k8s.io
12+
kind: ClusterRole
13+
name: deis:deis-router
14+
subjects:
15+
- kind: ServiceAccount
16+
name: deis-router
17+
namespace: {{ .Release.Namespace }}
18+
{{- end -}}
19+
{{- end -}}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- if (.Values.global.use_rbac) -}}
2+
{{- if (.Capabilities.APIVersions.Has (include "rbacAPIVersion" .)) -}}
3+
apiVersion: {{ template "rbacAPIVersion" . }}
4+
kind: Role
5+
metadata:
6+
labels:
7+
app: deis-router
8+
heritage: deis
9+
name: deis-router
10+
rules:
11+
- apiGroups: ["extensions", "apps"]
12+
resources: ["deployments"]
13+
verbs: ["get"]
14+
{{- end -}}
15+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- if (.Values.global.use_rbac) -}}
2+
{{- if (.Capabilities.APIVersions.Has (include "rbacAPIVersion" .)) -}}
3+
kind: RoleBinding
4+
apiVersion: {{ template "rbacAPIVersion" . }}
5+
metadata:
6+
name: deis-router
7+
roleRef:
8+
apiGroup: rbac.authorization.k8s.io
9+
kind: Role
10+
name: deis-router
11+
subjects:
12+
- kind: ServiceAccount
13+
name: deis-router
14+
namespace: {{ .Release.Namespace }}
15+
{{- end -}}
16+
{{- end -}}

charts/router/values.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dhparam: ""
2222
host_port:
2323
enabled: false
2424

25-
# Service type default to LoadBalancer
25+
# Service type default to LoadBalancer
2626
# service_type: LoadBalancer
2727

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

0 commit comments

Comments
 (0)