From 5c96864fd76c9df43155e90f5824e1e6f485d156 Mon Sep 17 00:00:00 2001 From: Thomas Ferrandiz Date: Wed, 17 Apr 2024 13:28:48 +0000 Subject: [PATCH] Refactor TrafficManager windows files to clarify logs --- main.go | 3 --- pkg/trafficmngr/iptables/iptables.go | 2 ++ pkg/trafficmngr/iptables/iptables_windows.go | 2 +- pkg/trafficmngr/nftables/nftables.go | 1 + pkg/trafficmngr/nftables/nftables_windows.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 019b995a5d..246d1e38dc 100644 --- a/main.go +++ b/main.go @@ -561,11 +561,8 @@ func ReadIP6CIDRsFromSubnetFile(path string, CIDRKey string) []ip.IP6Net { func newTrafficManager(useNftables bool) trafficmngr.TrafficManager { if useNftables { - log.Info("Starting flannel in nftables mode") return &nftables.NFTablesManager{} } else { - log.Info("Starting flannel in iptables mode") return &iptables.IPTablesManager{} - } } diff --git a/pkg/trafficmngr/iptables/iptables.go b/pkg/trafficmngr/iptables/iptables.go index c6e79c4276..69d6db5e89 100644 --- a/pkg/trafficmngr/iptables/iptables.go +++ b/pkg/trafficmngr/iptables/iptables.go @@ -48,6 +48,8 @@ type IPTablesManager struct { } func (iptm *IPTablesManager) Init(ctx context.Context, wg *sync.WaitGroup) error { + log.Info("Starting flannel in iptables mode...") + iptm.ipv4Rules = make([]trafficmngr.IPTablesRule, 0, 10) iptm.ipv6Rules = make([]trafficmngr.IPTablesRule, 0, 10) wg.Add(1) diff --git a/pkg/trafficmngr/iptables/iptables_windows.go b/pkg/trafficmngr/iptables/iptables_windows.go index f0cbb853d3..c3a8d0ed0e 100644 --- a/pkg/trafficmngr/iptables/iptables_windows.go +++ b/pkg/trafficmngr/iptables/iptables_windows.go @@ -36,7 +36,7 @@ type IPTables interface { } func (iptm IPTablesManager) Init(ctx context.Context, wg *sync.WaitGroup) error { - log.Warning(trafficmngr.ErrUnimplemented) + log.Info("Starting flannel in windows mode...") return nil } diff --git a/pkg/trafficmngr/nftables/nftables.go b/pkg/trafficmngr/nftables/nftables.go index f5892afbb5..b815c9b8d1 100644 --- a/pkg/trafficmngr/nftables/nftables.go +++ b/pkg/trafficmngr/nftables/nftables.go @@ -44,6 +44,7 @@ type NFTablesManager struct { } func (nftm *NFTablesManager) Init(ctx context.Context, wg *sync.WaitGroup) error { + log.Info("Starting flannel in nftables mode...") var err error nftm.nftv4, err = initTable(ctx, knftables.IPv4Family, ipv4Table) if err != nil { diff --git a/pkg/trafficmngr/nftables/nftables_windows.go b/pkg/trafficmngr/nftables/nftables_windows.go index 1003699c15..d6e9f1a18e 100644 --- a/pkg/trafficmngr/nftables/nftables_windows.go +++ b/pkg/trafficmngr/nftables/nftables_windows.go @@ -29,7 +29,7 @@ type NFTablesManager struct { } func (nftm *NFTablesManager) Init(ctx context.Context, wg *sync.WaitGroup) error { - log.Warning(trafficmngr.ErrUnimplemented) + log.Info("Starting flannel in windows mode...") return nil }