kubeadm: fix the bug that windows node failed to join IPv6 cluster due to preflight failures

Signed-off-by: SataQiu <shidaqiu2018@gmail.com>
This commit is contained in:
SataQiu 2022-03-17 22:07:08 +08:00
parent a504daa048
commit 6c57e2fced

View File

@ -933,7 +933,7 @@ func RunInitNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.InitConfigura
// Check if Bridge-netfilter and IPv6 relevant flags are set // Check if Bridge-netfilter and IPv6 relevant flags are set
if ip := netutils.ParseIPSloppy(cfg.LocalAPIEndpoint.AdvertiseAddress); ip != nil { if ip := netutils.ParseIPSloppy(cfg.LocalAPIEndpoint.AdvertiseAddress); ip != nil {
if netutils.IsIPv6(ip) { if netutils.IsIPv6(ip) && runtime.GOOS == "linux" {
checks = append(checks, checks = append(checks,
FileContentCheck{Path: bridgenf6, Content: []byte{'1'}}, FileContentCheck{Path: bridgenf6, Content: []byte{'1'}},
FileContentCheck{Path: ipv6DefaultForwarding, Content: []byte{'1'}}, FileContentCheck{Path: ipv6DefaultForwarding, Content: []byte{'1'}},
@ -1003,7 +1003,7 @@ func RunJoinNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.JoinConfigura
} }
} }
} }
if addIPv6Checks { if addIPv6Checks && runtime.GOOS == "linux" {
checks = append(checks, checks = append(checks,
FileContentCheck{Path: bridgenf6, Content: []byte{'1'}}, FileContentCheck{Path: bridgenf6, Content: []byte{'1'}},
FileContentCheck{Path: ipv6DefaultForwarding, Content: []byte{'1'}}, FileContentCheck{Path: ipv6DefaultForwarding, Content: []byte{'1'}},