diff options
author | Scott Dodson <sdodson@redhat.com> | 2017-07-01 22:32:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-01 22:32:28 -0400 |
commit | a9d8e96663ba0520e6ec89d968790c3d23cb18af (patch) | |
tree | 533372eba2ca10b7ca0be2edad3c84c3e4e7a921 /roles/openshift_node_dnsmasq/files/networkmanager | |
parent | 7c045ba7cfb6c6d15ea2d94830e048c335bda594 (diff) | |
parent | 841cefdae64bf6e01ff85b3fcec3a12e6aeabf7e (diff) | |
download | openshift-a9d8e96663ba0520e6ec89d968790c3d23cb18af.tar.gz openshift-a9d8e96663ba0520e6ec89d968790c3d23cb18af.tar.bz2 openshift-a9d8e96663ba0520e6ec89d968790c3d23cb18af.tar.xz openshift-a9d8e96663ba0520e6ec89d968790c3d23cb18af.zip |
Merge pull request #4530 from sdodson/node-dns
Utilize node dns services
Diffstat (limited to 'roles/openshift_node_dnsmasq/files/networkmanager')
-rwxr-xr-x | roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh | 14 |
1 files changed, 10 insertions, 4 deletions
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 |