summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
authorWesley Hearn <wesley.s.hearn@gmail.com>2015-10-21 15:23:30 -0400
committerWesley Hearn <wesley.s.hearn@gmail.com>2015-10-21 15:23:30 -0400
commit9f3d3e9d0e697ce85620ac0a7a7c5eeba892f1d6 (patch)
tree315c8752e2527fb71dc389b254393977d44a7074 /roles/openshift_facts
parentedfd8dc450854d6f2efa6c3d67e856b66b3743fd (diff)
parent8691cd2947146a24237fadc443eb02acf805a606 (diff)
downloadopenshift-9f3d3e9d0e697ce85620ac0a7a7c5eeba892f1d6.tar.gz
openshift-9f3d3e9d0e697ce85620ac0a7a7c5eeba892f1d6.tar.bz2
openshift-9f3d3e9d0e697ce85620ac0a7a7c5eeba892f1d6.tar.xz
openshift-9f3d3e9d0e697ce85620ac0a7a7c5eeba892f1d6.zip
Merge pull request #571 from dak1n1/router
Support HA or single router. Deploy after service accounts are created
Diffstat (limited to 'roles/openshift_facts')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index 69bb49c9b..6a32b24aa 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -1,6 +1,9 @@
-#!/usr/bin/python
+#!/usr/bin/python # pylint: disable=too-many-lines
# -*- coding: utf-8 -*-
# vim: expandtab:tabstop=4:shiftwidth=4
+# Reason: Disable pylint too-many-lines because we don't want to split up this file.
+# Status: Permanently disabled to keep this module as self-contained as possible.
+
"""Ansible module for retrieving and setting openshift related facts"""
DOCUMENTATION = '''
@@ -318,6 +321,29 @@ def set_node_schedulability(facts):
facts['node']['schedulable'] = True
return facts
+def set_master_selectors(facts):
+ """ Set selectors facts if not already present in facts dict
+ Args:
+ facts (dict): existing facts
+ Returns:
+ dict: the facts dict updated with the generated selectors
+ facts if they were not already present
+
+ """
+ if 'master' in facts:
+ if 'infra_nodes' in facts['master']:
+ deployment_type = facts['common']['deployment_type']
+ if deployment_type == 'online':
+ selector = "type=infra"
+ else:
+ selector = "region=infra"
+
+ if 'router_selector' not in facts['master']:
+ facts['master']['router_selector'] = selector
+ if 'registry_selector' not in facts['master']:
+ facts['master']['registry_selector'] = selector
+ return facts
+
def set_metrics_facts_if_unset(facts):
""" Set cluster metrics facts if not already present in facts dict
dict: the facts dict updated with the generated cluster metrics facts if
@@ -782,6 +808,7 @@ class OpenShiftFacts(object):
facts = set_url_facts_if_unset(facts)
facts = set_fluentd_facts_if_unset(facts)
facts = set_node_schedulability(facts)
+ facts = set_master_selectors(facts)
facts = set_metrics_facts_if_unset(facts)
facts = set_identity_providers_if_unset(facts)
facts = set_sdn_facts_if_unset(facts)