From 6078fe10f12c329a01c8de90caa3a052efe6b1ec Mon Sep 17 00:00:00 2001 From: Thomas Borup Date: Wed, 29 Jan 2020 08:04:14 +0100 Subject: [PATCH] =?UTF-8?q?[stable/oauth2-proxy]=20Add=20posibility=20for?= =?UTF-8?q?=20using=20environment=20values=20ins=E2=80=A6=20(#20029)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [stable/oauth2-proxy] Add posibility for using environment values instead of secrets Signed-off-by: Thomas Borup * Renamed variable and flipped boolean value to avoid double negation Signed-off-by: Thomas Borup --- stable/oauth2-proxy/Chart.yaml | 2 +- stable/oauth2-proxy/README.md | 1 + stable/oauth2-proxy/templates/deployment.yaml | 2 ++ stable/oauth2-proxy/templates/secret.yaml | 2 +- stable/oauth2-proxy/values.yaml | 3 +++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/stable/oauth2-proxy/Chart.yaml b/stable/oauth2-proxy/Chart.yaml index 3292813d92..d06e6d05d2 100644 --- a/stable/oauth2-proxy/Chart.yaml +++ b/stable/oauth2-proxy/Chart.yaml @@ -1,5 +1,5 @@ name: oauth2-proxy -version: 2.1.1 +version: 2.2.1 apiVersion: v1 appVersion: 4.0.0 home: https://pusher.github.io/oauth2_proxy/ diff --git a/stable/oauth2-proxy/README.md b/stable/oauth2-proxy/README.md index 98ae78898b..2fd3c4a38d 100644 --- a/stable/oauth2-proxy/README.md +++ b/stable/oauth2-proxy/README.md @@ -107,6 +107,7 @@ Parameter | Description | Default `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` +`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` Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, diff --git a/stable/oauth2-proxy/templates/deployment.yaml b/stable/oauth2-proxy/templates/deployment.yaml index 76991a1aed..312e5f44cf 100644 --- a/stable/oauth2-proxy/templates/deployment.yaml +++ b/stable/oauth2-proxy/templates/deployment.yaml @@ -65,6 +65,7 @@ spec: {{- if .Values.htpasswdFile.enabled }} - --htpasswd-file=/etc/oauth2_proxy/htpasswd/users.txt {{- end }} + {{- if .Values.proxyVarsAsSecrets }} env: - name: OAUTH2_PROXY_CLIENT_ID valueFrom: @@ -81,6 +82,7 @@ spec: secretKeyRef: name: {{ template "oauth2-proxy.secretName" . }} key: cookie-secret + {{- end }} {{- if .Values.extraEnv }} {{ toYaml .Values.extraEnv | indent 8 }} {{- end }} diff --git a/stable/oauth2-proxy/templates/secret.yaml b/stable/oauth2-proxy/templates/secret.yaml index 858fe9f417..89134fa0d1 100644 --- a/stable/oauth2-proxy/templates/secret.yaml +++ b/stable/oauth2-proxy/templates/secret.yaml @@ -1,4 +1,4 @@ -{{- if not .Values.config.existingSecret }} +{{- if and (not .Values.config.existingSecret) (.Values.proxyVarsAsSecrets) }} apiVersion: v1 kind: Secret metadata: diff --git a/stable/oauth2-proxy/values.yaml b/stable/oauth2-proxy/values.yaml index 0b2b3df11b..a21d753c9e 100644 --- a/stable/oauth2-proxy/values.yaml +++ b/stable/oauth2-proxy/values.yaml @@ -116,6 +116,9 @@ tolerations: [] # Ref: https://kubernetes.io/docs/user-guide/node-selection/ nodeSelector: {} +# Whether to use secrets instead of environment values for setting up OAUTH2_PROXY variables +proxyVarsAsSecrets: true + # Configure Kubernetes liveness and readiness probes. # Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/ # Disable both when deploying with Istio 1.0 mTLS. https://istio.io/help/faq/security/#k8s-health-checks