Skip to content

Commit dfb2067

Browse files
authored
Merge ed5c568 into 6020f0c
2 parents 6020f0c + ed5c568 commit dfb2067

39 files changed

+573
-19757
lines changed

.github/workflows/test-operator-wandb.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
"url-encoded-password",
5353
"user-defined-secrets",
5454
"weave-trace",
55-
"weave-trace-with-worker"
55+
"weave-trace-with-worker",
5656
]
5757
runs-on: ubuntu-latest-8-cores
5858
environment: Helm Charts

Tiltfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ configObjects = [
110110
'wandb-bucket-configmap:configmap:' + current_namespace,
111111
'wandb-bucket:secret:' + current_namespace,
112112
'wandb-ca-certs:configmap:' + current_namespace,
113-
'wandb-clickhouse-configmap:configmap:' + current_namespace,
113+
# 'wandb-clickhouse-configmap:configmap:' + current_namespace,
114114
'wandb-console-configmap:configmap:' + current_namespace,
115115
'wandb-executor-configmap:configmap:' + current_namespace,
116116
'wandb-flat-run-fields-updater-configmap:configmap:' + current_namespace,

charts/operator-wandb/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: operator-wandb
33
description: A Helm chart for deploying W&B to Kubernetes
44
type: application
5-
version: 0.38.3
5+
version: 0.38.4
66
appVersion: 1.0.0
77
icon: https://wandb.ai/logo.svg
88

charts/operator-wandb/templates/_clickhouse.tpl

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,38 @@ Return name of secret where clickhouse information is stored
1515

1616
{{- define "wandb.clickhouse.port" -}}
1717
{{- if .Values.global.clickhouse.port }}
18-
{{- .Values.global.clickhouse.port -}}
18+
{{- print $.Values.global.clickhouse.port -}}
1919
{{- else -}}
20-
{{- if .Values.clickhouse.install }}
20+
{{- $host := (include "wandb.clickhouse.host" .) -}}
21+
{{- if eq $host (print .Release.Name "-clickhouse-headless") }}
2122
{{- print "8123" -}}
2223
{{- else -}}
2324
{{- print "8443" -}}
2425
{{- end -}}
2526
{{- end -}}
26-
{{- end }}
27+
{{- end }}
28+
29+
{{/*
30+
Return the database name
31+
*/}}
32+
{{- define "wandb.clickhouse.database" -}}
33+
{{- print $.Values.global.clickhouse.database -}}
34+
{{- end -}}
35+
36+
{{/*
37+
Return the database user
38+
*/}}
39+
{{- define "wandb.clickhouse.user" -}}
40+
{{- if kindIs "map" $.Values.global.clickhouse.user -}}
41+
{{- print "default" -}}
42+
{{- else -}}
43+
{{- print $.Values.global.clickhouse.user -}}
44+
{{- end -}}
45+
{{- end -}}
46+
47+
{{/*
48+
Return the database password
49+
*/}}
50+
{{- define "wandb.clickhouse.password" -}}
51+
{{- print $.Values.global.clickhouse.password -}}
52+
{{- end -}}

charts/operator-wandb/templates/_env.tpl

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,102 @@ Global values will override any chart-specific values.
203203
value: {{ include "wandb.mysql" . | trim | quote }}
204204
{{- end -}}
205205

206+
{{- define "wandb.clickhouseConfigEnvs" -}}
207+
{{- /*
208+
ATTENTION!
209+
210+
WF_CLICKHOUSE_HOST, WF_CLICKHOUSE_PORT, WF_CLICKHOUSE_DATABASE,
211+
WF_CLICKHOUSE_USER, WF_CLICKHOUSE_REPLICATED, CLICKHOUSE_PASSWORD
212+
213+
Are all set in the values.yaml under global.clickhouse.(host,port,database,user,password,replicated)
214+
215+
The following blocks are to enable values to be provided in one of two ways:
216+
217+
AS STANDARD:
218+
clickhouse:
219+
host: "clickhouse.example.com"
220+
port: 8443
221+
database: "weave_trace_db"
222+
user: "default"
223+
password: "supersafe"
224+
replicated: false
225+
226+
AS K8s REFS:
227+
clickhouse:
228+
host:
229+
valueFrom:
230+
secretKeyRef:
231+
name: "clickhouse-settings-secret"
232+
key: "endpoint"
233+
port:
234+
valueFrom:
235+
secretKeyRef:
236+
name: "clickhouse-settings-secret"
237+
key: "port"
238+
database:
239+
...
240+
user:
241+
...
242+
password:
243+
...
244+
*/ -}}
245+
246+
{{- if kindIs "map" .Values.global.clickhouse.host }}
247+
- name: WF_CLICKHOUSE_HOST
248+
{{- toYaml .Values.global.clickhouse.host | nindent 2 }}
249+
{{- else }}
250+
- name: WF_CLICKHOUSE_HOST
251+
value: "{{ include "wandb.clickhouse.host" . }}"
252+
{{- end }}
253+
254+
{{- if kindIs "map" .Values.global.clickhouse.port }}
255+
- name: WF_CLICKHOUSE_PORT
256+
{{- toYaml .Values.global.clickhouse.port | nindent 2 }}
257+
{{- else }}
258+
- name: WF_CLICKHOUSE_PORT
259+
value: "{{ include "wandb.clickhouse.port" . }}"
260+
{{- end }}
261+
262+
{{- if kindIs "map" .Values.global.clickhouse.database }}
263+
- name: WF_CLICKHOUSE_DATABASE
264+
{{- toYaml .Values.global.clickhouse.database | nindent 2 }}
265+
{{- else }}
266+
- name: WF_CLICKHOUSE_DATABASE
267+
value: "{{ include "wandb.clickhouse.database" . }}"
268+
{{- end }}
269+
270+
{{- if kindIs "map" .Values.global.clickhouse.user }}
271+
- name: WF_CLICKHOUSE_USER
272+
{{- toYaml .Values.global.clickhouse.user | nindent 2 }}
273+
{{- else }}
274+
- name: WF_CLICKHOUSE_USER
275+
value: "{{ include "wandb.clickhouse.user" . }}"
276+
{{- end }}
277+
278+
{{- if kindIs "map" .Values.global.clickhouse.replicated }}
279+
- name: WF_CLICKHOUSE_REPLICATED
280+
{{- toYaml .Values.global.clickhouse.replicated | nindent 2 }}
281+
{{- else }}
282+
- name: WF_CLICKHOUSE_REPLICATED
283+
value: "{{ .Values.global.clickhouse.replicated }}"
284+
{{- end }}
285+
286+
{{- if kindIs "map" .Values.global.clickhouse.password }}
287+
- name: CLICKHOUSE_PASSWORD
288+
{{- toYaml .Values.global.clickhouse.password | nindent 2 }}
289+
{{- else }}
290+
- name: CLICKHOUSE_PASSWORD
291+
valueFrom:
292+
secretKeyRef:
293+
name: {{ include "wandb.clickhouse.passwordSecret" . | quote}}
294+
key: "{{ .Values.global.clickhouse.passwordSecret.passwordKey }}"
295+
{{- end -}}
296+
{{- end -}}
297+
298+
{{- define "wandb.clickhouseEnvs" -}}
299+
{{ include "wandb.clickhouseConfigEnvs" . }}
300+
{{- end -}}
301+
206302
{{- define "wandb.historyStoreEnvs" -}}
207303
- name: GORILLA_HISTORY_STORE
208304
value: {{ include "wandb.historyStore" . | quote }}
Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if not .Values.global.clickhouse.passwordSecret.name }}
1+
{{- if not (or .Values.global.clickhouse.passwordSecret.name (kindIs "map" .Values.global.clickhouse.password)) }}
22
{{- $secretName := (include "wandb.clickhouse.passwordSecret" .) }}
33
{{- $secret := (lookup "v1" "Secret" .Release.Namespace $secretName) }}
44
apiVersion: v1
@@ -19,20 +19,3 @@ data:
1919
CLICKHOUSE_PASSWORD: {{ default (randAlphaNum 64) .Values.global.clickhouse.password | b64enc }}
2020
{{- end }}
2121
{{- end }}
22-
---
23-
apiVersion: v1
24-
kind: ConfigMap
25-
metadata:
26-
name: {{ .Release.Name }}-clickhouse-configmap
27-
labels:
28-
{{- include "wandb.commonLabels" . | nindent 4 }}
29-
annotations:
30-
"reflector.v1.k8s.emberstack.com/reflection-allowed": "true"
31-
"reflector.v1.k8s.emberstack.com/reflection-auto-enabled": "true"
32-
"reflector.v1.k8s.emberstack.com/reflection-allowed-namespaces": "{{ .Release.Name }}-.*"
33-
data:
34-
WF_CLICKHOUSE_PORT: "{{ include "wandb.clickhouse.port" . }}"
35-
WF_CLICKHOUSE_HOST: "{{ include "wandb.clickhouse.host" . }}"
36-
WF_CLICKHOUSE_DATABASE: "{{ .Values.global.clickhouse.database }}"
37-
WF_CLICKHOUSE_USER: "{{ .Values.global.clickhouse.user }}"
38-
WF_CLICKHOUSE_REPLICATED: "{{ .Values.global.clickhouse.replicated }}"

