Skip to content

Commit 2055a49

Browse files
committed
Rework cluster/ kube-proxy setup for --proxy-mode
1 parent fdf2253 commit 2055a49

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

cluster/gce/gci/configure-helper.sh

100644100755
Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,24 +1753,29 @@ function prepare-kube-proxy-manifest-variables {
17531753
if [[ -n "${FEATURE_GATES:-}" ]]; then
17541754
params+=" --feature-gates=${FEATURE_GATES}"
17551755
fi
1756-
if [[ "${KUBE_PROXY_MODE:-}" == "ipvs" ]];then
1757-
# use 'nf_conntrack' instead of 'nf_conntrack_ipv4' for linux kernel >= 4.19
1758-
# https://github.com/kubernetes/kubernetes/pull/70398
1759-
local -r kernel_version=$(uname -r | cut -d\. -f1,2)
1760-
local conntrack_module="nf_conntrack"
1761-
if [[ $(printf '%s\n4.18\n' "${kernel_version}" | sort -V | tail -1) == "4.18" ]]; then
1762-
conntrack_module="nf_conntrack_ipv4"
1763-
fi
17641756

1765-
if sudo modprobe -a ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh ${conntrack_module}; then
1766-
params+=" --proxy-mode=ipvs"
1767-
else
1768-
# If IPVS modules are not present, make sure the node does not come up as
1769-
# healthy.
1770-
exit 1
1771-
fi
1772-
fi
1773-
params+=" --iptables-sync-period=1m --iptables-min-sync-period=10s --ipvs-sync-period=1m --ipvs-min-sync-period=10s"
1757+
case "${KUBE_PROXY_MODE:-iptables}" in
1758+
iptables)
1759+
params+=" --proxy-mode=iptables --iptables-sync-period=1m --iptables-min-sync-period=10s"
1760+
;;
1761+
ipvs)
1762+
# use 'nf_conntrack' instead of 'nf_conntrack_ipv4' for linux kernel >= 4.19
1763+
# https://github.com/kubernetes/kubernetes/pull/70398
1764+
local -r kernel_version=$(uname -r | cut -d\. -f1,2)
1765+
local conntrack_module="nf_conntrack"
1766+
if [[ $(printf '%s\n4.18\n' "${kernel_version}" | sort -V | tail -1) == "4.18" ]]; then
1767+
conntrack_module="nf_conntrack_ipv4"
1768+
fi
1769+
1770+
if ! sudo modprobe -a ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh ${conntrack_module}; then
1771+
# If IPVS modules are not present, make sure the node does not come up as
1772+
# healthy.
1773+
exit 1
1774+
fi
1775+
params+=" --proxy-mode=ipvs --ipvs-sync-period=1m --ipvs-min-sync-period=10s"
1776+
;;
1777+
esac
1778+
17741779
if [[ -n "${KUBEPROXY_TEST_ARGS:-}" ]]; then
17751780
params+=" ${KUBEPROXY_TEST_ARGS}"
17761781
fi

0 commit comments

Comments
 (0)