Skip to content

Commit c3e7efc

Browse files
committed
remove logs
1 parent b3546e5 commit c3e7efc

File tree

5 files changed

+23
-8
lines changed

5 files changed

+23
-8
lines changed

cni/network/invoker_cns.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,20 @@ func configureSecondaryAddResult(info *IPResultInfo, addResult *IPAMAddResult, p
487487
if err != nil {
488488
return err
489489
}
490-
logger.Info("routes are now", zap.Any("routes are now", routes))
490+
defaultRouteDstPrefix := network.Ipv4DefaultRouteDstPrefix
491+
ncgw := net.ParseIP(info.ncGatewayIPAddress)
492+
493+
resRoute := addResult.interfaceInfo[key].Routes
494+
if len(routes) > 0 {
495+
resRoute = append(resRoute, routes...)
496+
} else { // add default routes for secondary interfaces
497+
resRoute = append(resRoute, network.RouteInfo{
498+
Dst: defaultRouteDstPrefix,
499+
Gw: ncgw,
500+
})
501+
}
502+
503+
logger.Info("routes are now", zap.Any("routes are now", resRoute))
491504

492505
addResult.interfaceInfo[key] = network.InterfaceInfo{
493506
IPConfigs: []*network.IPConfig{
@@ -499,7 +512,7 @@ func configureSecondaryAddResult(info *IPResultInfo, addResult *IPAMAddResult, p
499512
Gateway: net.ParseIP(info.ncGatewayIPAddress),
500513
},
501514
},
502-
Routes: routes,
515+
Routes: resRoute,
503516
NICType: info.nicType,
504517
MacAddress: macAddress,
505518
SkipDefaultRoutes: info.skipDefaultRoutes,

cni/network/network.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,6 @@ func (plugin *NetPlugin) createEpInfo(opt *createEpInfoOpt) (*network.EndpointIn
856856
}
857857

858858
setEndpointOptions(opt.cnsNetworkConfig, &endpointInfo, vethName)
859-
logger.Info("endpointInfo routes are", zap.Any("endpointInfo routes", endpointInfo.Routes))
860859
logger.Info("Generated endpoint info from fields", zap.String("epInfo", endpointInfo.PrettyString()))
861860

862861
// now our ep info should have the full combined information from both the network and endpoint structs

cns/middlewares/k8sSwiftV2_windows.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ func (k *K8sSWIFTv2Middleware) assignSubnetPrefixLengthFields(podIPInfo *cns.Pod
4343
},
4444
GatewayIPAddress: interfaceInfo.GatewayIP,
4545
}
46-
// assign routes
47-
virtualGWRoute := cns.Route{
46+
// assign default route
47+
defaultRoute := cns.Route{
4848
IPAddress: fmt.Sprintf("%s/%d", interfaceInfo.GatewayIP, prefixLength),
4949
}
5050
route := cns.Route{
5151
IPAddress: "0.0.0.0/0",
52-
GatewayIPAddress: virtualGW,
52+
GatewayIPAddress: interfaceInfo.GatewayIP,
5353
}
54-
podIPInfo.Routes = append(podIPInfo.Routes, virtualGWRoute, route)
54+
podIPInfo.Routes = append(podIPInfo.Routes, defaultRoute, route)
5555

5656
return nil
5757
}

network/endpoint_windows.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,13 @@ func (nw *network) configureHcnEndpoint(epInfo *EndpointInfo) (*hcn.HostComputeE
332332
hcnEndpoint.Policies = append(hcnEndpoint.Policies, endpointPolicy)
333333
}
334334

335+
logger.Info("epInfo.Routes are", zap.Any("epInfo.Routes", epInfo.Routes))
335336
for _, route := range epInfo.Routes {
336337
hcnRoute := hcn.Route{
337338
NextHop: route.Gw.String(),
338339
DestinationPrefix: route.Dst.String(),
339340
}
341+
logger.Info("endpoint windows", zap.Any("hcnRoute", hcnRoute))
340342

341343
hcnEndpoint.Routes = append(hcnEndpoint.Routes, hcnRoute)
342344
}
@@ -421,14 +423,14 @@ func (nw *network) createHostNCApipaEndpoint(cli apipaClient, epInfo *EndpointIn
421423

422424
// newEndpointImplHnsV2 creates a new endpoint in the network using Hnsv2
423425
func (nw *network) newEndpointImplHnsV2(cli apipaClient, epInfo *EndpointInfo) (*endpoint, error) {
426+
logger.Info("epInfo routes on newEndpointImplHnsV2", zap.Any("epInfo routes", epInfo.Routes))
424427
hcnEndpoint, err := nw.configureHcnEndpoint(epInfo)
425428
if err != nil {
426429
logger.Error("Failed to configure hcn endpoint due to", zap.Error(err))
427430
return nil, err
428431
}
429432

430433
// Create the HCN endpoint.
431-
logger.Info("Creating hcn endpoint", zap.Any("hcnEndpoint", hcnEndpoint), zap.String("computenetwork", hcnEndpoint.HostComputeNetwork))
432434
hnsResponse, err := Hnsv2.CreateEndpoint(hcnEndpoint)
433435
if err != nil {
434436
return nil, fmt.Errorf("Failed to create endpoint: %s due to error: %v", hcnEndpoint.Name, err)

network/network.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ func (nm *networkManager) EndpointCreate(cnsclient apipaClient, epInfos []*Endpo
317317
eps := []*endpoint{} // save endpoints for stateless
318318

319319
for _, epInfo := range epInfos {
320+
logger.Info("epInfo routes in nm endpointCreate is", zap.Any("epInfo routes in nm endpointCreate is", epInfo.Routes))
320321
logger.Info("Creating endpoint and network", zap.String("endpointInfo", epInfo.PrettyString()))
321322
// check if network exists by searching through all external interfaces for the network
322323
_, nwGetErr := nm.GetNetworkInfo(epInfo.NetworkID)

0 commit comments

Comments
 (0)