Skip to content

Commit

Permalink
feat(backend): Add flat runs field updater (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
nfoucha authored Apr 3, 2024
1 parent 2500829 commit 7559eda
Show file tree
Hide file tree
Showing 13 changed files with 562 additions and 41 deletions.
61 changes: 32 additions & 29 deletions charts/operator-wandb/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
dependencies:
- name: app
repository: file://charts/app
version: 0.1.0
- name: console
repository: file://charts/console
version: 0.1.0
- name: weave
repository: file://charts/weave
version: 0.1.0
- name: parquet
repository: file://charts/parquet
version: 0.1.0
- name: mysql
repository: file://charts/mysql
version: 0.1.0
- name: prometheus
repository: file://charts/prometheus
version: 0.1.0
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 18.19.4
- name: kafka
repository: https://charts.bitnami.com/bitnami
version: 25.3.5
- name: otel
repository: file://charts/otel
version: 0.1.0
digest: sha256:d6fd61036406090b2be7526adb3114a3343b4463c30ab67a04534ea8ecf6ff36
generated: "2024-03-20T14:23:36.905681214-04:00"
- name: app
repository: file://charts/app
version: 0.1.0
- name: console
repository: file://charts/console
version: 0.1.0
- name: weave
repository: file://charts/weave
version: 0.1.0
- name: parquet
repository: file://charts/parquet
version: 0.1.0
- name: mysql
repository: file://charts/mysql
version: 0.1.0
- name: prometheus
repository: file://charts/prometheus
version: 0.1.0
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 18.19.4
- name: kafka
repository: https://charts.bitnami.com/bitnami
version: 25.3.5
- name: otel
repository: file://charts/otel
version: 0.1.0
- name: flat-run-fields-updater
repository: file://charts/flat-run-fields-updater
version: 0.1.0
digest: sha256:72ce111a55d35fac65edc81862f81dd1c0a6ad747aa2a6b2522966f91b27c814
generated: "2024-03-26T20:48:42.072569696Z"
6 changes: 5 additions & 1 deletion charts/operator-wandb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: operator-wandb
description: A Helm chart for deploying W&B to Kubernetes
type: application
version: 0.12.2
version: 0.12.3
appVersion: 1.0.0
icon: https://wandb.ai/logo.svg

Expand Down Expand Up @@ -48,3 +48,7 @@ dependencies:
version: "*.*.*"
repository: file://charts/otel
condition: otel.install
- name: flat-run-fields-updater
version: "*.*.*"
repository: file://charts/flat-run-fields-updater
condition: flat-run-fields-updater.install
40 changes: 38 additions & 2 deletions charts/operator-wandb/charts/app/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
{{- if .Values.pod.annotations -}}
{{- toYaml .Values.pod.annotations | nindent 4 }}
{{- toYaml .Values.pod.annotations | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "app.serviceAccountName" . }}
Expand Down Expand Up @@ -209,7 +209,43 @@ spec:
- name: GORILLA_TRACER
value: "otlp+grpc://{{ .Release.Name }}-otel:4317?trace_ratio={{ .Values.traceRatio }}"
{{- end }}

- name: GORILLA_RUN_STORE_ONPREM_MIGRATE_CREATE_DUAL_RUN_UPDATER
value: "true"
- name: GORILLA_RUN_STORE_ONPREM_MIGRATE_CREATE_RUN_STORE
value: "true"
- name: GORILLA_RUN_STORE_ONPREM_MIGRATE_CREATE_SCHEMA
value: "true"
- name: GORILLA_RUN_STORE_ONPREM_MIGRATE_DUAL_WRITE_RUN_UPDATES
value: "true"
- name: GORILLA_RUN_STORE_ONPREM_MIGRATE_PANIC_ON_CREATE_SCHEMA_FAIL
value: "true"
- name: GORILLA_RUN_STORE_ONPREM_MIGRATE_RUN_STORE_READ
value: "true"
- name: KAFKA_BROKER_HOST
value: "{{ include "wandb.kafka.brokerHost" . }}"
- name: KAFKA_BROKER_PORT
value: "{{ include "wandb.kafka.brokerPort" . }}"
- name: KAFKA_CLIENT_USER
value: "{{ include "wandb.kafka.user" . }}"
- name: KAFKA_CLIENT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "wandb.kafka.passwordSecret" . }}
key: KAFKA_CLIENT_PASSWORD
- name: KAFKA_TOPIC_RUN_UPDATE_SHADOW_QUEUE
value: {{ include "wandb.kafka.runUpdatesShadowTopic" .}}
- name: OVERFLOW_BUCKET_ADDR
value: "{{ include "app.bucket" .}}"
- name: GORILLA_RUN_UPDATE_SHADOW_QUEUE
value: >
{
"overflow-bucket": {
"store": "$(OVERFLOW_BUCKET_ADDR)",
"name": "wandb",
"prefix": "wandb-overflow"
},
"addr": "kafka://$(KAFKA_CLIENT_USER):$(KAFKA_CLIENT_PASSWORD)@$(KAFKA_BROKER_HOST):$(KAFKA_BROKER_PORT)/$(KAFKA_TOPIC_RUN_UPDATE_SHADOW_QUEUE)?producer_batch_bytes=1048576"
}
{{- include "app.extraEnv" (dict "global" $.Values.global "local" .Values) | nindent 12 }}
{{- include "wandb.extraEnvFrom" (dict "root" $ "local" .) | nindent 12 }}
livenessProbe:
Expand Down
23 changes: 23 additions & 0 deletions charts/operator-wandb/charts/flat-run-fields-updater/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
13 changes: 13 additions & 0 deletions charts/operator-wandb/charts/flat-run-fields-updater/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v2
name: flat-run-fields-updater
description: Chart for deploying the flat runs field updater
type: application
version: 0.1.0
appVersion: "0.33.0"
home: https://wandb.ai
icon: https://wandb.ai/logo.svg
maintainers:
- name: wandb
email: support@wandb.com
url: https://wandb.com
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "flat-run-fields-updater.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "flat-run-fields-updater.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "flat-run-fields-updater.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "flat-run-fields-updater.labels" -}}
helm.sh/chart: {{ include "flat-run-fields-updater.chart" . }}
{{ include "flat-run-fields-updater.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Returns the extraEnv keys and values to inject into containers.
Global values will override any chart-specific values.
*/}}
{{- define "flat-run-fields-updater.extraEnv" -}}
{{- $allExtraEnv := merge (default (dict) .local.extraEnv) .global.extraEnv -}}
{{- range $key, $value := $allExtraEnv }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end -}}
{{- end -}}

