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

Commit

Permalink
[stable/kube-lego]: add RBAC support (#1287)
Browse files Browse the repository at this point in the history
* add kube-lego RBAC support

* Update to the new RBAC pattern

* Trim the role permissions

* bump the version
  • Loading branch information
SamClinckspoor authored and mgoodness committed Aug 15, 2017
1 parent 9047424 commit fe072f4
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 1 deletion.
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

0 comments on commit fe072f4

Please sign in to comment.