Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RBAC support #513

Merged
merged 2 commits into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions charts/builder/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 -}}
15 changes: 15 additions & 0 deletions charts/builder/templates/builder-clusterrole.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" .)) -}}
kind: ClusterRole
apiVersion: {{ template "rbacAPIVersion" . }}
metadata:
name: deis:deis-builder
labels:
app: deis-builder
heritage: deis
rules:
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["list"]
{{- end -}}
{{- end -}}
19 changes: 19 additions & 0 deletions charts/builder/templates/builder-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-builder
labels:
app: deis-builder
heritage: deis
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: deis:deis-builder
subjects:
- kind: ServiceAccount
name: deis-builder
namespace: {{ .Release.Namespace }}
{{- end -}}
{{- end -}}
21 changes: 21 additions & 0 deletions charts/builder/templates/builder-role.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: Role
apiVersion: {{ template "rbacAPIVersion" . }}
metadata:
name: deis-builder
labels:
app: deis-builder
heritage: deis
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["create", "update", "delete"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["create", "get", "watch", "list"]
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get"]
{{- end -}}
{{- end -}}
18 changes: 18 additions & 0 deletions charts/builder/templates/builder-rolebinding.yaml
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-builder
labels:
app: deis-builder
heritage: deis
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: deis-builder
subjects:
- kind: ServiceAccount
name: deis-builder
{{- end -}}
{{- end -}}
2 changes: 2 additions & 0 deletions charts/builder/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ global:
# - true: The deis controller will now create Kubernetes ingress rules for each app, and ingress rules will automatically be created for the controller itself.
# - 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