Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add etcd ip addresses to master NO_PROXY #5081

Merged
merged 2 commits into from
Aug 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions filter_plugins/oo_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ def oo_select_keys_from_list(data, keys):
"""

if not isinstance(data, list):
raise errors.AnsibleFilterError("|failed expects to filter on a list")
raise errors.AnsibleFilterError("|oo_select_keys_from_list failed expects to filter on a list")

if not isinstance(keys, list):
raise errors.AnsibleFilterError("|failed expects first param is a list")
raise errors.AnsibleFilterError("|oo_select_keys_from_list failed expects first param is a list")

# Gather up the values for the list of keys passed in
retval = [oo_select_keys(item, keys) for item in data]
Expand All @@ -213,10 +213,10 @@ def oo_select_keys(data, keys):
"""

if not isinstance(data, Mapping):
raise errors.AnsibleFilterError("|failed expects to filter on a dict or object")
raise errors.AnsibleFilterError("|oo_select_keys failed expects to filter on a dict or object")

if not isinstance(keys, list):
raise errors.AnsibleFilterError("|failed expects first param is a list")
raise errors.AnsibleFilterError("|oo_select_keys failed expects first param is a list")

# Gather up the values for the list of keys passed in
retval = [data[key] for key in keys if key in data]
Expand Down
3 changes: 3 additions & 0 deletions playbooks/common/openshift-master/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@
| union(groups['oo_etcd_to_config'] | default([])))
| oo_collect('openshift.common.hostname') | default([]) | join (',')
}}"
openshift_no_proxy_etcd_host_ips: "{{ hostvars | oo_select_keys(groups['oo_etcd_to_config'] | default([]))
| oo_collect('openshift.common.ip') | default([]) | join(',')
}}"
roles:
- role: openshift_master
openshift_ca_host: "{{ groups.oo_first_master.0 }}"
Expand Down
7 changes: 7 additions & 0 deletions roles/openshift_facts/library/openshift_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,13 @@ def set_proxy_facts(facts):
common['no_proxy'] = common['no_proxy'].split(",")
elif 'no_proxy' not in common:
common['no_proxy'] = []

# See https://bugzilla.redhat.com/show_bug.cgi?id=1466783
# masters behind a proxy need to connect to etcd via IP
if 'no_proxy_etcd_host_ips' in common:
if isinstance(common['no_proxy_etcd_host_ips'], string_types):
common['no_proxy'].extend(common['no_proxy_etcd_host_ips'].split(','))

if 'generate_no_proxy_hosts' in common and safe_get_bool(common['generate_no_proxy_hosts']):
if 'no_proxy_internal_hostnames' in common:
common['no_proxy'].extend(common['no_proxy_internal_hostnames'].split(','))
Expand Down
6 changes: 6 additions & 0 deletions roles/openshift_master/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@
- set_fact:
openshift_push_via_dns: "{{ (openshift_use_dnsmasq | default(true) and openshift.common.version_gte_3_6) or (already_set.stdout | match('OPENSHIFT_DEFAULT_REGISTRY=docker-registry.default.svc:5000')) }}"

- name: Set fact of all etcd host IPs
openshift_facts:
role: common
local_facts:
no_proxy_etcd_host_ips: "{{ openshift_no_proxy_etcd_host_ips }}"

- name: Install the systemd units
include: systemd_units.yml

Expand Down