[oauth2-proxy] Add support for topologySpreadConstraints (#496)

Signed-off-by: Stephan Austermühle <au@hcsd.de>
This commit is contained in:
Stephan 2021-01-14 21:57:07 +01:00 committed by GitHub
parent 36dd871e05
commit 7f01d91432
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 1 deletions

View File

@ -1,5 +1,5 @@
name: oauth2-proxy
version: 4.1.0
version: 4.2.0
apiVersion: v1
appVersion: 5.1.0
home: https://oauth2-proxy.github.io/oauth2-proxy/

View File

@ -119,6 +119,10 @@ Parameter | Description | Default
`serviceAccount.name` | the service account name | ``
`serviceAccount.annotations` | (optional) annotations for the service account | `{}`
`tolerations` | list of node taints to tolerate | `[]`
`topologySpreadConstraints.enabled` | enable Kubernetes [topologySpreadConstraints](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) | `false`
`topologySpreadConstraints.maxSkew` | the degree to which Pods may be unevenly distributed | `1`
`topologySpreadConstraints.topologyKey` | the key of node labels | `topology.kubernetes.io/zone`
`topologySpreadConstraints.whenUnsatisfiable` | how to deal with a Pod if it doesn't satisfy the spread constraint (`DoNotSchedule`, `ScheduleAnyway`) | `DoNotSchedule`
`securityContext.enabled` | enable Kubernetes security context on container | `false`
`securityContext.runAsNonRoot` | make sure that the container runs as a non-root user | `true`
`proxyVarsAsSecrets` | choose between environment values or secrets for setting up OAUTH2_PROXY variables. When set to false, remember to add the variables OAUTH2_PROXY_CLIENT_ID, OAUTH2_PROXY_CLIENT_SECRET, OAUTH2_PROXY_COOKIE_SECRET in extraEnv | `true`

View File

@ -208,3 +208,15 @@ spec:
{{- end }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if .Values.topologySpreadConstraints.enabled }}
topologySpreadConstraints:
- labelSelector:
matchLabels:
app: {{ template "oauth2-proxy.name" . }}
release: "{{ .Release.Name }}"
maxSkew: {{ .Values.topologySpreadConstraints.maxSkew }}
topologyKey: {{ .Values.topologySpreadConstraints.topologyKey }}
whenUnsatisfiable: {{ .Values.topologySpreadConstraints.whenUnsatisfiable }}
{{- end }}
{{- end }}

View File

@ -186,3 +186,13 @@ htpasswdFile:
# example:
# entries:
# - testuser:{SHA}EWhzdhgoYJWy0z2gyzhRYlN9DSiv
## Configure Pod Topology Spread Constraints
## See https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
## Requires Kubernetes >= v1.16
topologySpreadConstraints:
enabled: false
maxSkew: 1
# See https://kubernetes.io/docs/reference/kubernetes-api/labels-annotations-taints/
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule