From 2bbdf2984c5b4d59ecdc773ed8e40aa340092922 Mon Sep 17 00:00:00 2001 From: Scott Dodson Date: Tue, 21 Nov 2017 14:12:41 -0500 Subject: Add kube service ipaddress to no_proxy list Computed as the first ip address in the portal_net --- playbooks/init/base_packages.yml | 1 + roles/openshift_facts/library/openshift_facts.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/playbooks/init/base_packages.yml b/playbooks/init/base_packages.yml index e1052fb6c..0a730a88a 100644 --- a/playbooks/init/base_packages.yml +++ b/playbooks/init/base_packages.yml @@ -16,6 +16,7 @@ - iproute - "{{ 'python3-dbus' if ansible_distribution == 'Fedora' else 'dbus-python' }}" - "{{ 'python3-PyYAML' if ansible_distribution == 'Fedora' else 'PyYAML' }}" + - "{{ 'python-ipaddress' if ansible_distribution != 'Fedora' else omit }}" - yum-utils register: result until: result is succeeded diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 26f0525e9..16b6ea53c 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -15,6 +15,7 @@ import os import yaml import struct import socket +import ipaddress from distutils.util import strtobool from distutils.version import LooseVersion from ansible.module_utils.six import string_types @@ -1146,6 +1147,8 @@ def set_proxy_facts(facts): if 'no_proxy_internal_hostnames' in common: common['no_proxy'].extend(common['no_proxy_internal_hostnames'].split(',')) # We always add local dns domain and ourselves no matter what + kube_svc_ip = ipaddress.ip_network(unicode(common['portal_net']))[1] + common['no_proxy'].append(kube_svc_ip) common['no_proxy'].append('.' + common['dns_domain']) common['no_proxy'].append('.svc') common['no_proxy'].append(common['hostname']) -- cgit v1.2.3 From 59615091a29807550d5dea3a404f7d0eb25387cf Mon Sep 17 00:00:00 2001 From: Fabian von Feilitzsch Date: Wed, 24 Jan 2018 16:00:24 -0500 Subject: Make IP object a string --- roles/openshift_facts/library/openshift_facts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 16b6ea53c..58965f0cb 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -18,6 +18,7 @@ import socket import ipaddress from distutils.util import strtobool from distutils.version import LooseVersion +from ansible.module_utils.six import u from ansible.module_utils.six import string_types from ansible.module_utils.six.moves import configparser @@ -1147,7 +1148,7 @@ def set_proxy_facts(facts): if 'no_proxy_internal_hostnames' in common: common['no_proxy'].extend(common['no_proxy_internal_hostnames'].split(',')) # We always add local dns domain and ourselves no matter what - kube_svc_ip = ipaddress.ip_network(unicode(common['portal_net']))[1] + kube_svc_ip = str(ipaddress.ip_network(u(common['portal_net']))[1]) common['no_proxy'].append(kube_svc_ip) common['no_proxy'].append('.' + common['dns_domain']) common['no_proxy'].append('.svc') -- cgit v1.2.3