diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2017-07-03 11:06:18 -0400 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2017-07-05 10:30:53 -0400 |
commit | 09e74fa8f619038ea06723392ce0d620ffbc6d3a (patch) | |
tree | e3c17249a47ed0d70c99c22ef8f8426655a83245 /roles/openshift_node_dnsmasq | |
parent | 7b5c476ecd2e6d3cf26bea294e5b7c141d061384 (diff) | |
parent | 0d0f54af3a02cd0e228210dfae95806d4e644c3b (diff) | |
download | openshift-09e74fa8f619038ea06723392ce0d620ffbc6d3a.tar.gz openshift-09e74fa8f619038ea06723392ce0d620ffbc6d3a.tar.bz2 openshift-09e74fa8f619038ea06723392ce0d620ffbc6d3a.tar.xz openshift-09e74fa8f619038ea06723392ce0d620ffbc6d3a.zip |
Merge branch 'master' into encryption
Diffstat (limited to 'roles/openshift_node_dnsmasq')
5 files changed, 27 insertions, 5 deletions
diff --git a/roles/openshift_node_dnsmasq/defaults/main.yml b/roles/openshift_node_dnsmasq/defaults/main.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/roles/openshift_node_dnsmasq/defaults/main.yml @@ -0,0 +1 @@ +--- diff --git a/roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh b/roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh index c68073a10..924226d09 100755 --- a/roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh +++ b/roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh @@ -45,13 +45,15 @@ if [[ $2 =~ ^(up|dhcp4-change|dhcp6-change)$ ]]; then def_route_int=$(/sbin/ip route get to ${def_route} | awk '{print $3}') def_route_ip=$(/sbin/ip route get to ${def_route} | awk '{print $5}') if [[ ${DEVICE_IFACE} == ${def_route_int} && \ - -n "${IP4_NAMESERVERS}" ]]; then + -n "${IP4_NAMESERVERS}" && \ + "${IP4_NAMESERVERS}" != "${def_route_ip}" ]]; then if [ ! -f /etc/dnsmasq.d/origin-dns.conf ]; then cat << EOF > /etc/dnsmasq.d/origin-dns.conf no-resolv domain-needed server=/cluster.local/172.30.0.1 server=/30.172.in-addr.arpa/172.30.0.1 +enable-dbus EOF # New config file, must restart NEEDS_RESTART=1 @@ -89,13 +91,17 @@ EOF systemctl restart dnsmasq fi - # Only if dnsmasq is running properly make it our only nameserver + # Only if dnsmasq is running properly make it our only nameserver, copy + # original resolv.conf to /etc/origin/node/resolv.conf for node service to + # bypass dnsmasq if `systemctl -q is-active dnsmasq.service`; then - sed -e '/^nameserver.*$/d' /etc/resolv.conf > ${NEW_RESOLV_CONF} - echo "nameserver "${def_route_ip}"" >> ${NEW_RESOLV_CONF} if ! grep -q '99-origin-dns.sh' ${NEW_RESOLV_CONF}; then echo "# nameserver updated by /etc/NetworkManager/dispatcher.d/99-origin-dns.sh" >> ${NEW_RESOLV_CONF} + cp /etc/resolv.conf /etc/origin/node/resolv.conf fi + sed -e '/^nameserver.*$/d' /etc/resolv.conf > ${NEW_RESOLV_CONF} + echo "nameserver "${def_route_ip}"" >> ${NEW_RESOLV_CONF} + if ! grep -q 'search.*cluster.local' ${NEW_RESOLV_CONF}; then sed -i '/^search/ s/$/ cluster.local/' ${NEW_RESOLV_CONF} fi diff --git a/roles/openshift_node_dnsmasq/tasks/main.yml b/roles/openshift_node_dnsmasq/tasks/main.yml index 3311f7006..d0221a94b 100644 --- a/roles/openshift_node_dnsmasq/tasks/main.yml +++ b/roles/openshift_node_dnsmasq/tasks/main.yml @@ -14,6 +14,17 @@ package: name=dnsmasq state=installed when: not openshift.common.is_atomic | bool +# this file is copied to /etc/dnsmasq.d/ when the node starts and is removed +# when the node stops. A dbus-message is sent to dnsmasq to add the same entries +# so that dnsmasq doesn't need to be restarted. Once we can use dnsmasq 2.77 or +# newer we can use --server-file option to update the servers dynamically and +# reload them by sending dnsmasq a SIGHUP. We write the file in case someone else +# triggers a restart of dnsmasq but not a node restart. +- name: Install node-dnsmasq.conf + template: + src: node-dnsmasq.conf.j2 + dest: /etc/origin/node/node-dnsmasq.conf + - name: Install dnsmasq configuration template: src: origin-dns.conf.j2 diff --git a/roles/openshift_node_dnsmasq/templates/node-dnsmasq.conf.j2 b/roles/openshift_node_dnsmasq/templates/node-dnsmasq.conf.j2 new file mode 100644 index 000000000..3caa3bd4a --- /dev/null +++ b/roles/openshift_node_dnsmasq/templates/node-dnsmasq.conf.j2 @@ -0,0 +1,2 @@ +server=/in-addr.arpa/127.0.0.1 +server=/{{ openshift.common.dns_domain }}/127.0.0.1 diff --git a/roles/openshift_node_dnsmasq/templates/origin-dns.conf.j2 b/roles/openshift_node_dnsmasq/templates/origin-dns.conf.j2 index 8bae9aaac..779b4d2f5 100644 --- a/roles/openshift_node_dnsmasq/templates/origin-dns.conf.j2 +++ b/roles/openshift_node_dnsmasq/templates/origin-dns.conf.j2 @@ -1,5 +1,7 @@ no-resolv domain-needed -server=/{{ openshift.common.dns_domain }}/{{ openshift.common.kube_svc_ip }} no-negcache max-cache-ttl=1 +enable-dbus +bind-interfaces +listen-address={{ ansible_default_ipv4.address }} |