Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
fix(scheduler): update instead of appending env vars so hardcoded val…
Browse files Browse the repository at this point in the history
…ues can be overwritten

An example of this would be a user wanting to overwrite a hardcoded PORT or one of the other values Deis may set. Generally people should not do that, however the flexibility should be there in case they want to play with fire

Fixes #766
  • Loading branch information
helgi committed Jun 1, 2016
1 parent f5e43f9 commit ab5f680
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions rootfs/scheduler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def _set_container(self, namespace, data, **kwargs): # noqa
self._create_secret(namespace, secret_name, secrets_env, labels=labels)

for key in env.keys():
data["env"].append({
item = {
"name": key,
"valueFrom": {
"secretKeyRef": {
Expand All @@ -673,7 +673,14 @@ def _set_container(self, namespace, data, **kwargs): # noqa
"key": key.lower().replace('_', '-')
}
}
})
}

# add value to env hash. Overwrite hardcoded values if need be
match = next((k for k, e in enumerate(data["env"]) if e['name'] == key), None)
if match is not None:
data["env"][match] = item
else:
data["env"].append(item)

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

0 comments on commit ab5f680

Please sign in to comment.