From 43cd9da1d2f0c369f7473ed38b8425d686dfc8bb Mon Sep 17 00:00:00 2001 From: paulyufan2 Date: Thu, 10 Oct 2024 10:47:22 -0400 Subject: [PATCH] add workaround to fix the default route issue --- cns/middlewares/k8sSwiftV2_windows.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cns/middlewares/k8sSwiftV2_windows.go b/cns/middlewares/k8sSwiftV2_windows.go index 8ceb97f89d..a34c823cff 100644 --- a/cns/middlewares/k8sSwiftV2_windows.go +++ b/cns/middlewares/k8sSwiftV2_windows.go @@ -14,6 +14,14 @@ func (k *K8sSWIFTv2Middleware) setRoutes(podIPInfo *cns.PodIpInfo) error { if podIPInfo.NICType == cns.InfraNIC { logger.Printf("[SWIFTv2Middleware] skip setting default route on InfraNIC interface") podIPInfo.SkipDefaultRoutes = true + + // as a workaround, set a default route with gw 0.0.0.0 to avoid HNS setting default route to infraNIC interface + // TODO: remove this once HNS supports custom routes adding to the pod + route := cns.Route{ + IPAddress: "0.0.0.0/0", + GatewayIPAddress: "0.0.0.0", + } + podIPInfo.Routes = append(podIPInfo.Routes, route) } return nil }