diff --git a/charts/oauth2-proxy/Chart.yaml b/charts/oauth2-proxy/Chart.yaml index d773c3d6..5ae29422 100644 --- a/charts/oauth2-proxy/Chart.yaml +++ b/charts/oauth2-proxy/Chart.yaml @@ -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/ diff --git a/charts/oauth2-proxy/README.md b/charts/oauth2-proxy/README.md index aef58518..21433b63 100644 --- a/charts/oauth2-proxy/README.md +++ b/charts/oauth2-proxy/README.md @@ -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` diff --git a/charts/oauth2-proxy/templates/deployment.yaml b/charts/oauth2-proxy/templates/deployment.yaml index e2e803f6..acf4814a 100644 --- a/charts/oauth2-proxy/templates/deployment.yaml +++ b/charts/oauth2-proxy/templates/deployment.yaml @@ -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 }} diff --git a/charts/oauth2-proxy/values.yaml b/charts/oauth2-proxy/values.yaml index 62299caa..bcbab3f5 100644 --- a/charts/oauth2-proxy/values.yaml +++ b/charts/oauth2-proxy/values.yaml @@ -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