summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_facts')
-rw-r--r--roles/openshift_facts/defaults/main.yml6
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py100
2 files changed, 27 insertions, 79 deletions
diff --git a/roles/openshift_facts/defaults/main.yml b/roles/openshift_facts/defaults/main.yml
new file mode 100644
index 000000000..7064d727a
--- /dev/null
+++ b/roles/openshift_facts/defaults/main.yml
@@ -0,0 +1,6 @@
+---
+openshift_cli_image_dict:
+ origin: 'openshift/origin'
+ openshift-enterprise: 'openshift3/ose'
+
+openshift_cli_image: "{{ osm_image | default(openshift_cli_image_dict[openshift_deployment_type]) }}"
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 0cb5f40c4..bbcdbadd8 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -446,24 +446,6 @@ def normalize_provider_facts(provider, metadata):
return facts
-def set_node_schedulability(facts):
- """ Set schedulable facts if not already present in facts dict
- Args:
- facts (dict): existing facts
- Returns:
- dict: the facts dict updated with the generated schedulable
- facts if they were not already present
-
- """
- if 'node' in facts:
- if 'schedulable' not in facts['node']:
- if 'master' in facts:
- facts['node']['schedulable'] = False
- else:
- facts['node']['schedulable'] = True
- return facts
-
-
# pylint: disable=too-many-branches
def set_selectors(facts):
""" Set selectors facts if not already present in facts dict
@@ -516,49 +498,6 @@ def set_selectors(facts):
return facts
-def set_dnsmasq_facts_if_unset(facts):
- """ Set dnsmasq facts if not already present in facts
- Args:
- facts (dict) existing facts
- Returns:
- facts (dict) updated facts with values set if not previously set
- """
-
- if 'common' in facts:
- if 'master' in facts and 'dns_port' not in facts['master']:
- facts['master']['dns_port'] = 8053
-
- return facts
-
-
-def set_project_cfg_facts_if_unset(facts):
- """ Set Project Configuration facts if not already present in facts dict
- dict:
- Args:
- facts (dict): existing facts
- Returns:
- dict: the facts dict updated with the generated Project Configuration
- facts if they were not already present
-
- """
-
- config = {
- 'default_node_selector': '',
- 'project_request_message': '',
- 'project_request_template': '',
- 'mcs_allocator_range': 's0:/2',
- 'mcs_labels_per_project': 5,
- 'uid_allocator_range': '1000000000-1999999999/10000'
- }
-
- if 'master' in facts:
- for key, value in config.items():
- if key not in facts['master']:
- facts['master'][key] = value
-
- return facts
-
-
def set_identity_providers_if_unset(facts):
""" Set identity_providers fact if not already present in facts dict
@@ -1563,7 +1502,8 @@ def set_builddefaults_facts(facts):
# Scaffold out the full expected datastructure
facts['master']['admission_plugin_config'] = {'BuildDefaults': {'configuration': {'env': {}}}}
facts['master']['admission_plugin_config'].update(builddefaults['config'])
- delete_empty_keys(facts['master']['admission_plugin_config']['BuildDefaults']['configuration']['env'])
+ if 'env' in facts['master']['admission_plugin_config']['BuildDefaults']['configuration']:
+ delete_empty_keys(facts['master']['admission_plugin_config']['BuildDefaults']['configuration']['env'])
return facts
@@ -1627,20 +1567,16 @@ def set_container_facts_if_unset(facts):
deployment_type = facts['common']['deployment_type']
if deployment_type == 'openshift-enterprise':
master_image = 'openshift3/ose'
- cli_image = master_image
node_image = 'openshift3/node'
ovs_image = 'openshift3/openvswitch'
- etcd_image = 'registry.access.redhat.com/rhel7/etcd'
pod_image = 'openshift3/ose-pod'
router_image = 'openshift3/ose-haproxy-router'
registry_image = 'openshift3/ose-docker-registry'
deployer_image = 'openshift3/ose-deployer'
else:
master_image = 'openshift/origin'
- cli_image = master_image
node_image = 'openshift/node'
ovs_image = 'openshift/openvswitch'
- etcd_image = 'registry.access.redhat.com/rhel7/etcd'
pod_image = 'openshift/origin-pod'
router_image = 'openshift/origin-haproxy-router'
registry_image = 'openshift/origin-docker-registry'
@@ -1657,8 +1593,6 @@ def set_container_facts_if_unset(facts):
if 'is_containerized' not in facts['common']:
facts['common']['is_containerized'] = facts['common']['is_atomic']
- if 'cli_image' not in facts['common']:
- facts['common']['cli_image'] = cli_image
if 'pod_image' not in facts['common']:
facts['common']['pod_image'] = pod_image
if 'router_image' not in facts['common']:
@@ -1667,8 +1601,6 @@ def set_container_facts_if_unset(facts):
facts['common']['registry_image'] = registry_image
if 'deployer_image' not in facts['common']:
facts['common']['deployer_image'] = deployer_image
- if 'etcd' in facts and 'etcd_image' not in facts['etcd']:
- facts['etcd']['etcd_image'] = etcd_image
if 'master' in facts and 'master_image' not in facts['master']:
facts['master']['master_image'] = master_image
facts['master']['master_system_image'] = master_image
@@ -1840,8 +1772,6 @@ class OpenShiftFacts(object):
facts = migrate_oauth_template_facts(facts)
facts['current_config'] = get_current_config(facts)
facts = set_url_facts_if_unset(facts)
- facts = set_project_cfg_facts_if_unset(facts)
- facts = set_node_schedulability(facts)
facts = set_selectors(facts)
facts = set_identity_providers_if_unset(facts)
facts = set_deployment_facts_if_unset(facts)
@@ -1851,7 +1781,6 @@ class OpenShiftFacts(object):
facts = build_controller_args(facts)
facts = build_api_server_args(facts)
facts = set_version_facts_if_unset(facts)
- facts = set_dnsmasq_facts_if_unset(facts)
facts = set_aggregate_facts(facts)
facts = set_etcd_facts_if_unset(facts)
facts = set_proxy_facts(facts)
@@ -2257,14 +2186,27 @@ class OpenShiftFacts(object):
oo_env_facts = dict()
current_level = oo_env_facts
keys = self.split_openshift_env_fact_keys(fact, openshift_env_structures)[1:]
+
if len(keys) > 0 and keys[0] != self.role:
continue
- for key in keys:
- if key == keys[-1]:
- current_level[key] = value
- elif key not in current_level:
- current_level[key] = dict()
- current_level = current_level[key]
+
+ # Build a dictionary from the split fact keys.
+ # After this loop oo_env_facts is the resultant dictionary.
+ # For example:
+ # fact = "openshift_metrics_install_metrics"
+ # value = 'true'
+ # keys = ['metrics', 'install', 'metrics']
+ # result = {'metrics': {'install': {'metrics': 'true'}}}
+ for i, _ in enumerate(keys):
+ # This is the last key. Set the value.
+ if i == (len(keys) - 1):
+ current_level[keys[i]] = value
+ # This is a key other than the last key. Set as
+ # dictionary and continue.
+ else:
+ current_level[keys[i]] = dict()
+ current_level = current_level[keys[i]]
+
facts_to_set = merge_facts(orig=facts_to_set,
new=oo_env_facts,
additive_facts_to_overwrite=[],