Skip to content

Commit

Permalink
Merge 7efa21d into 973d79d
Browse files Browse the repository at this point in the history
  • Loading branch information
annirudh authored Nov 18, 2024
2 parents 973d79d + 7efa21d commit 9d432d4
Show file tree
Hide file tree
Showing 11 changed files with 497 additions and 3 deletions.
7 changes: 5 additions & 2 deletions charts/operator-wandb/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ dependencies:
- name: weave-trace
repository: file://charts/weave-trace
version: 0.1.0
- name: executor
repository: file://charts/executor
version: 0.1.0
- name: parquet
repository: file://charts/parquet
version: 0.1.0
Expand Down Expand Up @@ -41,5 +44,5 @@ dependencies:
- name: yace
repository: file://charts/yace
version: 0.1.0
digest: sha256:bca2b6781737da6806e4485605cf9ce87b1428944b14cb88f082024cc3500bbd
generated: "2024-11-08T13:42:24.351184+05:30"
digest: sha256:17ce8e027aefeca83fbae29fcb79da3dada09de63e9704b88c4144e975cbbce5
generated: "2024-11-18T15:15:21.132048-08:00"
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.18.18
version: 0.18.19
appVersion: 1.0.0
icon: https://wandb.ai/logo.svg

Expand All @@ -28,6 +28,10 @@ dependencies:
version: "*.*.*"
repository: file://charts/weave-trace
condition: weave-trace.install
- name: executor
version: "*.*.*"
repository: file://charts/executor
condition: executor.install
- name: parquet
version: "*.*.*"
repository: file://charts/parquet
Expand Down
4 changes: 4 additions & 0 deletions charts/operator-wandb/charts/app/templates/_deployment.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ spec:
value: {{ .Values.artifactsGc.NumWorkers | quote }}
- name: GORILLA_ARTIFACTS_GC_DELETE_FILES_NUM_WORKERS
value: {{ .Values.artifactsGc.DeleteFilesNumWorkers | quote }}
- name: GORILLA_TASK_QUEUE
value: "{{ include "app.redis" . | trim }}"
- name: GORILLA_TASK_QUEUE_MONITOR_PORT
value: "10000"
{{- if index .Values.global "weave-trace" "enabled" }}
- name: GORILLA_INTERNAL_JWT_SUBJECTS_TO_ISSUERS
value: {{ tpl (include "app.internalJWTMap" .) . }}
Expand Down
23 changes: 23 additions & 0 deletions charts/operator-wandb/charts/executor/.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/executor/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v2
name: executor
description: Chart for deploying the executor
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
129 changes: 129 additions & 0 deletions charts/operator-wandb/charts/executor/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "executor.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 "executor.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 "executor.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "executor.labels" -}}
helm.sh/chart: {{ include "executor.chart" . }}
{{ include "executor.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 "executor.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
executor deployments and other shared objects.
*/}}
{{- define "executor.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
executor deployments.
*/}}
{{- define "executor.podLabels" -}}
{{- range $key, $value := .Values.pod.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "executor.selectorLabels" -}}
app.kubernetes.io/name: {{ include "executor.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

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

{{- define "executor.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 "executor.bucket" -}}
{{- $bucketValues := .Values.global.defaultBucket }}
{{- if .Values.global.bucket.provider }}
{{- $bucketValues = .Values.global.bucket }}
{{- end }}
{{- $bucket := "" -}}
{{- if eq $bucketValues.provider "az" -}}
{{- $bucket = printf "az://%s/%s" $bucketValues.name (default "" $bucketValues.path) -}}
{{- end -}}
{{- if eq $bucketValues.provider "gcs" -}}
{{- $bucket = printf "gs://%s/%s" $bucketValues.name (default "" $bucketValues.path) -}}
{{- end -}}
{{- if eq $bucketValues.provider "s3" -}}
{{- if and $bucketValues.accessKey $bucketValues.secretKey -}}
{{- $bucket = printf "s3://%s:%s@%s/%s" $bucketValues.accessKey $bucketValues.secretKey $bucketValues.name (default "" $bucketValues.path) -}}
{{- else -}}
{{- $bucket = printf "s3://%s/%s" $bucketValues.name (default "" $bucketValues.path) -}}
{{- end -}}
{{- end -}}
{{- trimSuffix "/" $bucket -}}
{{- end -}}
172 changes: 172 additions & 0 deletions charts/operator-wandb/charts/executor/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
{{- if .Values.install }}
{{- $imageCfg := dict "global" $.Values.global.image "local" $.Values.image -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "executor.fullname" . }}
labels:
{{- include "wandb.commonLabels" . | nindent 4 }}
{{- include "executor.commonLabels" . | nindent 4 }}
{{- include "executor.labels" . | nindent 4 }}
{{- if .Values.deployment.labels -}}
{{- toYaml .Values.deployment.labels | nindent 4 }}
{{- end }}
annotations:
{{- include "wandb.deploymentAnnotations" . | nindent 4 }}
{{- if .Values.deployment.annotations -}}
{{- toYaml .Values.deployment.annotations | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "wandb.selectorLabels" $ | nindent 6 }}
{{- include "executor.labels" . | nindent 6 }}
template:
metadata:
{{- with .Values.pod.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "wandb.podLabels" . | nindent 8 }}
{{- include "executor.labels" . | nindent 8 }}
{{- include "executor.commonLabels" . | nindent 8 }}
{{- include "executor.podLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "executor.serviceAccountName" . }}
{{- include "wandb.nodeSelector" . | nindent 6 }}
{{- include "wandb.priorityClassName" . | nindent 6 }}
{{- include "wandb.podSecurityContext" .Values.pod.securityContext | nindent 6 }}
# needed to ensure ensure Kafka consumers handle pod termination gracefully and avoid data loss
terminationGracePeriodSeconds: 60
containers:
- name: {{ .Chart.Name }}
{{- include "wandb.containerSecurityContext" .Values.container.securityContext | nindent 10 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
{{- if ne (include "wandb.redis.caCert" .) "" }}
- name: {{ include "executor.fullname" . }}-redis-ca
mountPath: /etc/ssl/certs/redis_ca.pem
subPath: redis_ca.pem
{{- end }}
env:
- name: GOMEMLIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
{{- if ne .Values.traceRatio 0.0 }}
- name: GORILLA_TRACER
value: "otlp+grpc://{{ .Release.Name }}-otel-daemonset:4317?trace_ratio={{ .Values.traceRatio }}"
{{- end }}
- name: ONLY_SERVICE
value: gorilla-executor
- name: LOGGING_ENABLED
value: 'true'
- name: MYSQL_PORT
value: "{{ include "wandb.mysql.port" . }}"
- name: MYSQL_HOST
value: "{{ include "wandb.mysql.host" . }}"
- name: MYSQL_DATABASE
value: "{{ include "wandb.mysql.database" . }}"
- name: MYSQL_USER
value: "{{ include "wandb.mysql.user" . }}"
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "wandb.mysql.passwordSecret" . }}
key: {{ .Values.global.mysql.passwordSecret.passwordKey }}
- name: MYSQL
value: "mysql://$(MYSQL_USER):$(MYSQL_PASSWORD)@$(MYSQL_HOST):$(MYSQL_PORT)/$(MYSQL_DATABASE)"
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "wandb.redis.passwordSecret" . }}
optional: true
key: REDIS_PASSWORD
- name: REDIS_PORT
value: "{{ include "wandb.redis.port" . }}"
- name: REDIS_HOST
value: "{{ include "wandb.redis.host" . }}"
- name: REDIS
value: "{{ include "executor.redis" . | trim }}"

- name: GORILLA_SETTINGS_CACHE
value: "{{ include "executor.redis" . | trim }}"
- name: GORILLA_TASK_QUEUE
value: "{{ include "executor.redis" . | trim }}"

- name: BUCKET
value: "{{ include "executor.bucket" . }}"
- name: AWS_REGION
value: {{ .Values.global.bucket.region | default .Values.global.defaultBucket.region }}
- name: AWS_S3_KMS_ID
value: "{{ .Values.global.bucket.kmsKey | default .Values.global.defaultBucket.kmsKey }}"
- name: AZURE_STORAGE_KEY
valueFrom:
secretKeyRef:
name: "{{ include "wandb.bucket.secret" . }}"
key: {{ .Values.global.bucket.accessKeyName }}
optional: true

- name: G_HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP

{{- if ne .Values.global.email.smtp.host "" }}
- name: GORILLA_EMAIL_SINK
value: "smtp://{{ .Values.global.email.smtp.user }}:{{ .Values.global.email.smtp.password }}@{{ .Values.global.email.smtp.host }}:{{ .Values.global.email.smtp.port }}"
{{- end }}

{{- include "executor.extraEnv" (dict "global" .Values.global "local" .Values) | nindent 12 }}
{{- include "wandb.extraEnvFrom" (dict "root" $ "local" .) | nindent 12 }}

livenessProbe:
httpGet:
path: /ready
port: 8087
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1

readinessProbe:
httpGet:
path: /ready
port: 8087
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1

resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- if ne (include "wandb.redis.caCert" .) "" }}
- name: {{ include "executor.fullname" . }}-redis-ca
secret:
secretName: "{{ .Release.Name }}-redis"
items:
- key: REDIS_CA_CERT
path: redis_ca.pem
{{- end }}
{{- end }}
Loading

0 comments on commit 9d432d4

Please sign in to comment.