[oauth2-proxy] Add serviceaccount to support EKS IRSA (#22055)

* [oauth2-proxy] Add serviceaccount to support EKS IRSA

Signed-off-by: Peter Wilson <dearpete@gmail.com>

* [oauth2-proxy] use enabled for consistency and bump major version

Signed-off-by: Peter Wilson <dearpete@gmail.com>

* [oauth2-proxy] Update serviceAccountName helper

Signed-off-by: Peter Wilson <dearpete@gmail.com>
This commit is contained in:
Peter Wilson
2020-04-28 01:20:05 -07:00
committed by GitHub
parent d6d196bc06
commit 7bd86fd63e
6 changed files with 44 additions and 1 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: oauth2-proxy
version: 2.4.1
version: 3.0.0
apiVersion: v1
appVersion: 5.1.0
home: https://pusher.github.io/oauth2_proxy/
+7
View File
@@ -47,6 +47,10 @@ Version 2.0.0 of this chart introduces support for Kubernetes v1.16.x by way of
Due to [this issue](https://github.com/helm/helm/issues/6583) there may be errors performing a `helm upgrade`of this chart from versions earlier than 2.0.0.
### To 3.0.0
Version 3.0.0 introduces support for [EKS IAM roles for service accounts](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html) by adding a managed service account to the chart. This is a breaking change since the service account is enabled by default. To disable this behaviour set `serviceAccount.enabled` to `false`
## Configuration
The following table lists the configurable parameters of the oauth2-proxy chart and their default values.
@@ -104,6 +108,9 @@ Parameter | Description | Default
`service.clusterIP` | cluster ip address | `nil`
`service.loadBalancerIP` | ip of load balancer | `nil`
`service.loadBalancerSourceRanges` | allowed source ranges in load balancer | `nil`
`serviceAccount.enabled` | create a service account | `true`
`serviceAccount.name` | the service account name | ``
`serviceAccount.annotations` | (optional) annotations for the service account | `{}`
`tolerations` | list of node taints to tolerate | `[]`
`securityContext.enabled` | enable Kubernetes security context | `false`
`securityContext.runAsNonRoot` | make sure that the container runs as a non-root user | `true`
@@ -41,3 +41,14 @@ Get the secret name.
{{- printf "%s" (include "oauth2-proxy.fullname" .) -}}
{{- end -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "oauth2-proxy.serviceAccountName" -}}
{{- if .Values.serviceAccount.enabled -}}
{{ default (include "oauth2-proxy.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
@@ -36,6 +36,7 @@ spec:
{{- if .Values.priorityClassName }}
priorityClassName: "{{ .Values.priorityClassName }}"
{{- end }}
serviceAccountName: {{ template "oauth2-proxy.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
@@ -0,0 +1,15 @@
{{- if or .Values.serviceAccount.enabled -}}
apiVersion: v1
kind: ServiceAccount
metadata:
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app: {{ template "oauth2-proxy.name" . }}
chart: {{ template "oauth2-proxy.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
name: {{ template "oauth2-proxy.fullname" . }}
{{- end -}}
+9
View File
@@ -70,6 +70,15 @@ service:
annotations: {}
# foo.io/bar: "true"
## Create or use ServiceAccount
serviceAccount:
## Specifies whether a ServiceAccount should be created
enabled: true
## The name of the ServiceAccount to use.
## If not set and create is true, a name is generated using the fullname template
name:
annotations: {}
ingress:
enabled: false
path: /