{{/*
Returns a list of _common_ labels to be shared across all
flat-run-fields-updater deployments and other shared objects.
*/}}
{{- define "flat-run-fields-updater.commonLabels" -}}
{{- $commonLabels := default (dict) .Values.common.labels -}}
{{- if $commonLabels }}
{{- range $key, $value := $commonLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end -}}
{{- end -}}

{{/*
Returns a list of _pod_ labels to be shared across all
flat-run-fields-updater deployments.
*/}}
{{- define "flat-run-fields-updater.podLabels" -}}
{{- range $key, $value := .Values.pod.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "flat-run-fields-updater.selectorLabels" -}}
app.kubernetes.io/name: {{ include "flat-run-fields-updater.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "flat-run-fields-updater.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "flat-run-fields-updater.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{- define "flat-run-fields-updater.redis" -}}
{{- $cs := include "wandb.redis.connectionString" . }}
{{- $ca := include "wandb.redis.caCert" . }}
{{- if $ca }}
{{- printf "%s?tls=true&caCertPath=/etc/ssl/certs/redis_ca.pem&ttlInSeconds=604800" $cs -}}
{{- else }}
{{- print $cs -}}
{{- end }}
{{- end }}

{{- define "flat-run-fields-updater.bucket" -}}
{{- $bucket := "" -}}
{{- if eq .Values.global.bucket.provider "az" -}}
{{- $bucket = printf "az://%s/%s" .Values.global.bucket.name .Values.global.bucket.path -}}
{{- end -}}
{{- if eq .Values.global.bucket.provider "gcs" -}}
{{- $bucket = printf "gs://%s" .Values.global.bucket.name -}}
{{- end -}}
{{- if eq .Values.global.bucket.provider "s3" -}}
{{- if and .Values.global.bucket.accessKey .Values.global.bucket.secretKey -}}
{{- $bucket = printf "s3://%s:%s@%s/%s" .Values.global.bucket.accessKey .Values.global.bucket.secretKey .Values.global.bucket.name .Values.global.bucket.path -}}
{{- else -}}
{{- $bucket = printf "s3://%s/%s" .Values.global.bucket.name .Values.global.bucket.path -}}
{{- end -}}
{{- end -}}
{{- trimSuffix "/" $bucket -}}
{{- end -}}
Loading

0 comments on commit 7559eda

Please sign in to comment.