Skip to content

Commit de4e3ac

Browse files
committed
add default route
1 parent 944c6b1 commit de4e3ac

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

cns/middlewares/k8sSwiftV2.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,17 @@ func (k *K8sSWIFTv2Middleware) SetInfraRoutes(podIPInfo *cns.PodIpInfo) ([]cns.R
305305
routes = append(routes, k.addRoutes(podCIDRsV4, "10.229.0.1")...)
306306
routes = append(routes, k.addRoutes(serviceCIDRsV4, "10.0.0.1")...)
307307
routes = append(routes, k.addRoutes(infraVNETCIDRsv4, "10.225.0.1")...)
308-
routes = append(routes, k.addRoutes("0.0.0.0/0", "0.0.0.0")...)
309308
} else {
310309
routes = append(routes, k.addRoutes(podCIDRv6, overlayGatewayV6)...)
311310
routes = append(routes, k.addRoutes(serviceCIDRsV6, overlayGatewayV6)...)
312311
routes = append(routes, k.addRoutes(infraVNETCIDRsv6, overlayGatewayV6)...)
313312
}
314313

314+
defaultRoute := cns.Route{
315+
IPAddress: "0.0.0.0/0",
316+
GatewayIPAddress: "0.0.0.0",
317+
}
318+
routes = append(routes, defaultRoute)
319+
315320
return routes, nil
316321
}

cns/middlewares/k8sSwiftV2_windows.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ func (k *K8sSWIFTv2Middleware) assignSubnetPrefixLengthFields(podIPInfo *cns.Pod
5959
}
6060

6161
// add default route with gateway IP to podIPInfo
62-
// func (k *K8sSWIFTv2Middleware) addDefaultRoute(podIPInfo *cns.PodIpInfo) {
63-
// route := cns.Route{
64-
// IPAddress: "0.0.0.0/0",
65-
// GatewayIPAddress: "10.242.0.2",
66-
// }
67-
// podIPInfo.Routes = append(podIPInfo.Routes, route)
68-
// }
62+
func (k *K8sSWIFTv2Middleware) addDefaultRoute(podIPInfo *cns.PodIpInfo) {
63+
route := cns.Route{
64+
IPAddress: "0.0.0.0/0",
65+
GatewayIPAddress: "10.242.0.2",
66+
}
67+
podIPInfo.Routes = append(podIPInfo.Routes, route)
68+
}

0 commit comments

Comments
 (0)