From 5779c09901422feed61f360a73894825a7312984 Mon Sep 17 00:00:00 2001 From: Justin Brooks Date: Mon, 21 Aug 2023 13:43:57 -0400 Subject: [PATCH] chore: add redis and parquet --- .gitignore | 1 + charts/operator-wandb/Chart.lock | 10 +- charts/operator-wandb/Chart.yaml | 10 +- .../charts/app/templates/deployment.yaml | 35 +++++- .../charts/mysql/templates/pvc.yaml | 2 +- .../operator-wandb/charts/mysql/values.yaml | 1 - .../operator-wandb/charts/parquet/.helmignore | 23 ++++ .../operator-wandb/charts/parquet/Chart.yaml | 6 ++ .../charts/parquet/templates/_helpers.tpl | 101 ++++++++++++++++++ .../charts/parquet/templates/deployment.yaml | 68 ++++++++++++ .../charts/parquet/templates/service.yaml | 25 +++++ .../operator-wandb/charts/parquet/values.yaml | 42 ++++++++ .../operator-wandb/charts/redis/.helmignore | 23 ++++ charts/operator-wandb/charts/redis/Chart.yaml | 6 ++ .../charts/redis/templates/_helpers.tpl | 101 ++++++++++++++++++ .../charts/redis/templates/service.yaml | 25 +++++ .../charts/redis/templates/statefulset.yaml | 56 ++++++++++ .../operator-wandb/charts/redis/values.yaml | 34 ++++++ charts/operator-wandb/charts/weave/Chart.yaml | 21 +--- .../charts/weave/templates/deployment.yaml | 1 + charts/operator-wandb/templates/_redis.tpl | 50 +++++++++ charts/operator-wandb/templates/_storage.tpl | 8 +- charts/operator-wandb/templates/redis.yaml | 11 ++ charts/operator-wandb/values.yaml | 30 ++++-- 24 files changed, 653 insertions(+), 37 deletions(-) create mode 100644 charts/operator-wandb/charts/parquet/.helmignore create mode 100644 charts/operator-wandb/charts/parquet/Chart.yaml create mode 100644 charts/operator-wandb/charts/parquet/templates/_helpers.tpl create mode 100644 charts/operator-wandb/charts/parquet/templates/deployment.yaml create mode 100644 charts/operator-wandb/charts/parquet/templates/service.yaml create mode 100644 charts/operator-wandb/charts/parquet/values.yaml create mode 100644 charts/operator-wandb/charts/redis/.helmignore create mode 100644 charts/operator-wandb/charts/redis/Chart.yaml create mode 100644 charts/operator-wandb/charts/redis/templates/_helpers.tpl create mode 100644 charts/operator-wandb/charts/redis/templates/service.yaml create mode 100644 charts/operator-wandb/charts/redis/templates/statefulset.yaml create mode 100644 charts/operator-wandb/charts/redis/values.yaml create mode 100644 charts/operator-wandb/templates/_redis.tpl create mode 100644 charts/operator-wandb/templates/redis.yaml diff --git a/.gitignore b/.gitignore index ea5491a7..a7e0b4e1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.tgz .vscode/ dryrun.yaml +test-values.yaml diff --git a/charts/operator-wandb/Chart.lock b/charts/operator-wandb/Chart.lock index b8838474..0febe028 100644 --- a/charts/operator-wandb/Chart.lock +++ b/charts/operator-wandb/Chart.lock @@ -8,8 +8,14 @@ dependencies: - 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 -digest: sha256:97fa6018a524348b546cecd7a7c49f872eac0040698e833f4b43ed583ba069fa -generated: "2023-08-15T22:43:20.053539432-04:00" +- name: redis + repository: file://charts/redis + version: 0.1.0 +digest: sha256:1b7b3d43935aec297fae6fc09416cd5df785852f3d4d6ddd22617efe0fc20ca7 +generated: "2023-08-21T13:31:32.01111468-04:00" diff --git a/charts/operator-wandb/Chart.yaml b/charts/operator-wandb/Chart.yaml index eaa1b619..a87c4730 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.1.1 +version: 0.1.2 appVersion: 1.0.0 icon: https://wandb.ai/logo.svg maintainers: @@ -23,7 +23,15 @@ dependencies: version: "*.*.*" repository: file://charts/weave condition: weave.install + - name: parquet + version: "*.*.*" + repository: file://charts/parquet + condition: parquet.install - name: mysql version: "*.*.*" repository: file://charts/mysql condition: mysql.install + - name: redis + version: "*.*.*" + repository: file://charts/redis + condition: redis.install diff --git a/charts/operator-wandb/charts/app/templates/deployment.yaml b/charts/operator-wandb/charts/app/templates/deployment.yaml index e35e090c..c708ac53 100644 --- a/charts/operator-wandb/charts/app/templates/deployment.yaml +++ b/charts/operator-wandb/charts/app/templates/deployment.yaml @@ -74,6 +74,7 @@ spec: - name: GORILLA_CORS_ORIGINS value: "{{ join "," .Values.extraCors }}" {{- end }} + - name: MYSQL_PORT value: "{{ include "wandb.mysql.port" . }}" - name: MYSQL_HOST @@ -87,12 +88,38 @@ spec: secretKeyRef: name: {{ include "wandb.mysql.passwordSecret" . }} key: MYSQL_PASSWORD - # - name: MYSQL - # value: "mysql://$(MYSQL_USER):$(MYSQL_PASSWORD)@$(MYSQL_HOST):$(MYSQL_PORT)/$(MYSQL_DATABASE)" - - name: HOST - value: {{ .Values.host }} + - name: MYSQL + value: "mysql://$(MYSQL_USER):$(MYSQL_PASSWORD)@$(MYSQL_HOST):$(MYSQL_PORT)/$(MYSQL_DATABASE)" + + - name: REDIS_PORT + value: "{{ include "wandb.redis.port" . }}" + {{- if ne (include "wandb.redis.password" .) "" }} + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "wandb.redis.passwordSecret" . }} + key: REDIS_PASSWORD + {{- end }} + - name: REDIS_HOST + value: "{{ include "wandb.redis.host" . }}" + - name: WEAVE_SERVICE value: {{ .Release.Name }}-weave:9994 + + - name: PARQUET_HOST + value: "http://{{ .Release.Name }}-parquet:8087" + - name: PARQUET_ENABLED + value: "true" + + + - name: HOST + value: {{ .Values.host }} + - name: BUCKET + value: {{ .Values.global.storage.connectionString }} + - name: AWS_REGION + value: {{ .Values.global.storage.region }} + - name: LOGGING_ENABLED + value: 'true' {{- include "app.extraEnv" (dict "global" .Values.global "local" .) | nindent 12 }} {{- include "wandb.extraEnvFrom" (dict "root" $ "local" .) | nindent 12 }} livenessProbe: diff --git a/charts/operator-wandb/charts/mysql/templates/pvc.yaml b/charts/operator-wandb/charts/mysql/templates/pvc.yaml index 012d0cb2..619725f2 100644 --- a/charts/operator-wandb/charts/mysql/templates/pvc.yaml +++ b/charts/operator-wandb/charts/mysql/templates/pvc.yaml @@ -10,7 +10,7 @@ metadata: spec: accessModes: - ReadWriteOnce - storageClassName: {{ include "wandb.storageClass" . }} + {{ include "wandb.storageClass" . | nindent 4 }} resources: requests: storage: {{ .Values.persistence.size | quote }} diff --git a/charts/operator-wandb/charts/mysql/values.yaml b/charts/operator-wandb/charts/mysql/values.yaml index 36f22cbd..26ae28f8 100644 --- a/charts/operator-wandb/charts/mysql/values.yaml +++ b/charts/operator-wandb/charts/mysql/values.yaml @@ -17,7 +17,6 @@ tolerations: [] extraEnv: {} extraEnvFrom: {} -extraCors: [] common: {} service: diff --git a/charts/operator-wandb/charts/parquet/.helmignore b/charts/operator-wandb/charts/parquet/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/operator-wandb/charts/parquet/.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/parquet/Chart.yaml b/charts/operator-wandb/charts/parquet/Chart.yaml new file mode 100644 index 00000000..70d7459d --- /dev/null +++ b/charts/operator-wandb/charts/parquet/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: parquet +description: A Helm chart for deploying parquet to kubernetes +type: application +version: 0.1.0 +appVersion: 1.0.0 diff --git a/charts/operator-wandb/charts/parquet/templates/_helpers.tpl b/charts/operator-wandb/charts/parquet/templates/_helpers.tpl new file mode 100644 index 00000000..c7a669dc --- /dev/null +++ b/charts/operator-wandb/charts/parquet/templates/_helpers.tpl @@ -0,0 +1,101 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Expand the name of the chart. +*/}} +{{- define "parquet.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 "parquet.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 "parquet.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "parquet.labels" -}} +helm.sh/chart: {{ include "parquet.chart" . }} +{{ include "parquet.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +wandb.com/app-name: {{ include "parquet.chart" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "parquet.selectorLabels" -}} +app.kubernetes.io/name: {{ include "parquet.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "parquet.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "parquet.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Returns the extraEnv keys and values to inject into containers. + +Global values will override any chart-specific values. +*/}} +{{- define "parquet.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 +app deployments and other shared objects. +*/}} +{{- define "parquet.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 +app deployments. +*/}} +{{- define "parquet.podLabels" -}} +{{- range $key, $value := .Values.pod.labels }} +{{ $key }}: {{ $value | quote }} +{{- end }} +{{- end -}} diff --git a/charts/operator-wandb/charts/parquet/templates/deployment.yaml b/charts/operator-wandb/charts/parquet/templates/deployment.yaml new file mode 100644 index 00000000..01e48212 --- /dev/null +++ b/charts/operator-wandb/charts/parquet/templates/deployment.yaml @@ -0,0 +1,68 @@ +{{- if .Values.enabled }} +{{- $imageCfg := dict "global" $.Values.global.image "local" $.Values.image -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "parquet.fullname" . }} + labels: + {{- include "wandb.commonLabels" . | nindent 4 }} + {{- include "parquet.commonLabels" . | nindent 4 }} + {{- include "parquet.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: + replicas: 1 + selector: + matchLabels: + {{- include "wandb.selectorLabels" $ | nindent 6 }} + {{- include "parquet.labels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "wandb.podLabels" . | nindent 8 }} + {{- include "parquet.commonLabels" . | nindent 8 }} + {{- include "parquet.podLabels" . | nindent 8 }} + {{- include "parquet.labels" . | nindent 8 }} + annotations: + {{- if .Values.pod.annotations -}} + {{- toYaml .Values.pod.annotations | nindent 4 }} + {{- end }} + spec: + {{- if .tolerations }} + tolerations: + {{- toYaml .tolerations | nindent 8 }} + {{- end }} + {{- include "wandb.nodeSelector" . | nindent 6 }} + {{- include "wandb.priorityClassName" . | nindent 6 }} + {{- include "wandb.podSecurityContext" .Values.pod.securityContext | nindent 6 }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + ports: + - name: parquet + containerPort: 8087 + protocol: TCP + env: + - name: ONLY_SERVICE + value: gorilla-parquet + + - name: BUCKET + value: {{ .Values.global.storage.connectionString }} + - name: AWS_REGION + value: {{ .Values.global.storage.region }} + + - name: LOGGING_ENABLED + value: 'true' + + {{- include "parquet.extraEnv" (dict "global" .Values.global "local" .) | nindent 12 }} + {{- include "wandb.extraEnvFrom" (dict "root" $ "local" .) | nindent 12 }} + + resources: + {{- toYaml .Values.resources | nindent 12 }} +{{- end }} \ No newline at end of file diff --git a/charts/operator-wandb/charts/parquet/templates/service.yaml b/charts/operator-wandb/charts/parquet/templates/service.yaml new file mode 100644 index 00000000..c6242f4b --- /dev/null +++ b/charts/operator-wandb/charts/parquet/templates/service.yaml @@ -0,0 +1,25 @@ +{{- if .Values.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "weave.fullname" . }} + labels: + {{- include "wandb.commonLabels" . | nindent 4 }} + {{- include "weave.labels" . | nindent 4 }} + {{- include "weave.commonLabels" . | nindent 4 }} + {{- if .Values.service.labels -}} + {{- toYaml .Values.service.labels | nindent 4 }} + {{- end }} + annotations: + {{- if .Values.service.annotations -}} + {{- toYaml .Values.service.annotations | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 8087 + protocol: TCP + name: parquet + selector: + {{- include "weave.labels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/charts/operator-wandb/charts/parquet/values.yaml b/charts/operator-wandb/charts/parquet/values.yaml new file mode 100644 index 00000000..48f44144 --- /dev/null +++ b/charts/operator-wandb/charts/parquet/values.yaml @@ -0,0 +1,42 @@ +enabled: true + +nameOverride: "" +fullnameOverride: "" + +image: + repository: wandb/local + tag: latest + pullPolicy: Always + +tolerations: [] + +extraEnv: {} +extraEnvFrom: {} + +extraCors: [] + +common: {} +deployment: {} +serviceAccount: {} +clusterRole: {} + +service: + type: ClusterIP + +pod: + securityContext: + runAsUser: 1000 + fsGroup: 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:'. + requests: + cpu: 1 + memory: 2Gi + limits: + cpu: 8 + memory: 16Gi diff --git a/charts/operator-wandb/charts/redis/.helmignore b/charts/operator-wandb/charts/redis/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/operator-wandb/charts/redis/.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/redis/Chart.yaml b/charts/operator-wandb/charts/redis/Chart.yaml new file mode 100644 index 00000000..e92f7b56 --- /dev/null +++ b/charts/operator-wandb/charts/redis/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: redis +description: A simple Helm chart for redis +type: application +version: 0.1.0 +appVersion: "1.0.0" diff --git a/charts/operator-wandb/charts/redis/templates/_helpers.tpl b/charts/operator-wandb/charts/redis/templates/_helpers.tpl new file mode 100644 index 00000000..88ff2a73 --- /dev/null +++ b/charts/operator-wandb/charts/redis/templates/_helpers.tpl @@ -0,0 +1,101 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* +Expand the name of the chart. +*/}} +{{- define "redis.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 "redis.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 "redis.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "redis.labels" -}} +helm.sh/chart: {{ include "redis.chart" . }} +{{ include "redis.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +wandb.com/app-name: {{ include "redis.chart" . }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "redis.selectorLabels" -}} +app.kubernetes.io/name: {{ include "redis.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "redis.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "redis.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Returns the extraEnv keys and values to inject into containers. + +Global values will override any chart-specific values. +*/}} +{{- define "redis.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 +app deployments and other shared objects. +*/}} +{{- define "redis.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 +app deployments. +*/}} +{{- define "redis.podLabels" -}} +{{- range $key, $value := .Values.pod.labels }} +{{ $key }}: {{ $value | quote }} +{{- end }} +{{- end -}} diff --git a/charts/operator-wandb/charts/redis/templates/service.yaml b/charts/operator-wandb/charts/redis/templates/service.yaml new file mode 100644 index 00000000..bafa8d60 --- /dev/null +++ b/charts/operator-wandb/charts/redis/templates/service.yaml @@ -0,0 +1,25 @@ +{{- if .Values.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "wandb.redis.host" . }} + labels: + {{- include "wandb.commonLabels" . | nindent 4 }} + {{- include "redis.labels" . | nindent 4 }} + {{- include "redis.commonLabels" . | nindent 4 }} + {{- if .Values.service.labels -}} + {{- toYaml .Values.service.labels | nindent 4 }} + {{- end }} + annotations: + {{- if .Values.service.annotations -}} + {{- toYaml .Values.service.annotations | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ include "wandb.redis.port" . }} + protocol: TCP + targetPort: redis + selector: + {{- include "redis.labels" . | nindent 4 }} +{{- end }} \ No newline at end of file diff --git a/charts/operator-wandb/charts/redis/templates/statefulset.yaml b/charts/operator-wandb/charts/redis/templates/statefulset.yaml new file mode 100644 index 00000000..d8597cc5 --- /dev/null +++ b/charts/operator-wandb/charts/redis/templates/statefulset.yaml @@ -0,0 +1,56 @@ +{{- if .Values.enabled }} +{{- $imageCfg := dict "global" $.Values.global.image "local" $.Values.image -}} +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "redis.fullname" . }} + labels: + {{- include "wandb.commonLabels" . | nindent 4 }} + {{- include "redis.commonLabels" . | nindent 4 }} + {{- include "redis.labels" . | nindent 4 }} +spec: + replicas: 1 + selector: + matchLabels: + {{- include "wandb.selectorLabels" $ | nindent 6 }} + {{- include "redis.labels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "wandb.podLabels" . | nindent 8 }} + {{- include "redis.commonLabels" . | nindent 8 }} + {{- include "redis.podLabels" . | nindent 8 }} + {{- include "redis.labels" . | nindent 8 }} + spec: + {{- if .tolerations }} + tolerations: + {{- toYaml .tolerations | nindent 8 }} + {{- end }} + {{- include "wandb.nodeSelector" . | nindent 6 }} + {{- include "wandb.priorityClassName" . | nindent 6 }} + {{- include "wandb.podSecurityContext" .Values.pod.securityContext | nindent 6 }} + containers: + - name: redis + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + ports: + - name: redis + containerPort: 6379 + protocol: TCP + env: + {{- include "redis.extraEnv" (dict "global" .Values.global "local" .) | nindent 12 }} + {{- include "wandb.extraEnvFrom" (dict "root" $ "local" .) | nindent 12 }} + livenessProbe: + exec: + command: + - sh + - -c + - redis-cli ping + readinessProbe: + exec: + command: + - sh + - -c + - redis-cli ping + resources: + {{- toYaml .Values.resources | nindent 12 }} +{{- end }} \ No newline at end of file diff --git a/charts/operator-wandb/charts/redis/values.yaml b/charts/operator-wandb/charts/redis/values.yaml new file mode 100644 index 00000000..3e0a79ac --- /dev/null +++ b/charts/operator-wandb/charts/redis/values.yaml @@ -0,0 +1,34 @@ +enabled: true + +nameOverride: "" +fullnameOverride: "" + +image: + repository: redis + tag: latest + pullPolicy: Always + +tolerations: [] + +extraEnv: {} +extraEnvFrom: {} + +common: {} + +service: + type: ClusterIP + annotations: {} + labels: {} + +pod: + securityContext: + runAsUser: 1000 + fsGroup: 1000 + +resources: + requests: + cpu: 500m + memory: 1Gi + limits: + cpu: 4000m + memory: 8Gi diff --git a/charts/operator-wandb/charts/weave/Chart.yaml b/charts/operator-wandb/charts/weave/Chart.yaml index 409b0b2c..518f17c6 100644 --- a/charts/operator-wandb/charts/weave/Chart.yaml +++ b/charts/operator-wandb/charts/weave/Chart.yaml @@ -1,24 +1,5 @@ apiVersion: v2 name: weave description: A Helm chart for Kubernetes - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) version: 0.1.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "1.16.0" +appVersion: "1.0.0" diff --git a/charts/operator-wandb/charts/weave/templates/deployment.yaml b/charts/operator-wandb/charts/weave/templates/deployment.yaml index 610287ef..9dc3a298 100644 --- a/charts/operator-wandb/charts/weave/templates/deployment.yaml +++ b/charts/operator-wandb/charts/weave/templates/deployment.yaml @@ -59,6 +59,7 @@ spec: value: {{ .Values.global.host }}/graphql - name: WEAVE_SERVER_ENABLE_LOGGING value: 'true' + {{- include "weave.extraEnv" (dict "global" .Values.global "local" .) | nindent 12 }} {{- include "wandb.extraEnvFrom" (dict "root" $ "local" .) | nindent 12 }} livenessProbe: diff --git a/charts/operator-wandb/templates/_redis.tpl b/charts/operator-wandb/templates/_redis.tpl new file mode 100644 index 00000000..7b8299af --- /dev/null +++ b/charts/operator-wandb/templates/_redis.tpl @@ -0,0 +1,50 @@ +{{/* +Return name of secret where redis information is stored +*/}} +{{- define "wandb.redis.passwordSecret" -}} +{{- print .Release.Name "-redis" -}} +{{- end -}} + +{{/* +Return the redis port +*/}} +{{- define "wandb.redis.port" -}} +{{- print $.Values.global.redis.port -}} +{{- end -}} + +{{/* +Return the db host +*/}} +{{- define "wandb.redis.host" -}} +{{- if eq .Values.global.redis.host "" -}} +{{ printf "%s-%s" .Release.Name "redis" }} +{{- else -}} +{{ .Values.global.redis.host }} +{{- end -}} +{{- end -}} + +{{/* +Return the redis password +*/}} +{{- define "wandb.redis.password" -}} +{{- print $.Values.global.redis.password -}} +{{- end -}} + +{{/* +Return the redis to url +*/}} +{{- define "wandb.redis.parametersQuery" }} +{{- range $key, $val := $.Values.global.redis.parameters }} +{{- printf "%s=%s&" $key $val | urlquery }} +{{- end }} +{{- end }} + + +{{- define "wandb.redis.connectionString" -}} +{{- $password := include "wandb.redis.password" . }} +{{- if $password }} +print "redis://:{{ $password }}@$(REDIS_HOST):$(REDIS_PORT)" +{{- else }} +print "redis://$(REDIS_HOST):$(REDIS_PORT)" +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/operator-wandb/templates/_storage.tpl b/charts/operator-wandb/templates/_storage.tpl index c70e6121..427b2fa0 100644 --- a/charts/operator-wandb/templates/_storage.tpl +++ b/charts/operator-wandb/templates/_storage.tpl @@ -1,7 +1,11 @@ {{- define "wandb.storageClass" -}} {{- if .Values.storageClass -}} -{{- .Values.storageClass -}} +{{- if (ne .Values.storageClass "") -}} +{{- printf "storageClassName: %s" .Values.storageClass -}} +{{- end -}} {{- else if .Values.global.storageClass -}} -{{- .Values.global.storageClass -}} +{{- if (ne .Values.global.storageClass "") -}} +{{- printf "storageClassName: %s" .Values.global.storageClass -}} +{{- end -}} {{- end -}} {{- end -}} \ No newline at end of file diff --git a/charts/operator-wandb/templates/redis.yaml b/charts/operator-wandb/templates/redis.yaml new file mode 100644 index 00000000..01575ac2 --- /dev/null +++ b/charts/operator-wandb/templates/redis.yaml @@ -0,0 +1,11 @@ +{{- if not .Values.redis.install }} +{{- $secretName := (include "wandb.redis.passwordSecret" .) }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ $secretName }} + labels: + {{- include "wandb.commonLabels" . | nindent 4 }} +data: + REDIS_PASSWORD: {{ include "wandb.redis.password" . | b64enc }} +{{- end }} \ No newline at end of file diff --git a/charts/operator-wandb/values.yaml b/charts/operator-wandb/values.yaml index ba25a3f7..928b11fa 100644 --- a/charts/operator-wandb/values.yaml +++ b/charts/operator-wandb/values.yaml @@ -51,31 +51,49 @@ global: storage: connectionString: "" - region: "us-west-1" - encryption: aws:kms - encryptionKmsKeyArn: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab + region: "" + kmsKeyArn: "" -app: + redis: + host: "" + port: 6379 + password: "" + parameters: {} + caCert: "" + +parquet: + install: true image: repository: wandb/local tag: latest -console: +app: + install: true image: - repository: wandb/console + repository: wandb/local tag: latest weave: + install: true image: repository: wandb/local tag: latest +console: + install: true + image: + repository: wandb/console + tag: latest + mysql: install: true persistence: size: 20Gi storageClass: "" +redis: + install: true + ingress: defaultBackend: "app" annotations: {}