Skip to content

Commit a6a5fc5

Browse files
authored
Merge pull request kubernetes#87760 from dims/update-network-y-stuff-for-supporting-ubuntu/bionic
update network-y stuff for supporting ubuntu/bionic
2 parents 133f772 + ee3f897 commit a6a5fc5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

cluster/gce/util.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,13 +765,23 @@ function construct-linux-kubelet-flags {
765765
flags+=" --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig"
766766
flags+=" --register-schedulable=false"
767767
fi
768+
if [[ "${MASTER_OS_DISTRIBUTION}" == "ubuntu" ]]; then
769+
# Configure the file path for host dns configuration
770+
# as ubuntu uses systemd-resolved
771+
flags+=" --resolv-conf=/run/systemd/resolve/resolv.conf"
772+
fi
768773
else # For nodes
769774
flags+=" ${NODE_KUBELET_TEST_ARGS:-}"
770775
flags+=" --bootstrap-kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig"
771776
flags+=" --kubeconfig=/var/lib/kubelet/kubeconfig"
772777
if [[ "${node_type}" == "heapster" ]]; then
773778
flags+=" ${HEAPSTER_KUBELET_TEST_ARGS:-}"
774779
fi
780+
if [[ "${NODE_OS_DISTRIBUTION}" == "ubuntu" ]]; then
781+
# Configure the file path for host dns configuration
782+
# as ubuntu uses systemd-resolved
783+
flags+=" --resolv-conf=/run/systemd/resolve/resolv.conf"
784+
fi
775785
fi
776786
# Network plugin
777787
if [[ -n "${NETWORK_PROVIDER:-}" || -n "${NETWORK_POLICY_PROVIDER:-}" ]]; then
@@ -2925,7 +2935,7 @@ function attach-internal-master-ip() {
29252935
echo "Setting ${name}'s aliases to '${aliases}' (added ${ip})"
29262936
# Attach ${ip} to ${name}
29272937
gcloud compute instances network-interfaces update "${name}" --project "${PROJECT}" --zone "${zone}" --aliases="${aliases}"
2928-
run-gcloud-command "${name}" "${zone}" "sudo ip route add to local ${ip}/32 dev eth0"
2938+
run-gcloud-command "${name}" "${zone}" 'sudo ip route add to local '${ip}'/32 dev $(ip route | grep default | awk '\''{print $5}'\'')' || true
29292939
return $?
29302940
}
29312941

@@ -2943,7 +2953,7 @@ function detach-internal-master-ip() {
29432953
echo "Setting ${name}'s aliases to '${aliases}' (removed ${ip})"
29442954
# Detach ${MASTER_NAME}-internal-ip from ${name}
29452955
gcloud compute instances network-interfaces update "${name}" --project "${PROJECT}" --zone "${zone}" --aliases="${aliases}"
2946-
run-gcloud-command "${name}" "${zone}" "sudo ip route del to local ${ip}/32 dev eth0"
2956+
run-gcloud-command "${name}" "${zone}" 'sudo ip route del to local '${ip}'/32 dev $(ip route | grep default | awk '\''{print $5}'\'')' || true
29472957
return $?
29482958
}
29492959

0 commit comments

Comments
 (0)