Describe the issue:
To use a different port or non default FQDN for the scheduler we provide DASK_SCHEDULER_ADDRESS env in daskcluster.spec.worker.spec.containers[0].env, however the operator creates 2 items in worker deployment env. The last one overrides the first in the pod's env. So we cannot change DASK_SCHEDULER_ADDRESS environment variable from dask kubernetes objects.
for container in deployment_spec["spec"]["template"]["spec"]["containers"]:
if "env" in container:
# Remove duplicate env vars
container_env_names = [env_item["name"] for env_item in container["env"]]
for env_item in env:
if env_item["name"] in container_env_names:
env.remove(env_item)
# Add the env vars
container["env"].extend(env)
else:
container["env"] = env
Describe the issue: To use a different port or non default FQDN for the scheduler we provide
DASK_SCHEDULER_ADDRESS
env indaskcluster
.spec.worker.spec.containers[0].env
, however the operator creates 2 items in worker deployment env. The last one overrides the first in the pod's env. So we cannot changeDASK_SCHEDULER_ADDRESS
environment variable from dask kubernetes objects.Minimal Complete Verifiable Example:
DaskWorkerGroup
Worker Pod
Anything else we need to know?:
Duplicate items with same names in container["env"] and env should be removed from env before adding it to configuration Current: https://github.com/dask/dask-kubernetes/blob/b668cc62944dc3eac225dc4c4ff01f2b3743c9da/dask_kubernetes/operator/controller/controller.py#L166-L170 https://github.com/dask/dask-kubernetes/blob/b668cc62944dc3eac225dc4c4ff01f2b3743c9da/dask_kubernetes/operator/controller/controller.py#L202-L206
Fix:
Environment: 2024.3.0 dask operator