Fix kube-proxy dual-stack-iptables-binary-presence check

Kube-proxy was checking that iptables supports both IPv4 and IPv6 and
falling back to single-stack if not. But it always fell back to the
primary IP family, regardless of which family iptables supported...
Fix it so that if the primary IP family isn't supported then it bails
out entirely.
This commit is contained in:
Dan Winship 2022-12-22 14:57:14 -05:00
parent 4e70155dbd
commit fb84c4f0f0

View File

@ -165,12 +165,12 @@ func newProxyServer(
ipt[1] = iptInterface
}
for _, perFamilyIpt := range ipt {
if !perFamilyIpt.Present() {
klog.InfoS("kube-proxy running in single-stack mode, this ipFamily is not supported", "ipFamily", perFamilyIpt.Protocol())
if !ipt[0].Present() {
return nil, fmt.Errorf("iptables is not supported for primary IP family %q", primaryProtocol)
} else if !ipt[1].Present() {
klog.InfoS("kube-proxy running in single-stack mode: secondary ipFamily is not supported", "ipFamily", ipt[1].Protocol())
dualStack = false
}
}
if proxyMode == proxyconfigapi.ProxyModeIPTables {
klog.InfoS("Using iptables Proxier")