From 7559eda8141a96eb079aeb08b231d856b73dba7f Mon Sep 17 00:00:00 2001 From: Nigel Foucha <73838612+nfoucha@users.noreply.github.com> Date: Wed, 3 Apr 2024 13:35:30 -0400 Subject: [PATCH] feat(backend): Add flat runs field updater (#91) --- charts/operator-wandb/Chart.lock | 61 +++--- charts/operator-wandb/Chart.yaml | 6 +- .../charts/app/templates/deployment.yaml | 40 +++- .../flat-run-fields-updater/.helmignore | 23 +++ .../charts/flat-run-fields-updater/Chart.yaml | 13 ++ .../templates/_helpers.tpl | 125 +++++++++++++ .../templates/deployment.yaml | 174 ++++++++++++++++++ .../templates/hpa.yaml | 35 ++++ .../templates/serviceaccount.yaml | 18 ++ .../flat-run-fields-updater/values.yaml | 76 ++++++++ charts/operator-wandb/templates/_kafka.tpl | 21 ++- charts/operator-wandb/templates/kafka.yaml | 2 +- charts/operator-wandb/values.yaml | 9 +- 13 files changed, 562 insertions(+), 41 deletions(-) create mode 100644 charts/operator-wandb/charts/flat-run-fields-updater/.helmignore create mode 100644 charts/operator-wandb/charts/flat-run-fields-updater/Chart.yaml create mode 100644 charts/operator-wandb/charts/flat-run-fields-updater/templates/_helpers.tpl create mode 100644 charts/operator-wandb/charts/flat-run-fields-updater/templates/deployment.yaml create mode 100644 charts/operator-wandb/charts/flat-run-fields-updater/templates/hpa.yaml create mode 100644 charts/operator-wandb/charts/flat-run-fields-updater/templates/serviceaccount.yaml create mode 100644 charts/operator-wandb/charts/flat-run-fields-updater/values.yaml diff --git a/charts/operator-wandb/Chart.lock b/charts/operator-wandb/Chart.lock index 66fb0739..b246b5d4 100644 --- a/charts/operator-wandb/Chart.lock +++ b/charts/operator-wandb/Chart.lock @@ -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" diff --git a/charts/operator-wandb/Chart.yaml b/charts/operator-wandb/Chart.yaml index 5a7183bc..99aaac44 100644 --- a/charts/operator-wandb/Chart.yaml +++ b/charts/operator-wandb/Chart.yaml @@ -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 @@ -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 diff --git a/charts/operator-wandb/charts/app/templates/deployment.yaml b/charts/operator-wandb/charts/app/templates/deployment.yaml index 66b82e7e..3a819377 100644 --- a/charts/operator-wandb/charts/app/templates/deployment.yaml +++ b/charts/operator-wandb/charts/app/templates/deployment.yaml @@ -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" . }} @@ -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: diff --git a/charts/operator-wandb/charts/flat-run-fields-updater/.helmignore b/charts/operator-wandb/charts/flat-run-fields-updater/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/operator-wandb/charts/flat-run-fields-updater/.helmignore @@ -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/ diff --git a/charts/operator-wandb/charts/flat-run-fields-updater/Chart.yaml b/charts/operator-wandb/charts/flat-run-fields-updater/Chart.yaml new file mode 100644 index 00000000..17e41d34 --- /dev/null +++ b/charts/operator-wandb/charts/flat-run-fields-updater/Chart.yaml @@ -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 diff --git a/charts/operator-wandb/charts/flat-run-fields-updater/templates/_helpers.tpl b/charts/operator-wandb/charts/flat-run-fields-updater/templates/_helpers.tpl new file mode 100644 index 00000000..a52b8aa3 --- /dev/null +++ b/charts/operator-wandb/charts/flat-run-fields-updater/templates/_helpers.tpl @@ -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 -}} \ No newline at end of file diff --git a/charts/operator-wandb/charts/flat-run-fields-updater/templates/deployment.yaml b/charts/operator-wandb/charts/flat-run-fields-updater/templates/deployment.yaml new file mode 100644 index 00000000..a84f8eac --- /dev/null +++ b/charts/operator-wandb/charts/flat-run-fields-updater/templates/deployment.yaml @@ -0,0 +1,174 @@ +{{- if .Values.install }} +{{- $imageCfg := dict "global" $.Values.global.image "local" $.Values.image -}} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "flat-run-fields-updater.fullname" . }} + labels: + {{- include "wandb.commonLabels" . | nindent 4 }} + {{- include "flat-run-fields-updater.commonLabels" . | nindent 4 }} + {{- include "flat-run-fields-updater.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 "flat-run-fields-updater.labels" . | nindent 6 }} + template: + metadata: + {{- with .Values.pod.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "wandb.podLabels" . | nindent 8 }} + {{- include "flat-run-fields-updater.labels" . | nindent 8 }} + {{- include "flat-run-fields-updater.commonLabels" . | nindent 8 }} + {{- include "flat-run-fields-updater.podLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "flat-run-fields-updater.serviceAccountName" . }} + {{- include "wandb.nodeSelector" . | nindent 6 }} + {{- include "wandb.priorityClassName" . | nindent 6 }} + {{- include "wandb.podSecurityContext" .Values.pod.securityContext | nindent 6 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: G_HOST_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: OPERATOR_ENABLED + value: 'true' + - name: LOGGING_ENABLED + value: 'true' + - name: AZURE_STORAGE_KEY + valueFrom: + secretKeyRef: + name: "{{ include "wandb.bucket.secret" . }}" + key: ACCESS_KEY + optional: true + - name: GORILLA_CUSTOMER_SECRET_STORE_K8S_CONFIG_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + {{- if .Values.extraCors }} + - name: GORILLA_CORS_ORIGINS + value: "{{ join "," .Values.extraCors }}" + {{- end }} + - name: ONLY_SERVICE + value: gorilla-flat-run-fields-updater + - 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: MYSQL_PASSWORD + - name: MYSQL + value: "mysql://$(MYSQL_USER):$(MYSQL_PASSWORD)@$(MYSQL_HOST):$(MYSQL_PORT)/$(MYSQL_DATABASE)" + - name: GORILLA_RUN_STORE + value: "mysql://$(MYSQL_USER):$(MYSQL_PASSWORD)@$(MYSQL_HOST):$(MYSQL_PORT)/wandb_local_flat?tls=preferred" + - 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: BUCKET + value: "{{ include "flat-run-fields-updater.bucket" .}}" + - name: GORILLA_RUN_UPDATE_SHADOW_QUEUE + value: > + { + "overflow-bucket": { + "store": "$(BUCKET)", + "name": "wandb", + "prefix": "wandb-overflow" + }, + "subscriptions": { + "flatRunFieldsUpdater": "kafka://$(KAFKA_CLIENT_USER):$(KAFKA_CLIENT_PASSWORD)@wandb-kafka:9092/$(KAFKA_TOPIC_RUN_UPDATE_SHADOW_QUEUE)?consumer_group_id=default-group" + } + } + {{- if ne (include "wandb.redis.password" .) "" }} + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "wandb.redis.passwordSecret" . }} + key: REDIS_PASSWORD + {{- end }} + - name: REDIS_PORT + value: "{{ include "wandb.redis.port" . }}" + - name: REDIS_HOST + value: "{{ include "wandb.redis.host" . }}" + - name: REDIS + value: "{{ include "flat-run-fields-updater.redis" . | trim }}" + - name: GORILLA_SETTINGS_CACHE + value: "{{ include "flat-run-fields-updater.redis" . | trim }}" + {{- if and .Values.global .Values.global.observability }} + {{- if eq (default "custom" .Values.global.observability.mode) "otel" }} + - name: GORILLA_STATSD_PORT + value: "8125" + - name: GORILLA_STATSD_HOST + value: "0.0.0.0" + {{- end }} + {{- end }} + {{- include "flat-run-fields-updater.extraEnv" (dict "global" $.Values.global "local" .Values) | nindent 12 }} + {{- include "wandb.extraEnvFrom" (dict "root" $ "local" .) | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/operator-wandb/charts/flat-run-fields-updater/templates/hpa.yaml b/charts/operator-wandb/charts/flat-run-fields-updater/templates/hpa.yaml new file mode 100644 index 00000000..fdfbddbf --- /dev/null +++ b/charts/operator-wandb/charts/flat-run-fields-updater/templates/hpa.yaml @@ -0,0 +1,35 @@ +{{- if .Values.autoscaling.enabled }} +--- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "flat-run-fields-updater.fullname" . }} + labels: + {{- include "wandb.commonLabels" . | nindent 4 }} + {{- include "flat-run-fields-updater.commonLabels" . | nindent 4 }} + {{- include "flat-run-fields-updater.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "flat-run-fields-updater.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPU }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPU }} + {{- end }} + {{- if .Values.autoscaling.targetMemory }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemory }} + {{- end }} +{{- end }} diff --git a/charts/operator-wandb/charts/flat-run-fields-updater/templates/serviceaccount.yaml b/charts/operator-wandb/charts/flat-run-fields-updater/templates/serviceaccount.yaml new file mode 100644 index 00000000..1a37b7bb --- /dev/null +++ b/charts/operator-wandb/charts/flat-run-fields-updater/templates/serviceaccount.yaml @@ -0,0 +1,18 @@ +{{- if .Values.serviceAccount.create -}} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "flat-run-fields-updater.serviceAccountName" . }} + labels: + {{- include "wandb.commonLabels" . | nindent 4 }} + {{- include "flat-run-fields-updater.commonLabels" . | nindent 4 }} + {{- include "flat-run-fields-updater.labels" . | nindent 4 }} + {{- if .Values.serviceAccount.labels -}} + {{- toYaml .Values.serviceAccount.labels | nindent 4 }} + {{- end }} + annotations: + {{- if .Values.serviceAccount.annotations -}} + {{- toYaml .Values.serviceAccount.annotations | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/operator-wandb/charts/flat-run-fields-updater/values.yaml b/charts/operator-wandb/charts/flat-run-fields-updater/values.yaml new file mode 100644 index 00000000..03cfc31e --- /dev/null +++ b/charts/operator-wandb/charts/flat-run-fields-updater/values.yaml @@ -0,0 +1,76 @@ +--- +# Default values for flat-run-fields-updater. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 + +image: + repository: wandb/local + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: latest + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +pod: + securityContext: + fsGroup: 0 + fsGroupChangePolicy: "OnRootMismatch" + labels: {} + annotations: {} + +common: + labels: {} + +deployment: + labels: {} + annotations: {} + +service: + type: ClusterIP + annotations: {} + labels: {} + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPU: 80 + # targetMemory: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/operator-wandb/templates/_kafka.tpl b/charts/operator-wandb/templates/_kafka.tpl index c53a4072..5c81299d 100644 --- a/charts/operator-wandb/templates/_kafka.tpl +++ b/charts/operator-wandb/templates/_kafka.tpl @@ -1,7 +1,7 @@ {{/* These are the variables a service can expect - - name: KAFKA_BROKER_URL - value: "{{ include "wandb.kafka.brokerUrl" . }}" + - name: KAFKA_BROKER_HOST + value: "{{ include "wandb.kafka.brokerHost" . }}" - name: KAFKA_BROKER_PORT value: "{{ include "wandb.kafka.brokerPort" . }}" - name: KAFKA_CLIENT_USER @@ -27,7 +27,6 @@ Return the kafka client password {{ .Values.global.kafka.password }} {{- end -}} - {{/* Return name of secret where kafka information is stored */}} @@ -38,11 +37,11 @@ Return name of secret where kafka information is stored {{/* Return the kafka broker url port */}} -{{- define "wandb.kafka.brokerUrl" -}} -{{- if eq .Values.global.redis.host "" -}} +{{- define "wandb.kafka.brokerHost" -}} +{{- if eq .Values.global.kafka.brokerHost "" -}} {{ printf "%s-%s" .Release.Name "kafka" }} {{- else -}} -{{ .Values.global.kafka.brokerUrl }} +{{ .Values.global.kafka.brokerHost }} {{- end -}} {{- end -}} @@ -51,4 +50,12 @@ Return kafka broker url port */}} {{- define "wandb.kafka.brokerPort" -}} {{- print .Values.global.kafka.brokerPort -}} -{{- end -}} \ No newline at end of file +{{- end -}} + + +{{/* +Return the kafka topic name for run-updates-shadow +*/}} +{{- define "wandb.kafka.runUpdatesShadowTopic" -}} +{{ printf "%s-%s" .Release.Name "run-updates-shadow" | trunc 63 | trimSuffix "-" }} +{{- end -}} diff --git a/charts/operator-wandb/templates/kafka.yaml b/charts/operator-wandb/templates/kafka.yaml index 5c9198e5..ac074f87 100644 --- a/charts/operator-wandb/templates/kafka.yaml +++ b/charts/operator-wandb/templates/kafka.yaml @@ -6,4 +6,4 @@ metadata: labels: {{- include "wandb.commonLabels" . | nindent 4 }} data: - KAFKA_CLIENT_PASSWORD: {{ include "wandb.kafka.password" . | b64enc }} \ No newline at end of file + KAFKA_CLIENT_PASSWORD: {{ include "wandb.kafka.password" . | b64enc }} diff --git a/charts/operator-wandb/values.yaml b/charts/operator-wandb/values.yaml index 0fcc061d..1d796514 100644 --- a/charts/operator-wandb/values.yaml +++ b/charts/operator-wandb/values.yaml @@ -86,8 +86,9 @@ global: # the kafka dependency chart. user: &kafkaUser "wandb" password: &kafkaPassword "wandb" - brokerUrl: "" + brokerHost: "" brokerPort: 9092 + runUpdatesShadowTopic: "" ingress: nameOverride: "" @@ -127,6 +128,12 @@ console: repository: wandb/console tag: latest +flat-run-fields-updater: + install: false + image: + repository: wandb/local + tag: latest + mysql: install: true persistence: