Skip to content

Commit 9079238

Browse files
committed
Merge pull request #769 from helgi/double_env
fix(scheduler): update instead of appending env vars so hardcoded values can be overwritten
2 parents f5e43f9 + ab5f680 commit 9079238

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

rootfs/scheduler/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ def _set_container(self, namespace, data, **kwargs): # noqa
664664
self._create_secret(namespace, secret_name, secrets_env, labels=labels)
665665

666666
for key in env.keys():
667-
data["env"].append({
667+
item = {
668668
"name": key,
669669
"valueFrom": {
670670
"secretKeyRef": {
@@ -673,7 +673,14 @@ def _set_container(self, namespace, data, **kwargs): # noqa
673673
"key": key.lower().replace('_', '-')
674674
}
675675
}
676-
})
676+
}
677+
678+
# add value to env hash. Overwrite hardcoded values if need be
679+
match = next((k for k, e in enumerate(data["env"]) if e['name'] == key), None)
680+
if match is not None:
681+
data["env"][match] = item
682+
else:
683+
data["env"].append(item)
677684

678685
# Inject debugging if workflow is in debug mode
679686
if os.environ.get("DEIS_DEBUG", False):

0 commit comments

Comments
 (0)