From 6242bc8fc0af22bfb2abe59577cd6aaa0a3ee136 Mon Sep 17 00:00:00 2001 From: Roberto Bonafiglia Date: Thu, 7 Nov 2024 14:27:21 +0100 Subject: [PATCH] Added check to not check br_filter in case of windows Signed-off-by: Roberto Bonafiglia --- main.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index 2bac2b196..e8ab0626e 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,7 @@ import ( "net/http" "os" "os/signal" + "runtime" "strconv" "strings" "sync" @@ -261,17 +262,19 @@ func main() { os.Exit(1) } - // From Kubernetes 1.30 kubeadm doesn't check if the br_netfilter module is loaded and in case it's missing Flannel wrongly starts - if config.EnableIPv4 { - if _, err = os.Stat("/proc/sys/net/bridge/bridge-nf-call-iptables"); os.IsNotExist(err) { - log.Error("Failed to check br_netfilter: ", err) - os.Exit(1) + if runtime.GOOS != "windows" { + // From Kubernetes 1.30 kubeadm doesn't check if the br_netfilter module is loaded and in case it's missing Flannel wrongly starts + if config.EnableIPv4 { + if _, err = os.Stat("/proc/sys/net/bridge/bridge-nf-call-iptables"); os.IsNotExist(err) { + log.Error("Failed to check br_netfilter: ", err) + os.Exit(1) + } } - } - if config.EnableIPv6 { - if _, err = os.Stat("/proc/sys/net/bridge/bridge-nf-call-ip6tables"); os.IsNotExist(err) { - log.Error("Failed to check br_netfilter: ", err) - os.Exit(1) + if config.EnableIPv6 { + if _, err = os.Stat("/proc/sys/net/bridge/bridge-nf-call-ip6tables"); os.IsNotExist(err) { + log.Error("Failed to check br_netfilter: ", err) + os.Exit(1) + } } }