Skip to content

Commit 24107b5

Browse files
committed
revert changes back
1 parent f471fbf commit 24107b5

File tree

1 file changed

+0
-63
lines changed

1 file changed

+0
-63
lines changed

cns/middlewares/k8sSwiftV2.go

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package middlewares
33
import (
44
"context"
55
"fmt"
6-
"net/netip"
76

87
"github.com/Azure/azure-container-networking/cns"
98
"github.com/Azure/azure-container-networking/cns/configuration"
@@ -248,65 +247,3 @@ func (k *K8sSWIFTv2Middleware) getIPConfig(ctx context.Context, podInfo cns.PodI
248247
func (k *K8sSWIFTv2Middleware) Type() cns.SWIFTV2Mode {
249248
return cns.K8sSWIFTV2
250249
}
251-
252-
func (k *K8sSWIFTv2Middleware) addRoutes(cidrs []string, gatewayIP string) []cns.Route {
253-
routes := make([]cns.Route, len(cidrs))
254-
for i, cidr := range cidrs {
255-
routes[i] = cns.Route{
256-
IPAddress: cidr,
257-
GatewayIPAddress: gatewayIP,
258-
}
259-
}
260-
return routes
261-
}
262-
263-
func (k *K8sSWIFTv2Middleware) SetInfraRoutes(podIPInfo *cns.PodIpInfo) ([]cns.Route, error) {
264-
var routes []cns.Route
265-
266-
// Get and parse infraVNETCIDRs from env
267-
infraVNETCIDRs, err := configuration.InfraVNETCIDRs()
268-
if err != nil {
269-
return nil, errors.Wrapf(err, "failed to get infraVNETCIDRs from env")
270-
}
271-
infraVNETCIDRsv4, infraVNETCIDRsv6, err := utils.ParseCIDRs(infraVNETCIDRs)
272-
if err != nil {
273-
return nil, errors.Wrapf(err, "failed to parse infraVNETCIDRs")
274-
}
275-
276-
// Get and parse podCIDRs from env
277-
podCIDRs, err := configuration.PodCIDRs()
278-
if err != nil {
279-
return nil, errors.Wrapf(err, "failed to get podCIDRs from env")
280-
}
281-
podCIDRsV4, podCIDRv6, err := utils.ParseCIDRs(podCIDRs)
282-
if err != nil {
283-
return nil, errors.Wrapf(err, "failed to parse podCIDRs")
284-
}
285-
286-
// Get and parse serviceCIDRs from env
287-
serviceCIDRs, err := configuration.ServiceCIDRs()
288-
if err != nil {
289-
return nil, errors.Wrapf(err, "failed to get serviceCIDRs from env")
290-
}
291-
serviceCIDRsV4, serviceCIDRsV6, err := utils.ParseCIDRs(serviceCIDRs)
292-
if err != nil {
293-
return nil, errors.Wrapf(err, "failed to parse serviceCIDRs")
294-
}
295-
296-
ip, err := netip.ParseAddr(podIPInfo.PodIPConfig.IPAddress)
297-
if err != nil {
298-
return nil, errors.Wrapf(err, "failed to parse podIPConfig IP address %s", podIPInfo.PodIPConfig.IPAddress)
299-
}
300-
301-
if ip.Is4() {
302-
routes = append(routes, k.addRoutes(podCIDRsV4, overlayGatewayv4)...)
303-
routes = append(routes, k.addRoutes(serviceCIDRsV4, overlayGatewayv4)...)
304-
routes = append(routes, k.addRoutes(infraVNETCIDRsv4, overlayGatewayv4)...)
305-
} else {
306-
routes = append(routes, k.addRoutes(podCIDRv6, overlayGatewayV6)...)
307-
routes = append(routes, k.addRoutes(serviceCIDRsV6, overlayGatewayV6)...)
308-
routes = append(routes, k.addRoutes(infraVNETCIDRsv6, overlayGatewayV6)...)
309-
}
310-
311-
return routes, nil
312-
}

0 commit comments

Comments
 (0)