diff --git a/tools/multi_nodes_gate/airship_gate/lib/bootaction-runner.sh b/tools/multi_nodes_gate/airship_gate/lib/bootaction-runner.sh index 747c740b..80e594bb 100755 --- a/tools/multi_nodes_gate/airship_gate/lib/bootaction-runner.sh +++ b/tools/multi_nodes_gate/airship_gate/lib/bootaction-runner.sh @@ -80,6 +80,22 @@ install_file(){ fi } +disable_dns_stub_listener() { + resolved_conf="/etc/systemd/resolved.conf" + if [[ -f $resolved_conf ]]; then + cp "$resolved_conf" "$resolved_conf.$(date '+%Y_%m_%d__%H_%M_%S')" + if grep -q "^DNSStubListener=" $resolved_conf; then + sed s/DNSStubListener=.*/DNSStubListener=no/g $resolved_conf + echo "Updated DNSStubListener entry." + else + echo "DNSStubListener=no" | sudo tee -a $resolved_conf + echo "Added DNSStubListener." + fi + systemctl restart systemd-resolved.service + echo "Restarted systemd_resolved.service" + fi +} + ############################################################################### # Script inputs and validations @@ -111,6 +127,12 @@ echo "Using rendered manifests file '$rendered_file'" : "${DISABLE_SECCOMP_PROFILE:=}" : "${DISABLE_APPARMOR_PROFILES:=}" +############################################################################### +# pre-genesis: disable systemd-resolved stub listener +############################################################################### +echo "Disabling dns sub listener." +disable_dns_stub_listener +sleep 20 ############################################################################### # bootaction: seccomp-profiles diff --git a/tools/multi_nodes_gate/airship_gate/lib/resolved.sh b/tools/multi_nodes_gate/airship_gate/lib/resolved.sh new file mode 100755 index 00000000..79c2f986 --- /dev/null +++ b/tools/multi_nodes_gate/airship_gate/lib/resolved.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +disable_dns_stub_listener() { + resolved_conf="/etc/systemd/resolved.conf" + if [[ -f $resolved_conf ]]; then + cp "$resolved_conf" "$resolved_conf.$(date '+%Y_%m_%d__%H_%M_%S')" + if grep -q "^DNSStubListener=" $resolved_conf; then + sed s/DNSStubListener=.*/DNSStubListener=no/g $resolved_conf + echo "Updated DNSStubListener entry." + else + echo "DNSStubListener=no" | sudo tee -a $resolved_conf + echo "Added DNSStubListener." + fi + systemctl restart systemd-resolved.service + echo "Restarted systemd_resolved.service" + fi +} + +echo "Disabling dns stub listener to avoid port collision with coreDNS." +disable_dns_stub_listener +sleep 20 + diff --git a/tools/multi_nodes_gate/airship_gate/stages/ingress-dns.sh b/tools/multi_nodes_gate/airship_gate/stages/ingress-dns.sh index 770b81a0..a7ac9cfc 100755 --- a/tools/multi_nodes_gate/airship_gate/stages/ingress-dns.sh +++ b/tools/multi_nodes_gate/airship_gate/stages/ingress-dns.sh @@ -21,3 +21,8 @@ DNS_SERVER="$1" ingress_dns_config ingress_dns_start "${DNS_SERVER}" + +rsync_cmd "${REPO_ROOT}/tools/multi_nodes_gate/airship_gate/lib/resolved.sh" "${DNS_SERVER}:/root/airship/" +set -o pipefail +ssh_cmd "${DNS_SERVER}" /root/airship/resolved.sh 2>&1 | tee -a "${LOG_FILE}" +set +o pipefail