diff --git a/features/steps/cluster.py b/features/steps/cluster.py index cfb7246..5d2f85a 100644 --- a/features/steps/cluster.py +++ b/features/steps/cluster.py @@ -18,15 +18,15 @@ def __init__(self): name: '{name}' namespace: {namespace} labels: - app: myapp + app: '{name}' spec: selector: matchLabels: - app: myapp + app: '{name}' template: metadata: labels: - app: myapp + app: '{name}' spec: containers: - name: myapp @@ -196,8 +196,10 @@ def new_app(self, name, image_name, namespace, bindingRoot=None): namespace=namespace, bindingRoot=bindingRoot) if bindingRoot is not None: parsed = yaml.safe_load(formatted) - for obj in parsed['spec']['template']['spec']['containers']: - obj['env'] = [{'name': 'SERVICE_BINDING_ROOT', 'value': bindingRoot}] + for container in parsed['spec']['template']['spec']['containers']: + if 'env' not in container: + container['env'] = list() + container['env'].append({'name': 'SERVICE_BINDING_ROOT', 'value': bindingRoot}) formatted = yaml.dump(parsed) print(f'applying deployment: {formatted}') self.apply(formatted, namespace=namespace)