diff options
author | Samuel Munilla <smunilla@redhat.com> | 2016-10-24 13:26:56 -0400 |
---|---|---|
committer | Samuel Munilla <smunilla@redhat.com> | 2016-11-03 16:19:11 -0400 |
commit | b50b4ea0b03feb9431abd7294fe4fb6b549ddfc0 (patch) | |
tree | 3e191cc9e3d09c368f75fe01bf0a3ac1f51ce949 /roles | |
parent | 17c3d6236adea676c3d9248c3d2f7afb0d582750 (diff) | |
download | openshift-b50b4ea0b03feb9431abd7294fe4fb6b549ddfc0.tar.gz openshift-b50b4ea0b03feb9431abd7294fe4fb6b549ddfc0.tar.bz2 openshift-b50b4ea0b03feb9431abd7294fe4fb6b549ddfc0.tar.xz openshift-b50b4ea0b03feb9431abd7294fe4fb6b549ddfc0.zip |
Update defaults for clusterNetworkCIDR & hostSubnetLength
Per https://github.com/openshift/openshift-docs/issues/1700:
The default values for pod networking have changed:
- clusterNetworkCIDR now defaults to 10.128.0.0/14 (10.128.0.0 - 10.131.255.255)
rather than 10.1.0.0/16.
- hostSubnetLength now defaults to 9 rather than 8
(meaning each node will be assigned a /23 subnet rather than a /24)
Fixes Bug 1320952
Diffstat (limited to 'roles')
-rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 6c045e7ab..21104039a 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -901,10 +901,24 @@ def set_sdn_facts_if_unset(facts, system_facts): facts['common']['sdn_network_plugin_name'] = plugin if 'master' in facts: - if 'sdn_cluster_network_cidr' not in facts['master']: - facts['master']['sdn_cluster_network_cidr'] = '10.1.0.0/16' - if 'sdn_host_subnet_length' not in facts['master']: - facts['master']['sdn_host_subnet_length'] = '8' + # set defaults for sdn_cluster_network_cidr and sdn_host_subnet_length + # these might be overridden if they exist in the master config file + facts['master']['sdn_cluster_network_cidr'] = '10.128.0.0/14' + facts['master']['sdn_host_subnet_length'] = '9' + + master_cfg_path = os.path.join(facts['common']['config_base'], + 'master/master-config.yaml') + if os.path.isfile(master_cfg_path): + with open(master_cfg_path, 'r') as master_cfg_f: + config = yaml.safe_load(master_cfg_f.read()) + + if 'networkConfig' in config: + if 'clusterNetworkCIDR' in config['networkConfig']: + facts['master']['sdn_cluster_network_cidr'] = \ + config['networkConfig']['clusterNetworkCIDR'] + if 'hostSubnetLength' in config['networkConfig']: + facts['master']['sdn_host_subnet_length'] = \ + config['networkConfig']['hostSubnetLength'] if 'node' in facts and 'sdn_mtu' not in facts['node']: node_ip = facts['common']['ip'] @@ -1771,8 +1785,8 @@ class OpenShiftFacts(object): facts = set_node_schedulability(facts) facts = set_selectors(facts) facts = set_identity_providers_if_unset(facts) - facts = set_sdn_facts_if_unset(facts, self.system_facts) facts = set_deployment_facts_if_unset(facts) + facts = set_sdn_facts_if_unset(facts, self.system_facts) facts = set_container_facts_if_unset(facts) facts = build_kubelet_args(facts) facts = build_controller_args(facts) |