Skip to content

Commit 339e135

Browse files
committed
Add OAuth2-Proxy sidecar
1 parent d50755a commit 339e135

File tree

6 files changed

+116
-7
lines changed

6 files changed

+116
-7
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22

33
# dependencies (helm dep up)
44
charts/*/charts/
5+
charts/mlflow/deployed-values
6+
.idea/
7+

charts/mlflow/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ type: application
88
# This is the chart version. This version number should be incremented each time you make changes
99
# to the chart and its templates, including the app version.
1010
# Versions are expected to follow Semantic Versioning (https://semver.org/)
11-
version: 1.0.3
11+
version: 1.1.0
1212

1313
# This is the version number of the application being deployed. This version number should be
1414
# incremented each time you make changes to the application. Versions are not expected to
1515
# follow Semantic Versioning. They should reflect the version the application is using.
16-
appVersion: 1.24.0
16+
appVersion: 2.1.1
1717

1818
# List of people that maintain this helm chart.
1919
maintainers:

charts/mlflow/templates/deployment.yaml

+41-5
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ spec:
6262
value: "{{ .Values.minio.auth.rootPassword }}"
6363
{{- end }}
6464
args: ["server",
65-
"--backend-store-uri", "{{- template "services.postgres.uri" .}}",
66-
"--default-artifact-root", "{{- template "services.minio.uri" . }}",
67-
"--host", "0.0.0.0"]
65+
"--backend-store-uri", "{{- template "services.postgres.uri" . }}",
66+
"--artifacts-destination", "s3://{{ .Values.oauth2Proxy.clientID }}",
67+
"--serve-artifacts",
68+
"--host", "0.0.0.0",
69+
"--port", "5000"]
6870
ports:
6971
- name: mlflow
7072
containerPort: 5000
@@ -79,8 +81,37 @@ spec:
7981
# httpGet:
8082
# path: /
8183
# port: mlflow
82-
resources:
83-
{{- toYaml .Values.resources | nindent 12 }}
84+
{{- if .Values.oauth2Proxy.enabled }}
85+
- name: sidecar
86+
image: "{{- .Values.oauth2Proxy.repository}}:{{- .Values.oauth2Proxy.tag}}"
87+
88+
volumeMounts:
89+
- name: oauth2-config
90+
mountPath: "/etc/oauth2-proxy"
91+
readOnly: true
92+
93+
ports:
94+
- name: https
95+
containerPort: 8443
96+
protocol: TCP
97+
98+
env:
99+
- name: OAUTH2_PROXY_CLIENT_SECRET
100+
valueFrom:
101+
secretKeyRef:
102+
name: {{ .Values.oauth2Proxy.secret }}
103+
key: client_secret
104+
- name: OAUTH2_PROXY_COOKIE_SECRET
105+
valueFrom:
106+
secretKeyRef:
107+
name: {{ .Values.oauth2Proxy.secret }}
108+
key: cookie_secret
109+
110+
args: ["--http-address", "0.0.0.0:8443",
111+
"--upstream", "http://localhost:5000",
112+
"--config", "/etc/oauth2-proxy/config.cfg"
113+
]
114+
84115
{{- with .Values.nodeSelector }}
85116
nodeSelector:
86117
{{- toYaml . | nindent 8 }}
@@ -93,3 +124,8 @@ spec:
93124
tolerations:
94125
{{- toYaml . | nindent 8 }}
95126
{{- end }}
127+
volumes:
128+
- name: oauth2-config
129+
configMap:
130+
name: {{ include "mlflow.fullname" . }}-oauth2-config
131+
{{- end }}
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{{- if .Values.oauth2Proxy.enabled }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ include "mlflow.fullname" . }}-oauth2-config
6+
labels:
7+
{{- include "mlflow.labels" . | nindent 4 }}
8+
data:
9+
config.cfg: |
10+
client_id = "{{ .Values.oauth2Proxy.clientID }}"
11+
set_authorization_header = true
12+
skip_jwt_bearer_tokens = true
13+
request_logging=true
14+
auth_logging=true
15+
standard_logging=true
16+
provider = "{{- .Values.oauth2Proxy.provider }}"
17+
cookie_secure = "false"
18+
cookie_refresh = "{{- .Values.oauth2Proxy.cookieRefresh }}"
19+
email_domains = "{{- .Values.oauth2Proxy.emailDomains }}"
20+
{{- with (first .Values.ingress.hosts) }}
21+
redirect_url = "https://{{- .host }}"
22+
{{- end }}
23+
24+
allowed_roles = "{{- .Values.oauth2Proxy.keycloak.allowed_roles }}"
25+
26+
oidc_issuer_url = "{{- .Values.oauth2Proxy.oidc.oidc_issuer_url }}"
27+
oidc_jwks_url = "{{- .Values.oauth2Proxy.oidc.oidc_jwks_url }}"
28+
oidc_email_claim = "{{- .Values.oauth2Proxy.oidc.oidc_email_claim }}"
29+
oidc_groups_claim = "{{- .Values.oauth2Proxy.oidc.oidc_groups_claim }}"
30+
31+
{{- end }}

charts/mlflow/templates/service.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ spec:
88
type: {{ .Values.service.type }}
99
ports:
1010
- port: {{ .Values.service.port }}
11+
{{- if .Values.oauth2Proxy.enabled }}
12+
targetPort: https
13+
{{- else }}
1114
targetPort: mlflow
15+
{{- end }}
1216
protocol: TCP
1317
name: mlflow
1418
selector:

charts/mlflow/values.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,41 @@ minio:
3333
auth:
3434
rootPassword: leftfoot1
3535

36+
37+
oauth2Proxy:
38+
enabled: true
39+
repository: "bitnami/oauth2-proxy"
40+
tag: "7.4.0"
41+
42+
## Name of Kubernetes secret holding
43+
## cookie_secret
44+
## client_secret
45+
secret:
46+
47+
## This should match the client ID for your provider
48+
clientID:
49+
provider: "keycloak-oidc"
50+
51+
emailDomains: "*"
52+
cookieRefresh: "5m"
53+
keycloak:
54+
# restrict logins to users with this role (may be given multiple times). Only works with the keycloak-oidc provider.
55+
allowed_roles:
56+
57+
oidc:
58+
# the OpenID Connect issuer URL, e.g. "https://accounts.google.com"
59+
oidc_issuer_url:
60+
61+
# OIDC JWKS URI for token verification; required if OIDC discovery is disabled
62+
oidc_jwks_url:
63+
64+
# which OIDC claim contains the user's email?
65+
oidc_email_claim:
66+
67+
# which OIDC claim contains the user groups?
68+
oidc_groups_claim:
69+
70+
3671
serviceAccount:
3772
# Specifies whether a service account should be created
3873
create: true

0 commit comments

Comments
 (0)