charts/operator-wandb/templates/tests/test-connection.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
- name: WANDB_BASE_URL
1515
value: "http://{{ .Release.Name }}-nginx:8080"
1616
- name: WANDB_API_KEY
17-
value: "local-123456789-123456789-123456789-1234"
17+
value: {{ .Values.global.env.GLOBAL_ADMIN_API_KEY | quote }}
1818
command:
1919
- sh
2020
- -c

charts/operator-wandb/templates/tests/test-weave.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
- name: WANDB_BASE_URL
1616
value: "http://{{ .Release.Name }}-nginx:8080"
1717
- name: WANDB_API_KEY
18-
value: "local-123456789-123456789-123456789-1234"
18+
value: {{ .Values.global.env.GLOBAL_ADMIN_API_KEY | quote }}
1919
command:
2020
- sh
2121
- -c

charts/operator-wandb/values.yaml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ global:
3131

3232
storageClass: ""
3333

34-
banners: {}
34+
banners:
35+
{}
3536
# banner1:
3637
# type: warning | error | info
3738
# message: "This is a warning message"
@@ -159,6 +160,37 @@ global:
159160
# Required when using replicated services on self-managed ClickHouse (not ClickHouse Cloud).
160161
# Flag will substitute MergeTree() with ReplicatedMergeTree() and use `ON CLUSTER` on table creation.
161162
replicated: false
163+
#
164+
# FOR ADVANCED USERS:
165+
# the following clickhouse config options can passed as maps/objects
166+
# so that their values can be pulled by existing secrets populated by other systems
167+
#
168+
# clickhouse:
169+
# host:
170+
# valueFrom:
171+
# secretKeyRef:
172+
# name: "clickhouse-settings-secret"
173+
# key: "endpoint"
174+
# port:
175+
# valueFrom:
176+
# secretKeyRef:
177+
# name: "clickhouse-settings-secret"
178+
# key: "port"
179+
# database:
180+
# valueFrom:
181+
# secretKeyRef:
182+
# name: "clickhouse-settings-secret"
183+
# key: "database"
184+
# user:
185+
# valueFrom:
186+
# secretKeyRef:
187+
# name: "clickhouse-settings-secret"
188+
# key: "username"
189+
# password:
190+
# valueFrom:
191+
# secretKeyRef:
192+
# name: "clickhouse-settings-secret"
193+
# key: "password"
162194

