Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

[stable/kube-lego]: add RBAC support #1287

Merged
merged 4 commits into from
Aug 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion stable/kube-lego/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: Automatically requests certificates from Let's Encrypt
name: kube-lego
version: 0.1.10
version: 0.1.11
keywords:
- kube-lego
- letsencrypt
Expand Down
2 changes: 2 additions & 0 deletions stable/kube-lego/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Parameter | Description | Default
`podAnnotations` | annotations to be added to pods | `{}`
`replicaCount` | desired number of pods | `1`
`resources` | kube-lego resource requests and limits (YAML) |`{}`
`rbac.create` | Create a role and serviceaccount | `false`
`rbac.serviceAccountName` | serviceaccount name to use if `rbac.create` is false | `default`

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

Expand Down
1 change: 1 addition & 0 deletions stable/kube-lego/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ spec:
app: {{ template "name" . }}
release: {{ .Release.Name }}
spec:
serviceAccountName: {{ if .Values.rbac.create }}{{ template "fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }}
containers:
- name: {{ template "name" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
Expand Down
40 changes: 40 additions & 0 deletions stable/kube-lego/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- if .Values.rbac.create -}}
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:
- services
verbs:
- create
- get
- delete
- apiGroups:
- extensions
resources:
- ingresses
verbs:
- get
- update
- create
- list
- patch
- delete
- watch
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- create
- update
{{- end -}}
19 changes: 19 additions & 0 deletions stable/kube-lego/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.rbac.create -}}
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/kube-lego/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.rbac.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "fullname" . }}
{{- end -}}
4 changes: 4 additions & 0 deletions stable/kube-lego/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ resources: {}
# requests:
# cpu: 20m
# memory: 8Mi

rbac:
create: false
serviceAccountName: default