|
| 1 | +{{- if and .Values.frontend.enabled .Values.frontend.auth.enabled .Values.frontend.codeServer.enabled (contains "traefik" (.Values.global.ingressClassName | default "")) }} |
| 2 | +{{- $frontendName := include "vibe-kanban-team.frontend.fullname" . -}} |
| 3 | +{{- $proxyName := printf "%s-oauth2-proxy-code" $frontendName -}} |
| 4 | +{{- $codeServerHost := include "vibe-kanban-team.codeServer.host" . -}} |
| 5 | +--- |
| 6 | +# oauth2-proxy for code-server (Traefik only) — proxies to code-server port. |
| 7 | +apiVersion: apps/v1 |
| 8 | +kind: Deployment |
| 9 | +metadata: |
| 10 | + name: {{ $proxyName }} |
| 11 | + labels: |
| 12 | + {{- include "vibe-kanban-team.labels" . | nindent 4 }} |
| 13 | + app.kubernetes.io/component: oauth2-proxy-code |
| 14 | +spec: |
| 15 | + replicas: 1 |
| 16 | + selector: |
| 17 | + matchLabels: |
| 18 | + {{- include "vibe-kanban-team.selectorLabels" . | nindent 6 }} |
| 19 | + app.kubernetes.io/component: oauth2-proxy-code |
| 20 | + template: |
| 21 | + metadata: |
| 22 | + labels: |
| 23 | + {{- include "vibe-kanban-team.labels" . | nindent 8 }} |
| 24 | + app.kubernetes.io/component: oauth2-proxy-code |
| 25 | + spec: |
| 26 | + {{- with .Values.imagePullSecrets }} |
| 27 | + imagePullSecrets: |
| 28 | + {{- toYaml . | nindent 8 }} |
| 29 | + {{- end }} |
| 30 | + securityContext: |
| 31 | + runAsNonRoot: true |
| 32 | + runAsUser: 65534 |
| 33 | + fsGroup: 65534 |
| 34 | + containers: |
| 35 | + - name: oauth2-proxy |
| 36 | + image: "{{ .Values.frontend.auth.image.repository }}:{{ .Values.frontend.auth.image.tag }}" |
| 37 | + imagePullPolicy: {{ .Values.frontend.auth.image.pullPolicy }} |
| 38 | + args: |
| 39 | + - --provider={{ .Values.frontend.auth.provider | default "google" }} |
| 40 | + {{- if .Values.frontend.auth.oidcIssuerUrl }} |
| 41 | + - --oidc-issuer-url={{ .Values.frontend.auth.oidcIssuerUrl }} |
| 42 | + {{- end }} |
| 43 | + {{- range .Values.frontend.auth.emailDomains }} |
| 44 | + - --email-domain={{ . }} |
| 45 | + {{- end }} |
| 46 | + {{- if gt (len .Values.frontend.auth.allowedEmails) 0 }} |
| 47 | + - --authenticated-emails-file=/etc/oauth2-proxy/emails |
| 48 | + {{- end }} |
| 49 | + {{- if .Values.frontend.auth.githubOrg }} |
| 50 | + - --github-org={{ .Values.frontend.auth.githubOrg }} |
| 51 | + {{- end }} |
| 52 | + {{- if .Values.frontend.auth.githubTeam }} |
| 53 | + - --github-team={{ .Values.frontend.auth.githubTeam }} |
| 54 | + {{- end }} |
| 55 | + {{- range .Values.frontend.auth.extraArgs }} |
| 56 | + - {{ . }} |
| 57 | + {{- end }} |
| 58 | + - --upstream=http://{{ $frontendName }}:{{ .Values.frontend.codeServer.port }}/ |
| 59 | + - --http-address=0.0.0.0:4180 |
| 60 | + - --reverse-proxy=true |
| 61 | + - --set-xauthrequest=true |
| 62 | + - --set-authorization-header=true |
| 63 | + - --cookie-domain={{ .Values.frontend.auth.cookieDomain | default (include "vibe-kanban-team.frontend.cookieDomain" .) }} |
| 64 | + - --cookie-samesite=lax |
| 65 | + - --cookie-secure=true |
| 66 | + - --whitelist-domain={{ .Values.frontend.auth.cookieDomain | default (include "vibe-kanban-team.frontend.cookieDomain" .) }} |
| 67 | + - --redirect-url=https://{{ $codeServerHost }}/oauth2/callback |
| 68 | + - --skip-provider-button=true |
| 69 | + env: |
| 70 | + - name: OAUTH2_PROXY_CLIENT_ID |
| 71 | + valueFrom: |
| 72 | + secretKeyRef: |
| 73 | + name: {{ .Values.frontend.auth.secretName }} |
| 74 | + key: client-id |
| 75 | + - name: OAUTH2_PROXY_CLIENT_SECRET |
| 76 | + valueFrom: |
| 77 | + secretKeyRef: |
| 78 | + name: {{ .Values.frontend.auth.secretName }} |
| 79 | + key: client-secret |
| 80 | + - name: OAUTH2_PROXY_COOKIE_SECRET |
| 81 | + valueFrom: |
| 82 | + secretKeyRef: |
| 83 | + name: {{ .Values.frontend.auth.secretName }} |
| 84 | + key: cookie-secret |
| 85 | + ports: |
| 86 | + - name: http |
| 87 | + containerPort: 4180 |
| 88 | + protocol: TCP |
| 89 | + livenessProbe: |
| 90 | + httpGet: |
| 91 | + path: /ping |
| 92 | + port: http |
| 93 | + initialDelaySeconds: 5 |
| 94 | + periodSeconds: 10 |
| 95 | + readinessProbe: |
| 96 | + httpGet: |
| 97 | + path: /ping |
| 98 | + port: http |
| 99 | + initialDelaySeconds: 3 |
| 100 | + periodSeconds: 5 |
| 101 | + resources: |
| 102 | + {{- toYaml .Values.frontend.auth.resources | nindent 12 }} |
| 103 | + securityContext: |
| 104 | + allowPrivilegeEscalation: false |
| 105 | + readOnlyRootFilesystem: true |
| 106 | + {{- if gt (len .Values.frontend.auth.allowedEmails) 0 }} |
| 107 | + volumeMounts: |
| 108 | + - name: emails |
| 109 | + mountPath: /etc/oauth2-proxy |
| 110 | + readOnly: true |
| 111 | + {{- end }} |
| 112 | + {{- if gt (len .Values.frontend.auth.allowedEmails) 0 }} |
| 113 | + volumes: |
| 114 | + - name: emails |
| 115 | + configMap: |
| 116 | + name: {{ $frontendName }}-oauth2-proxy-emails |
| 117 | + {{- end }} |
| 118 | +--- |
| 119 | +apiVersion: v1 |
| 120 | +kind: Service |
| 121 | +metadata: |
| 122 | + name: {{ $proxyName }} |
| 123 | + labels: |
| 124 | + {{- include "vibe-kanban-team.labels" . | nindent 4 }} |
| 125 | + app.kubernetes.io/component: oauth2-proxy-code |
| 126 | +spec: |
| 127 | + type: ClusterIP |
| 128 | + ports: |
| 129 | + - port: 4180 |
| 130 | + targetPort: http |
| 131 | + protocol: TCP |
| 132 | + name: http |
| 133 | + selector: |
| 134 | + {{- include "vibe-kanban-team.selectorLabels" . | nindent 4 }} |
| 135 | + app.kubernetes.io/component: oauth2-proxy-code |
| 136 | +{{- end }} |
0 commit comments