diff options
author | Scott Dodson <sdodson@redhat.com> | 2016-03-07 14:24:57 -0500 |
---|---|---|
committer | Scott Dodson <sdodson@redhat.com> | 2016-04-19 16:44:18 -0400 |
commit | bc11db0c73554be36b4196993d39a35cecbbd25b (patch) | |
tree | 36eaafd964e7a96f7f0d4272d3cc77d29272a52c /roles/openshift_facts | |
parent | 7c11c212a270ea4da9094ed3156db91090b8c851 (diff) | |
download | openshift-bc11db0c73554be36b4196993d39a35cecbbd25b.tar.gz openshift-bc11db0c73554be36b4196993d39a35cecbbd25b.tar.bz2 openshift-bc11db0c73554be36b4196993d39a35cecbbd25b.tar.xz openshift-bc11db0c73554be36b4196993d39a35cecbbd25b.zip |
Add openshift_node_dnsmasq
Diffstat (limited to 'roles/openshift_facts')
-rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 06f8801a8..3bdad1175 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -58,10 +58,13 @@ def migrate_docker_facts(facts): facts['docker']['hosted_registry_network'] = facts['node'].pop('portal_net') return facts +# TODO: We should add a generic migration function that takes source and destination +# paths and does the right thing rather than one function for common, one for node, etc. def migrate_common_facts(facts): """ Migrate facts from various roles into common """ params = { - 'node': ( 'portal_net' ) + 'node': ('portal_net'), + 'master': ('portal_net') } if 'common' not in facts: facts['common'] = {} @@ -72,11 +75,26 @@ def migrate_common_facts(facts): facts['common'][param] = facts[role].pop(param) return facts +def migrate_node_facts(facts): + """ Migrate facts from various roles into node """ + params = { + 'common': ('dns_ip'), + } + if 'node' not in facts: + facts['node'] = {} + for role in params.keys(): + if role in facts: + for param in params[role]: + if param in facts[role]: + facts['node'][param] = facts[role].pop(param) + return facts + def migrate_local_facts(facts): """ Apply migrations of local facts """ migrated_facts = copy.deepcopy(facts) migrated_facts = migrate_docker_facts(migrated_facts) migrated_facts = migrate_common_facts(migrated_facts) + migrated_facts = migrate_node_facts(migrated_facts) return migrated_facts def migrate_hosted_facts(facts): @@ -464,6 +482,27 @@ def set_metrics_facts_if_unset(facts): facts['common']['use_cluster_metrics'] = use_cluster_metrics 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 'use_dnsmasq' not in facts['common'] and facts['common']['version_gte_3_2_or_1_2']: + facts['common']['use_dnsmasq'] = True + else: + facts['common']['use_dnsmasq'] = False + if 'master' in facts and 'dns_port' not in facts['master']: + if facts['common']['use_dnsmasq']: + facts['master']['dns_port'] = 8053 + else: + facts['master']['dns_port'] = 53 + + return facts + def set_project_cfg_facts_if_unset(facts): """ Set Project Configuration facts if not already present in facts dict dict: @@ -1507,6 +1546,7 @@ 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_manageiq_facts_if_unset(facts) facts = set_aggregate_facts(facts) facts = set_etcd_facts_if_unset(facts) @@ -1564,7 +1604,7 @@ class OpenShiftFacts(object): etcd_hosts='', etcd_port='4001', portal_net='172.30.0.0/16', embedded_etcd=True, embedded_kube=True, - embedded_dns=True, dns_port='53', + embedded_dns=True, bind_addr='0.0.0.0', session_max_seconds=3600, session_name='ssn', |