diff options
author | Stefanie Forrester <sedgar@redhat.com> | 2015-09-11 13:13:17 -0700 |
---|---|---|
committer | Stefanie Forrester <sedgar@redhat.com> | 2015-10-21 12:55:42 -0400 |
commit | 8691cd2947146a24237fadc443eb02acf805a606 (patch) | |
tree | 0aee79ec29eab0d36ea9b2f13f079bbb259dcc77 /roles/openshift_facts/library | |
parent | 0b89d53ad9c0c83c42db3ee1642c005474c3cc58 (diff) | |
download | openshift-8691cd2947146a24237fadc443eb02acf805a606.tar.gz openshift-8691cd2947146a24237fadc443eb02acf805a606.tar.bz2 openshift-8691cd2947146a24237fadc443eb02acf805a606.tar.xz openshift-8691cd2947146a24237fadc443eb02acf805a606.zip |
Support HA or single router, and start work on registry
Diffstat (limited to 'roles/openshift_facts/library')
-rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 29 |
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) |