Skip to content

Commit 45cf623

Browse files
committed
add empty gw ip
1 parent fb7b987 commit 45cf623

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

cns/middlewares/k8sSwiftV2_windows.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,12 @@ func (k *K8sSWIFTv2Middleware) addDefaultRoute(podIPInfo *cns.PodIpInfo, gateway
6969
podIPInfo.Routes = append(podIPInfo.Routes, route)
7070
}
7171

72-
// always pick up .1 as the default ipv4 gateway for each IP address
73-
func (k *K8sSWIFTv2Middleware) getIPv4Gateway(cidr string) (string, error) {
74-
ip, _, err := net.ParseCIDR(cidr)
75-
if err != nil {
76-
return "", errors.Wrap(err, "failed to parse cidr")
77-
}
78-
ip = ip.To4()
79-
ip[3] = 1
80-
81-
return ip.String(), nil
82-
}
83-
84-
// Windows uses .1 as the gateway IP for each CIDR
8572
func (k *K8sSWIFTv2Middleware) addRoutes(cidrs []string) []cns.Route {
8673
routes := make([]cns.Route, len(cidrs))
8774
for i, cidr := range cidrs {
8875
routes[i] = cns.Route{
89-
IPAddress: cidr,
76+
IPAddress: cidr,
77+
GatewayIPAddress: "", // gateway IP is not required for infraNIC for containerd to program the pod
9078
}
9179
}
9280
return routes

0 commit comments

Comments
 (0)