|
| 1 | +From b1b4adec167ad515754061b27428449d3c9a39de Mon Sep 17 00:00:00 2001 |
| 2 | +From: Debasish Biswas <debasishbsws.dev@gmail.com> |
| 3 | +Date: Thu, 9 Oct 2025 08:41:15 +0000 |
| 4 | +Subject: [PATCH] feat: add --disable-br-netfilter-check flag for container |
| 5 | + environments |
| 6 | + |
| 7 | +This change adds a new command-line flag --disable-br-netfilter-check to address |
| 8 | +compatibility issues in containerized environments, particularly for CI/CD pipelines test |
| 9 | +using Docker runners on aarch64 architecture. |
| 10 | + |
| 11 | +Signed-off-by: Debasish Biswas <debasishbsws.dev@gmail.com> |
| 12 | +--- |
| 13 | + main.go | 4 +++- |
| 14 | + 1 file changed, 3 insertions(+), 1 deletion(-) |
| 15 | + |
| 16 | +diff --git a/main.go b/main.go |
| 17 | +index 6f40c4d2..d29ac68b 100644 |
| 18 | +--- a/main.go |
| 19 | ++++ b/main.go |
| 20 | +@@ -98,6 +98,7 @@ type CmdLineOpts struct { |
| 21 | + blackholeRoute bool |
| 22 | + netConfPath string |
| 23 | + setNodeNetworkUnavailable bool |
| 24 | ++ disableBrNetfilterCheck bool |
| 25 | + } |
| 26 | + |
| 27 | + var ( |
| 28 | +@@ -136,6 +137,7 @@ func init() { |
| 29 | + flannelFlags.BoolVar(&opts.blackholeRoute, "ip-blackhole-route", false, "add blackroute route ont the node for the local podCIDR") |
| 30 | + flannelFlags.StringVar(&opts.netConfPath, "net-config-path", "/etc/kube-flannel/net-conf.json", "path to the network configuration file") |
| 31 | + flannelFlags.BoolVar(&opts.setNodeNetworkUnavailable, "set-node-network-unavailable", true, "set NodeNetworkUnavailable after ready") |
| 32 | ++ flannelFlags.BoolVar(&opts.disableBrNetfilterCheck, "disable-br-netfilter-check", false, "disable br_netfilter module check (useful for Docker environments)") |
| 33 | + |
| 34 | + log.InitFlags(nil) |
| 35 | + |
| 36 | +@@ -271,7 +273,7 @@ func main() { |
| 37 | + os.Exit(1) |
| 38 | + } |
| 39 | + |
| 40 | +- if runtime.GOOS != "windows" { |
| 41 | ++ if runtime.GOOS != "windows" && !opts.disableBrNetfilterCheck { |
| 42 | + // From Kubernetes 1.30 kubeadm doesn't check if the br_netfilter module is loaded and in case it's missing Flannel wrongly starts |
| 43 | + if config.EnableIPv4 { |
| 44 | + if _, err = os.Stat("/proc/sys/net/bridge/bridge-nf-call-iptables"); os.IsNotExist(err) { |
| 45 | +-- |
| 46 | +2.51.0 |
| 47 | + |
0 commit comments