Repository navigation
feat: add oidcProxy support to Helm chart - #560
Conversation
Add a generic OIDC proxy sidecar option that supports configurable issuer URL, client ID, client secret, cookie secret, redirect URL, and scopes via Helm values.
There was a problem hiding this comment.
Pull request overview
Adds a new, generic oidcProxy oauth2-proxy sidecar option to the Forecastle Helm chart (in addition to the existing OpenShift OAuth proxy) and bumps the chart version.
Changes:
- Introduces
forecastle.oidcProxyvalues for configuring an OIDC oauth2-proxy sidecar. - Updates the Deployment template to conditionally render the OIDC oauth-proxy container and TLS secret volume.
- Bumps chart version to
1.3.0.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
deployments/kubernetes/chart/forecastle/values.yaml |
Adds the oidcProxy configuration block and defaults. |
deployments/kubernetes/chart/forecastle/templates/deployment.yaml |
Renders the OIDC proxy sidecar + TLS volume when enabled. |
deployments/kubernetes/chart/forecastle/Chart.yaml |
Chart version bump to 1.3.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {{- if .Values.forecastle.oidcProxy.enabled }} | ||
| - name: oauth-proxy | ||
| image: "{{ .Values.forecastle.oidcProxy.image }}" | ||
| imagePullPolicy: IfNotPresent | ||
| ports: | ||
| - containerPort: 8443 | ||
| name: public | ||
| args: | ||
| - --https-address=:8443 | ||
| - --provider=oidc | ||
| - --oidc-issuer-url={{ .Values.forecastle.oidcProxy.issuerUrl }} | ||
| - --client-id={{ .Values.forecastle.oidcProxy.clientId }} | ||
| - --redirect-url={{ .Values.forecastle.oidcProxy.redirectUrl }} | ||
| - --upstream=http://localhost:3000 | ||
| - --tls-cert=/etc/tls/private/tls.crt | ||
| - --tls-key=/etc/tls/private/tls.key | ||
| - --email-domain=* | ||
| - --scope={{ .Values.forecastle.oidcProxy.scopes }} |
There was a problem hiding this comment.
oidcProxy adds an oauth2-proxy sidecar listening on 8443, but the chart’s Service template currently switches to port 443/targetPort 8443 only when openshiftOauthProxy.enabled is true. With oidcProxy.enabled=true (and OpenShift proxy disabled), the Service will still route to port 3000, bypassing the proxy / breaking TLS termination. Update templates/service.yaml to treat oidcProxy.enabled the same way (or use a combined condition like or openshiftOauthProxy.enabled oidcProxy.enabled).
| {{- if .Values.forecastle.openshiftOauthProxy.enabled }} | ||
| - name: oauth-proxy | ||
| image: "{{ default "stakater/oauth-proxy:v0.0.2" .Values.forecastle.openshiftOauthProxy.image }}" | ||
| imagePullPolicy: IfNotPresent | ||
| ports: | ||
| - containerPort: 8443 | ||
| name: public | ||
| args: | ||
| - --https-address=:8443 | ||
| - --provider=openshift | ||
| - --openshift-service-account={{ template "forecastle.name" . }} | ||
| - --upstream=http://localhost:3000 | ||
| - --tls-cert=/etc/tls/private/tls.crt | ||
| - --tls-key=/etc/tls/private/tls.key | ||
| - --cookie-secret=SECRET | ||
| volumeMounts: | ||
| - mountPath: /etc/tls/private | ||
| name: openshift-oauth-proxy-tls | ||
| {{- with .Values.forecastle.openshiftOauthProxy.securityContext }} | ||
| securityContext: | ||
| {{- toYaml . | nindent 10 }} | ||
| {{- end }} | ||
| {{- if .Values.forecastle.openshiftOauthProxy.resources }} | ||
| resources: | ||
| {{ toYaml .Values.forecastle.openshiftOauthProxy.resources | indent 10 }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if .Values.forecastle.oidcProxy.enabled }} | ||
| - name: oauth-proxy | ||
| image: "{{ .Values.forecastle.oidcProxy.image }}" | ||
| imagePullPolicy: IfNotPresent | ||
| ports: | ||
| - containerPort: 8443 | ||
| name: public |
There was a problem hiding this comment.
Both forecastle.openshiftOauthProxy.enabled and forecastle.oidcProxy.enabled can be set to true, which would render two containers with the same name (oauth-proxy) and the same port name (public) in a single Pod—Kubernetes will reject this manifest. Add a chart-level validation/guard to enforce mutual exclusivity (e.g., fail rendering if both are enabled), or rename one container/port to avoid collisions and make the behavior explicit.
| - name: oauth-proxy | ||
| image: "{{ .Values.forecastle.oidcProxy.image }}" | ||
| imagePullPolicy: IfNotPresent | ||
| ports: | ||
| - containerPort: 8443 | ||
| name: public | ||
| args: | ||
| - --https-address=:8443 | ||
| - --provider=oidc | ||
| - --oidc-issuer-url={{ .Values.forecastle.oidcProxy.issuerUrl }} | ||
| - --client-id={{ .Values.forecastle.oidcProxy.clientId }} | ||
| - --redirect-url={{ .Values.forecastle.oidcProxy.redirectUrl }} | ||
| - --upstream=http://localhost:3000 | ||
| - --tls-cert=/etc/tls/private/tls.crt | ||
| - --tls-key=/etc/tls/private/tls.key | ||
| - --email-domain=* | ||
| - --scope={{ .Values.forecastle.oidcProxy.scopes }} | ||
| env: | ||
| - name: OAUTH2_PROXY_CLIENT_SECRET | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ .Values.forecastle.oidcProxy.clientSecretRef.name }} | ||
| key: {{ .Values.forecastle.oidcProxy.clientSecretRef.key }} | ||
| - name: OAUTH2_PROXY_COOKIE_SECRET | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ .Values.forecastle.oidcProxy.cookieSecretRef.name }} | ||
| key: {{ .Values.forecastle.oidcProxy.cookieSecretRef.key }} |
There was a problem hiding this comment.
When oidcProxy.enabled=true, several required settings can still render as empty/invalid Kubernetes fields (e.g., image: "", secretKeyRef.name/key with empty values, empty --oidc-issuer-url, --client-id, --redirect-url). Consider using Helm required/fail to enforce these values when enabled (and/or provide sensible defaults like the OpenShift proxy does via default). This prevents rendering manifests that will be rejected by the API server or crash-loop immediately.
| {{- if .Values.forecastle.oidcProxy.enabled }} | ||
| - name: oauth-proxy | ||
| image: "{{ .Values.forecastle.oidcProxy.image }}" | ||
| imagePullPolicy: IfNotPresent | ||
| ports: | ||
| - containerPort: 8443 | ||
| name: public | ||
| args: | ||
| - --https-address=:8443 | ||
| - --provider=oidc | ||
| - --oidc-issuer-url={{ .Values.forecastle.oidcProxy.issuerUrl }} | ||
| - --client-id={{ .Values.forecastle.oidcProxy.clientId }} | ||
| - --redirect-url={{ .Values.forecastle.oidcProxy.redirectUrl }} | ||
| - --upstream=http://localhost:3000 | ||
| - --tls-cert=/etc/tls/private/tls.crt | ||
| - --tls-key=/etc/tls/private/tls.key | ||
| - --email-domain=* | ||
| - --scope={{ .Values.forecastle.oidcProxy.scopes }} | ||
| env: | ||
| - name: OAUTH2_PROXY_CLIENT_SECRET | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ .Values.forecastle.oidcProxy.clientSecretRef.name }} | ||
| key: {{ .Values.forecastle.oidcProxy.clientSecretRef.key }} | ||
| - name: OAUTH2_PROXY_COOKIE_SECRET | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ .Values.forecastle.oidcProxy.cookieSecretRef.name }} | ||
| key: {{ .Values.forecastle.oidcProxy.cookieSecretRef.key }} | ||
| volumeMounts: | ||
| - mountPath: /etc/tls/private | ||
| name: oauth-proxy-tls | ||
| {{- with .Values.forecastle.oidcProxy.securityContext }} | ||
| securityContext: | ||
| {{- toYaml . | nindent 10 }} | ||
| {{- end }} | ||
| {{- if .Values.forecastle.oidcProxy.resources }} | ||
| resources: | ||
| {{ toYaml .Values.forecastle.oidcProxy.resources | indent 10 }} | ||
| {{- end }} | ||
| {{- end }} |
There was a problem hiding this comment.
This PR adds new conditional rendering paths for the Deployment (oidcProxy), but the chart has existing helm-unittest coverage in chart/forecastle/tests/deployment_test.yaml and no new tests were added for the new sidecar. Add tests that assert: (1) oidcProxy.enabled=true renders the oauth-proxy container with --provider=oidc and the expected env/volumeMounts, and (2) mutual exclusivity/validation behavior if both proxies are enabled.
| oidcProxy: | ||
| enabled: false | ||
| image: "" | ||
| issuerUrl: "" | ||
| clientId: "" | ||
| redirectUrl: "" | ||
| scopes: "openid email profile" | ||
| clientSecretRef: | ||
| name: "" | ||
| key: "" | ||
| cookieSecretRef: | ||
| name: "" | ||
| key: "" |
There was a problem hiding this comment.
oidcProxy defaults (image, issuerUrl, clientId, redirectUrl, and secret refs) are empty strings. If a user sets oidcProxy.enabled=true and forgets to override one of these, the rendered manifests will be invalid or the proxy will fail to start. Consider either providing a sane default image (similar to openshiftOauthProxy.image) and/or adding chart validations (via required/fail) so Helm fails fast with a clear message when required fields are missing.
| version: 1.3.0 | ||
| appVersion: "v2.0.0" |
There was a problem hiding this comment.
Chart version is bumped to 1.3.0, but values.yaml still sets forecastle.labels.version: 1.2.0 (used in _helpers.tpl for resource labels). This will make labels inconsistent with the chart release version. Consider updating the default label value to 1.3.0 or deriving it from .Chart.Version to avoid manual drift.
- Add mutual exclusivity guard: fail if both openshiftOauthProxy and oidcProxy are enabled - Add required field validation for image, issuerUrl, clientId, redirectUrl, and secret refs when oidcProxy is enabled - Rename oidcProxy container to 'oidc-proxy' to avoid name collision - Update service.yaml to route to proxy port when oidcProxy is enabled - Update label version to 1.3.0 to match chart version
Summary
oidcProxy) alongside the existingopenshiftOauthProxyTest plan
helm templatewithoidcProxy.enabled=truerenders oauth-proxy sidecar with--provider=oidchelm templatewithopenshiftOauthProxy.enabled=truestill works as before