Skip to content

Commit

Permalink
feat: Differentiate between bucket settings provided as default and s…
Browse files Browse the repository at this point in the history
…et explicitly by the user for wandb managed installs (#199)
  • Loading branch information
danielpanzella authored Aug 2, 2024
1 parent ee53417 commit 256b90e
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 38 deletions.
2 changes: 1 addition & 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.16.2
version: 0.17.0
appVersion: 1.0.0
icon: https://wandb.ai/logo.svg

Expand Down
20 changes: 12 additions & 8 deletions charts/operator-wandb/charts/app/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,22 @@ app deployments.
{{- end }}

{{- define "app.bucket" -}}
{{- $bucketValues := .Values.global.defaultBucket }}
{{- if .Values.global.bucket.provider }}
{{- $bucketValues := .Values.global.bucket }}
{{- end }}
{{- $bucket := "" -}}
{{- if eq .Values.global.bucket.provider "az" -}}
{{- $bucket = printf "az://%s/%s" .Values.global.bucket.name .Values.global.bucket.path -}}
{{- if eq $bucketValues.provider "az" -}}
{{- $bucket = printf "az://%s/%s" $bucketValues.name $bucketValues.path -}}
{{- end -}}
{{- if eq .Values.global.bucket.provider "gcs" -}}
{{- $bucket = printf "gs://%s/%s" .Values.global.bucket.name .Values.global.bucket.path -}}
{{- if eq $bucketValues.provider "gcs" -}}
{{- $bucket = printf "gs://%s/%s" $bucketValues.name $bucketValues.path -}}
{{- 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 -}}
{{- if eq $bucketValues.provider "s3" -}}
{{- if and $bucketValues.accessKey $bucketValues.secretKey -}}
{{- $bucket = printf "s3://%s:%s@%s/%s" $bucketValues.accessKey $bucketValues.secretKey $bucketValues.name $bucketValues.path -}}
{{- else -}}
{{- $bucket = printf "s3://%s/%s" .Values.global.bucket.name .Values.global.bucket.path -}}
{{- $bucket = printf "s3://%s/%s" $bucketValues.name $bucketValues.path -}}
{{- end -}}
{{- end -}}
{{- trimSuffix "/" $bucket -}}
Expand Down
4 changes: 2 additions & 2 deletions charts/operator-wandb/charts/app/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ spec:
- name: BUCKET
value: "{{ include "app.bucket" . }}"
- name: AWS_REGION
value: {{ .Values.global.bucket.region }}
value: {{ .Values.global.bucket.region | default .Values.global.defaultBucket.region }}
- name: AWS_S3_KMS_ID
value: "{{ .Values.global.bucket.kmsKey }}"
value: "{{ .Values.global.bucket.kmsKey | default .Values.global.defaultBucket.kmsKey }}"

- name: OPERATOR_ENABLED
value: 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,22 @@ Create the name of the service account to use
{{- 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 -}}
{{- $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 $bucketValues.path -}}
{{- end -}}
{{- if eq .Values.global.bucket.provider "gcs" -}}
{{- $bucket = printf "gs://%s/%s" .Values.global.bucket.name .Values.global.bucket.path -}}
{{- if eq $bucketValues.provider "gcs" -}}
{{- $bucket = printf "gs://%s/%s" $bucketValues.name $bucketValues.path -}}
{{- 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 -}}
{{- if eq $bucketValues.provider "s3" -}}
{{- if and $bucketValues.accessKey $bucketValues.secretKey -}}
{{- $bucket = printf "s3://%s:%s@%s/%s" $bucketValues.accessKey $bucketValues.secretKey $bucketValues.name $bucketValues.path -}}
{{- else -}}
{{- $bucket = printf "s3://%s/%s" .Values.global.bucket.name .Values.global.bucket.path -}}
{{- $bucket = printf "s3://%s/%s" $bucketValues.name $bucketValues.path -}}
{{- end -}}
{{- end -}}
{{- trimSuffix "/" $bucket -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ spec:
- name: BUCKET
value: "{{ include "flat-run-fields-updater.bucket" .}}"
- name: AWS_REGION
value: {{ .Values.global.bucket.region }}
value: {{ .Values.global.bucket.region | default .Values.global.defaultBucket.region }}
- name: AWS_S3_KMS_ID
value: "{{ .Values.global.bucket.kmsKey }}"
value: "{{ .Values.global.bucket.kmsKey | default .Values.global.defaultBucket.kmsKey }}"
- name: GORILLA_RUN_UPDATE_SHADOW_QUEUE
value: >
{
Expand Down
22 changes: 13 additions & 9 deletions charts/operator-wandb/charts/parquet/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,22 @@ app deployments.
{{- end -}}

{{- define "parquet.bucket" -}}
{{- $bucket := "" -}}
{{- if eq .Values.global.bucket.provider "az" -}}
{{- $bucket = printf "az://%s/%s" .Values.global.bucket.name .Values.global.bucket.path -}}
{{- $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 $bucketValues.path -}}
{{- end -}}
{{- if eq .Values.global.bucket.provider "gcs" -}}
{{- $bucket = printf "gs://%s/%s" .Values.global.bucket.name .Values.global.bucket.path -}}
{{- if eq $bucketValues.provider "gcs" -}}
{{- $bucket = printf "gs://%s/%s" $bucketValues.name $bucketValues.path -}}
{{- 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 -}}
{{- if eq $bucketValues.provider "s3" -}}
{{- if and $bucketValues.accessKey $bucketValues.secretKey -}}
{{- $bucket = printf "s3://%s:%s@%s/%s" $bucketValues.accessKey $bucketValues.secretKey $bucketValues.name $bucketValues.path -}}
{{- else -}}
{{- $bucket = printf "s3://%s/%s" .Values.global.bucket.name .Values.global.bucket.path -}}
{{- $bucket = printf "s3://%s/%s" $bucketValues.name $bucketValues.path -}}
{{- end -}}
{{- end -}}
{{- trimSuffix "/" $bucket -}}
Expand Down
4 changes: 2 additions & 2 deletions charts/operator-wandb/charts/parquet/templates/cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ spec:
- name: BUCKET
value: "{{ include "parquet.bucket" . }}"
- name: AWS_REGION
value: {{ .Values.global.bucket.region }}
value: {{ .Values.global.bucket.region | default .Values.global.defaultBucket.region }}
- name: AWS_S3_KMS_ID
value: "{{ .Values.global.bucket.kmsKey }}"
value: "{{ .Values.global.bucket.kmsKey | default .Values.global.defaultBucket.kmsKey }}"

- name: AZURE_STORAGE_KEY
valueFrom:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ spec:
- name: BUCKET
value: "{{ include "parquet.bucket" . }}"
- name: AWS_REGION
value: {{ .Values.global.bucket.region }}
value: {{ .Values.global.bucket.region | default .Values.global.defaultBucket.region }}
- name: AWS_S3_KMS_ID
value: "{{ .Values.global.bucket.kmsKey }}"
value: "{{ .Values.global.bucket.kmsKey | default .Values.global.defaultBucket.kmsKey }}"
- name: AZURE_STORAGE_KEY
valueFrom:
secretKeyRef:
Expand Down
4 changes: 2 additions & 2 deletions charts/operator-wandb/templates/bucket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ metadata:
labels:
{{- include "wandb.commonLabels" . | nindent 4 }}
data:
ACCESS_KEY: {{ .Values.global.bucket.accessKey | b64enc }}
SECRET_KEY: {{ .Values.global.bucket.secretKey | b64enc }}
ACCESS_KEY: {{ .Values.global.bucket.accessKey | default .Values.global.defaultBucket.accessKey | b64enc }}
SECRET_KEY: {{ .Values.global.bucket.secretKey | default .Values.global.defaultBucket.secretKey | b64enc }}
6 changes: 5 additions & 1 deletion charts/operator-wandb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ global:
authMethod: ""
issuer: ""

bucket:
# Storage bucket that will be used by the application by default but can be overridden by the user in the wandb-console.
defaultBucket:
# az, s3, gcs
provider: "s3"
name: ""
Expand All @@ -96,6 +97,9 @@ global:
secretKey: ""
accessKey: ""

# If specified the application will use this bucket for all storage operations, and will not be overridable by the user.
bucket: {}

redis:
host: ""
port: 6379
Expand Down

0 comments on commit 256b90e

Please sign in to comment.