summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-02-23 11:34:05 -0500
committerKenny Woodson <kwoodson@redhat.com>2017-02-24 13:28:38 -0500
commit315657e7befc62502e446dd889f96cfa4c0f5458 (patch)
tree225dcba1d60e0a144700a84d033ae637f5c90769 /roles
parentc2528f6ecda7e8f6ef5ffdccecd3f3532f2af03f (diff)
downloadopenshift-315657e7befc62502e446dd889f96cfa4c0f5458.tar.gz
openshift-315657e7befc62502e446dd889f96cfa4c0f5458.tar.bz2
openshift-315657e7befc62502e446dd889f96cfa4c0f5458.tar.xz
openshift-315657e7befc62502e446dd889f96cfa4c0f5458.zip
Fixed default variables. Added a fix to generated secret in env var.
Diffstat (limited to 'roles')
-rw-r--r--roles/lib_openshift/library/oc_adm_registry.py23
-rw-r--r--roles/lib_openshift/library/oc_adm_router.py12
-rw-r--r--roles/lib_openshift/library/oc_env.py12
-rw-r--r--roles/lib_openshift/library/oc_scale.py12
-rw-r--r--roles/lib_openshift/src/ansible/oc_adm_registry.py4
-rw-r--r--roles/lib_openshift/src/class/oc_adm_registry.py7
-rw-r--r--roles/lib_openshift/src/lib/deploymentconfig.py12
7 files changed, 78 insertions, 4 deletions
diff --git a/roles/lib_openshift/library/oc_adm_registry.py b/roles/lib_openshift/library/oc_adm_registry.py
index fa17d0e58..7f0b7f212 100644
--- a/roles/lib_openshift/library/oc_adm_registry.py
+++ b/roles/lib_openshift/library/oc_adm_registry.py
@@ -1655,6 +1655,18 @@ spec:
return None
+ def get_env_var(self, key):
+ '''return a environment variables '''
+ results = self.get(DeploymentConfig.env_path) or []
+ if not results:
+ return None
+
+ for env_var in results:
+ if env_var['name'] == key:
+ return env_var
+
+ return None
+
def get_replicas(self):
''' return replicas setting '''
return self.get(DeploymentConfig.replicas_path)
@@ -2354,6 +2366,13 @@ class Registry(OpenShiftCLI):
def add_modifications(self, deploymentconfig):
''' update a deployment config with changes '''
+ # The environment variable for REGISTRY_HTTP_SECRET is autogenerated
+ # We should set the generated deploymentconfig to the in memory version
+ # the following modifications will overwrite if needed
+ result = self.deploymentconfig.get_env_var('REGISTRY_HTTP_SECRET')
+ if result:
+ deploymentconfig.update_env_var('REGISTRY_HTTP_SECRET', result['value'])
+
# Currently we know that our deployment of a registry requires a few extra modifications
# Modification 1
# we need specific environment variables to be set
@@ -2547,8 +2566,8 @@ def main():
service_account=dict(default='registry', type='str'),
mount_host=dict(default=None, type='str'),
volume_mounts=dict(default=None, type='list'),
- env_vars=dict(default=None, type='dict'),
- edits=dict(default=None, type='list'),
+ env_vars=dict(default={}, type='dict'),
+ edits=dict(default=[], type='list'),
enforce_quota=dict(default=False, type='bool'),
force=dict(default=False, type='bool'),
daemonset=dict(default=False, type='bool'),
diff --git a/roles/lib_openshift/library/oc_adm_router.py b/roles/lib_openshift/library/oc_adm_router.py
index a9e76a92e..0cb824790 100644
--- a/roles/lib_openshift/library/oc_adm_router.py
+++ b/roles/lib_openshift/library/oc_adm_router.py
@@ -1808,6 +1808,18 @@ spec:
return None
+ def get_env_var(self, key):
+ '''return a environment variables '''
+ results = self.get(DeploymentConfig.env_path) or []
+ if not results:
+ return None
+
+ for env_var in results:
+ if env_var['name'] == key:
+ return env_var
+
+ return None
+
def get_replicas(self):
''' return replicas setting '''
return self.get(DeploymentConfig.replicas_path)
diff --git a/roles/lib_openshift/library/oc_env.py b/roles/lib_openshift/library/oc_env.py
index 3286985c5..684d0f626 100644
--- a/roles/lib_openshift/library/oc_env.py
+++ b/roles/lib_openshift/library/oc_env.py
@@ -1546,6 +1546,18 @@ spec:
return None
+ def get_env_var(self, key):
+ '''return a environment variables '''
+ results = self.get(DeploymentConfig.env_path) or []
+ if not results:
+ return None
+
+ for env_var in results:
+ if env_var['name'] == key:
+ return env_var
+
+ return None
+
def get_replicas(self):
''' return replicas setting '''
return self.get(DeploymentConfig.replicas_path)
diff --git a/roles/lib_openshift/library/oc_scale.py b/roles/lib_openshift/library/oc_scale.py
index 3523e7ea6..7b80710d7 100644
--- a/roles/lib_openshift/library/oc_scale.py
+++ b/roles/lib_openshift/library/oc_scale.py
@@ -1533,6 +1533,18 @@ spec:
return None
+ def get_env_var(self, key):
+ '''return a environment variables '''
+ results = self.get(DeploymentConfig.env_path) or []
+ if not results:
+ return None
+
+ for env_var in results:
+ if env_var['name'] == key:
+ return env_var
+
+ return None
+
def get_replicas(self):
''' return replicas setting '''
return self.get(DeploymentConfig.replicas_path)
diff --git a/roles/lib_openshift/src/ansible/oc_adm_registry.py b/roles/lib_openshift/src/ansible/oc_adm_registry.py
index a49b84589..c85973c7d 100644
--- a/roles/lib_openshift/src/ansible/oc_adm_registry.py
+++ b/roles/lib_openshift/src/ansible/oc_adm_registry.py
@@ -24,8 +24,8 @@ def main():
service_account=dict(default='registry', type='str'),
mount_host=dict(default=None, type='str'),
volume_mounts=dict(default=None, type='list'),
- env_vars=dict(default=None, type='dict'),
- edits=dict(default=None, type='list'),
+ env_vars=dict(default={}, type='dict'),
+ edits=dict(default=[], type='list'),
enforce_quota=dict(default=False, type='bool'),
force=dict(default=False, type='bool'),
daemonset=dict(default=False, type='bool'),
diff --git a/roles/lib_openshift/src/class/oc_adm_registry.py b/roles/lib_openshift/src/class/oc_adm_registry.py
index eb78667ca..069d58d9b 100644
--- a/roles/lib_openshift/src/class/oc_adm_registry.py
+++ b/roles/lib_openshift/src/class/oc_adm_registry.py
@@ -232,6 +232,13 @@ class Registry(OpenShiftCLI):
def add_modifications(self, deploymentconfig):
''' update a deployment config with changes '''
+ # The environment variable for REGISTRY_HTTP_SECRET is autogenerated
+ # We should set the generated deploymentconfig to the in memory version
+ # the following modifications will overwrite if needed
+ result = self.deploymentconfig.get_env_var('REGISTRY_HTTP_SECRET')
+ if result:
+ deploymentconfig.update_env_var('REGISTRY_HTTP_SECRET', result['value'])
+
# Currently we know that our deployment of a registry requires a few extra modifications
# Modification 1
# we need specific environment variables to be set
diff --git a/roles/lib_openshift/src/lib/deploymentconfig.py b/roles/lib_openshift/src/lib/deploymentconfig.py
index e37475ef5..6a0920d37 100644
--- a/roles/lib_openshift/src/lib/deploymentconfig.py
+++ b/roles/lib_openshift/src/lib/deploymentconfig.py
@@ -189,6 +189,18 @@ spec:
return None
+ def get_env_var(self, key):
+ '''return a environment variables '''
+ results = self.get(DeploymentConfig.env_path) or []
+ if not results:
+ return None
+
+ for env_var in results:
+ if env_var['name'] == key:
+ return env_var
+
+ return None
+
def get_replicas(self):
''' return replicas setting '''
return self.get(DeploymentConfig.replicas_path)