wandb / helm-charts

Our official helm charts for deploying wandb into k8s
MIT License
18 stars 8 forks source link

feat: Add support for env vars on Launch Agent #69

Closed flamarion closed 9 months ago

flamarion commented 9 months ago

The intention of this PR is to support people running W&B Launch Agent on local Kubernets but need to push data to ECR. With this configuration the AWS env vars can be set and provide access to the AWS resources to build the image.

Relevant values-test.yaml content

# Additional environment variables to set on the agent container.
additionalEnvVars:
  - name: COMMON_ENV_VAR_1
    value: "common-value1"
  - name: COMMON_ENV_VAR_2
    value: "common-value2"

# Additional secret environment variables to set on the agent container.
additionalSecretEnvVars:
  - name: SECRET_ENV_VAR_1
    value: "secret_test1"
  - name: SECRET_ENV_VAR_2
    value: "secret2_test2_

Applied the test

flamarion@wandb-mpb[±|add_support_for_env_vars_on_launch_agent U:4 ?:1 ✗]:~/src/helm-charts/charts $ helm upgrade --namespace=wandb --create-namespace --install wandb-launch ./launch-agent  -f values-test.yaml
Release "wandb-launch" has been upgraded. Happy Helming!
NAME: wandb-launch
LAST DEPLOYED: Mon Jan 29 19:27:46 2024
NAMESPACE: wandb
STATUS: deployed
REVISION: 26
TEST SUITE: None

Deployment was restarted and new pod created

 kubectl -n wandb get pods -w
NAME                                         READY   STATUS        RESTARTS   AGE
launch-agent-wandb-launch-664bbd6bf4-swxmd   1/1     Terminating   0          2m40s
launch-agent-wandb-launch-664bbd6bf4-swxmd   0/1     Terminating   0          3m2s
launch-agent-wandb-launch-664bbd6bf4-swxmd   0/1     Terminating   0          3m3s
launch-agent-wandb-launch-664bbd6bf4-swxmd   0/1     Terminating   0          3m3s
launch-agent-wandb-launch-664bbd6bf4-swxmd   0/1     Terminating   0          3m3s
launch-agent-wandb-launch-649cd6589f-xwnr8   0/1     Pending       0          0s
launch-agent-wandb-launch-649cd6589f-xwnr8   0/1     Pending       0          0s
launch-agent-wandb-launch-649cd6589f-xwnr8   0/1     ContainerCreating   0          0s
launch-agent-wandb-launch-649cd6589f-xwnr8   1/1     Running             0          2s

Validating if the env vars were set

flamarion@wandb-mpb[±|add_support_for_env_vars_on_launch_agent U:4 ?:1 ✗]:~/src/helm-charts/charts $ kubectl -n wandb exec -ti launch-agent-wandb-launch-649cd6589f-xwnr8 -- bash
launch_agent@launch-agent-wandb-launch-649cd6589f-xwnr8:~$ env | egrep 'COMMON|SECRET'
SECRET_ENV_VAR_2=secret2_test2_ok
SECRET_ENV_VAR_1=secret_test1
COMMON_ENV_VAR_1=common-value1
COMMON_ENV_VAR_2=common-value2
launch_agent@launch-agent-wandb-launch-649cd6589f-xwnr8:~$
exit