163195
email:
164196
smtp:
@@ -2050,7 +2082,8 @@ weave-trace:
20502082
"{{ .Release.Name }}-global-configmap": "configMapRef"
20512083
"{{ .Release.Name }}-global-secret": "secretRef"
20522084
"{{ .Release.Name }}-weave-trace-configmap": "configMapRef"
2053-
"{{ .Release.Name }}-clickhouse-configmap": "configMapRef"
2085+
envTpls:
2086+
- '{{ include "wandb.clickhouseEnvs" . }}'
20542087
env:
20552088
WF_CLICKHOUSE_PASS:
20562089
valueFrom:
@@ -2201,7 +2234,8 @@ weave-trace-worker:
22012234
envFrom:
22022235
"{{ .Release.Name }}-global-secret": "secretRef"
22032236
"{{ .Release.Name }}-weave-trace-configmap": "configMapRef"
2204-
"{{ .Release.Name }}-clickhouse-configmap": "configMapRef"
2237+
envTpls:
2238+
- '{{ include "wandb.clickhouseConfigEnvs" . }}'
22052239
env:
22062240
WF_CLICKHOUSE_PASS:
22072241
valueFrom:
@@ -2311,7 +2345,8 @@ weave-evaluate-model-worker:
23112345
envFrom:
23122346
"{{ .Release.Name }}-global-secret": "secretRef"
23132347
"{{ .Release.Name }}-weave-trace-configmap": "configMapRef"
2314-
"{{ .Release.Name }}-clickhouse-configmap": "configMapRef"
2348+
envTpls:
2349+
- '{{ include "wandb.clickhouseConfigEnvs" . }}'
23152350
env:
23162351
WF_CLICKHOUSE_PASS:
23172352
valueFrom:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: clickhouse-settings-secret
5+
type: Opaque
6+
stringData:
7+
endpoint: "my-clickhouse-cluster.example.com"
8+
port: "8443"
9+
database: "weave_trace_db"
10+
username: "admin"
11+
password: "super-secure-password-123"

0 commit comments

Comments
 (0)