diff --git a/cni/network/invoker_cns.go b/cni/network/invoker_cns.go index f3e75690f7..1a832ac09a 100644 --- a/cni/network/invoker_cns.go +++ b/cni/network/invoker_cns.go @@ -88,9 +88,9 @@ func (invoker *CNSIPAMInvoker) Add(addConfig IPAMAddConfig) (IPAMAddResult, erro PodNamespace: invoker.podNamespace, } - logger.Info(podInfo.PodName) orchestratorContext, err := json.Marshal(podInfo) if err != nil { + logger.Info(podInfo.PodName) return IPAMAddResult{}, errors.Wrap(err, "Failed to unmarshal orchestrator context during add: %w") } diff --git a/cni/network/network.go b/cni/network/network.go index 2381b8ffc4..813c58e376 100644 --- a/cni/network/network.go +++ b/cni/network/network.go @@ -980,9 +980,6 @@ func (plugin *NetPlugin) Delete(args *cniSkel.CmdArgs) error { logger.Info("Execution mode", zap.String("mode", nwCfg.ExecutionMode)) if nwCfg.ExecutionMode == string(util.Baremetal) { - - logger.Info("Baremetal mode. Calling vnet agent for delete container") - // schedule send metric before attempting delete defer sendMetricFunc() _, err = plugin.nnsClient.DeleteContainerNetworking(context.Background(), k8sPodName, args.Netns) @@ -1254,16 +1251,12 @@ func (plugin *NetPlugin) Update(args *cniSkel.CmdArgs) error { targetEpInfo := &network.EndpointInfo{} // get the target routes that should replace existingEpInfo.Routes inside the network namespace - logger.Info("Going to collect target routes for from targetNetworkConfig", - zap.String("pod", k8sPodName), - zap.String("namespace", k8sNamespace)) if targetNetworkConfig.Routes != nil && len(targetNetworkConfig.Routes) > 0 { for _, route := range targetNetworkConfig.Routes { - logger.Info("Adding route from routes to targetEpInfo", zap.Any("route", route)) + logger.Info("Adding route from routes from targetNetworkConfig to targetEpInfo", zap.Any("route", route)) _, dstIPNet, _ := net.ParseCIDR(route.IPAddress) gwIP := net.ParseIP(route.GatewayIPAddress) targetEpInfo.Routes = append(targetEpInfo.Routes, network.RouteInfo{Dst: *dstIPNet, Gw: gwIP, DevName: existingEpInfo.IfName}) - logger.Info("Successfully added route from routes to targetEpInfo", zap.Any("route", route)) } } @@ -1278,7 +1271,6 @@ func (plugin *NetPlugin) Update(args *cniSkel.CmdArgs) error { gwIP := net.ParseIP(ipconfig.GatewayIPAddress) route := network.RouteInfo{Dst: dstIPNet, Gw: gwIP, DevName: existingEpInfo.IfName} targetEpInfo.Routes = append(targetEpInfo.Routes, route) - logger.Info("Successfully added route from cnetAddressspace to targetEpInfo", zap.Any("subnet", ipRouteSubnet)) } logger.Info("Finished collecting new routes in targetEpInfo", zap.Any("route", targetEpInfo.Routes)) diff --git a/network/endpoint.go b/network/endpoint.go index 19202c8be7..db2c2cf01e 100644 --- a/network/endpoint.go +++ b/network/endpoint.go @@ -309,20 +309,18 @@ func (ep *endpoint) detach() error { } // updateEndpoint updates an existing endpoint in the network. -func (nm *networkManager) updateEndpoint(nw *network, exsitingEpInfo *EndpointInfo, targetEpInfo *EndpointInfo) error { +func (nm *networkManager) updateEndpoint(nw *network, existingEpInfo, targetEpInfo *EndpointInfo) error { var err error - logger.Info("Updating existing endpoint in network to target", zap.Any("exsitingEpInfo", exsitingEpInfo), + logger.Info("Updating existing endpoint in network to target", zap.Any("existingEpInfo", existingEpInfo), zap.String("id", nw.Id), zap.Any("targetEpInfo", targetEpInfo)) defer func() { if err != nil { - logger.Error("Failed to update endpoint with err", zap.String("id", exsitingEpInfo.Id), zap.Error(err)) + logger.Error("Failed to update endpoint with err", zap.String("id", existingEpInfo.Id), zap.Error(err)) } }() - logger.Info("Trying to retrieve endpoint id", zap.String("id", exsitingEpInfo.Id)) - - ep := nw.Endpoints[exsitingEpInfo.Id] + ep := nw.Endpoints[existingEpInfo.Id] if ep == nil { return errEndpointNotFound } @@ -330,27 +328,24 @@ func (nm *networkManager) updateEndpoint(nw *network, exsitingEpInfo *EndpointIn logger.Info("Retrieved endpoint to update", zap.Any("ep", ep)) // Call the platform implementation. - ep, err = nm.updateEndpointImpl(nw, exsitingEpInfo, targetEpInfo) + ep, err = nm.updateEndpointImpl(nw, existingEpInfo, targetEpInfo) if err != nil { return err } // Update routes for existing endpoint - nw.Endpoints[exsitingEpInfo.Id].Routes = ep.Routes + nw.Endpoints[existingEpInfo.Id].Routes = ep.Routes return nil } func GetPodNameWithoutSuffix(podName string) string { nameSplit := strings.Split(podName, "-") - logger.Info("namesplit", zap.Any("nameSplit", nameSplit)) if len(nameSplit) > 2 { nameSplit = nameSplit[:len(nameSplit)-2] } else { return podName } - - logger.Info("Pod name after splitting based on", zap.Any("nameSplit", nameSplit)) return strings.Join(nameSplit, "-") } diff --git a/network/endpoint_linux.go b/network/endpoint_linux.go index 179d28cc8c..729fdb7c31 100644 --- a/network/endpoint_linux.go +++ b/network/endpoint_linux.go @@ -232,10 +232,9 @@ func (nw *network) newEndpointImpl( if epInfo.IPV6Mode != "" { // Enable ipv6 setting in container - logger.Info("Enable ipv6 setting in container.") nuc := networkutils.NewNetworkUtils(nl, plc) if epErr := nuc.UpdateIPV6Setting(0); epErr != nil { - return fmt.Errorf("Enable ipv6 in container failed:%w", epErr) + return fmt.Errorf("enable ipv6 in container failed:%w", epErr) } } @@ -270,7 +269,6 @@ func (nw *network) deleteEndpointImpl(nl netlink.NetlinkInterface, plc platform. if ep.VlanID != 0 { epInfo := ep.getInfo() if nw.Mode == opModeTransparentVlan { - logger.Info("Transparent vlan client") epClient = NewTransparentVlanEndpointClient(nw, epInfo, ep.HostIfName, "", ep.VlanID, ep.LocalIP, nl, plc, nsc, iptc) } else { @@ -462,7 +460,7 @@ func (nm *networkManager) updateRoutes(existingEp *EndpointInfo, targetEp *Endpo // we do not support enable/disable snat for now defaultDst := net.ParseIP("0.0.0.0") - logger.Info("Going to collect routes and skip default and infravnet routes if applicable.") + // collect routes and skip default and infravnet routes if applicable logger.Info("Key for default route", zap.String("route", defaultDst.String())) infraVnetKey := "" @@ -476,7 +474,6 @@ func (nm *networkManager) updateRoutes(existingEp *EndpointInfo, targetEp *Endpo logger.Info("Key for route to infra vnet", zap.String("infraVnetKey", infraVnetKey)) for _, route := range existingEp.Routes { destination := route.Dst.IP.String() - logger.Info("Checking destination as to skip or not", zap.String("destination", destination)) isDefaultRoute := destination == defaultDst.String() isInfraVnetRoute := targetEp.EnableInfraVnet && (destination == infraVnetKey) if !isDefaultRoute && !isInfraVnetRoute { diff --git a/network/network_linux.go b/network/network_linux.go index 47f68b420d..2b13c6c68b 100644 --- a/network/network_linux.go +++ b/network/network_linux.go @@ -97,16 +97,13 @@ func (nm *networkManager) newNetworkImpl(nwInfo *NetworkInfo, extIf *externalInt if err := nu.EnableIPV4Forwarding(); err != nil { return nil, errors.Wrap(err, "ipv4 forwarding failed") } - logger.Info("Ipv4 forwarding enabled") if err := nu.UpdateIPV6Setting(1); err != nil { return nil, errors.Wrap(err, "failed to disable ipv6 on vm") } - logger.Info("Disabled ipv6") // Blocks wireserver traffic from apipa nic if err := nu.BlockEgressTrafficFromContainer(nm.iptablesClient, iptables.V4, networkutils.AzureDNS, iptables.TCP, iptables.HTTPPort); err != nil { return nil, errors.Wrap(err, "unable to insert vm iptables rule drop wireserver packets") } - logger.Info("Block wireserver traffic rule added") default: return nil, errNetworkModeInvalid } @@ -469,7 +466,6 @@ func (nm *networkManager) connectExternalInterface(extIf *externalInterface, nwI networkClient NetworkClient ) - logger.Info("Connecting interface", zap.String("Name", extIf.Name)) defer func() { logger.Info("Connecting interface completed", zap.String("Name", extIf.Name), zap.Error(err)) }() @@ -548,37 +544,35 @@ func (nm *networkManager) connectExternalInterface(extIf *externalInterface, nwI } } + logger.Info("Modifying interfaces", zap.String("Name", hostIf.Name)) + // External interface down. - logger.Info("Setting link state down", zap.String("Name", hostIf.Name)) err = nm.netlink.SetLinkState(hostIf.Name, false) if err != nil { - return err + return errors.Wrap(err, "failed to set external interface down") } // Connect the external interface to the bridge. - logger.Info("Setting link master", zap.String("Name", hostIf.Name), zap.String("bridgeName", bridgeName)) if err = networkClient.SetBridgeMasterToHostInterface(); err != nil { - return err + return errors.Wrap(err, "failed to connect external interface to bridge") } // External interface up. - logger.Info("Setting link state up", zap.String("Name", hostIf.Name)) err = nm.netlink.SetLinkState(hostIf.Name, true) if err != nil { - return err + return errors.Wrap(err, "failed to set external interface up") } // Bridge up. - logger.Info("Setting link state up", zap.String("bridgeName", bridgeName)) err = nm.netlink.SetLinkState(bridgeName, true) if err != nil { - return err + return errors.Wrap(err, "failed to set bridge link state up") } // Add the bridge rules. err = networkClient.AddL2Rules(extIf) if err != nil { - return err + return errors.Wrap(err, "failed to add bridge rules") } // External interface hairpin on. @@ -597,8 +591,6 @@ func (nm *networkManager) connectExternalInterface(extIf *externalInterface, nwI } if isGreaterOrEqualUbuntu17 && isSystemdResolvedActive { - logger.Info("Applying dns config on", zap.String("bridgeName", bridgeName)) - if err = nm.applyDNSConfig(extIf, bridgeName); err != nil { logger.Error("Failed to apply DNS configuration with", zap.Error(err)) return err @@ -635,9 +627,7 @@ func (nm *networkManager) connectExternalInterface(extIf *externalInterface, nwI // DisconnectExternalInterface disconnects a host interface from its bridge. func (nm *networkManager) disconnectExternalInterface(extIf *externalInterface, networkClient NetworkClient) { - logger.Info("Disconnecting interface", zap.String("Name", extIf.Name)) - - logger.Info("Deleting bridge rules") + logger.Info("Disconnecting interface and deleting bridge rules", zap.String("Name", extIf.Name)) // Delete bridge rules set on the external interface. networkClient.DeleteL2Rules(extIf) diff --git a/network/networkutils/networkutils_linux.go b/network/networkutils/networkutils_linux.go index 519da94f9c..87cc35547f 100644 --- a/network/networkutils/networkutils_linux.go +++ b/network/networkutils/networkutils_linux.go @@ -82,7 +82,6 @@ func (nu NetworkUtils) CreateEndpoint(hostVethName, containerVethName string, ma return newErrorNetworkUtils(err.Error()) } - logger.Info("Setting link state up", zap.String("hostVethName", hostVethName)) err = nu.netlink.SetLinkState(hostVethName, true) if err != nil { return newErrorNetworkUtils(err.Error()) @@ -97,7 +96,6 @@ func (nu NetworkUtils) CreateEndpoint(hostVethName, containerVethName string, ma func (nu NetworkUtils) SetupContainerInterface(containerVethName, targetIfName string) error { // Interface needs to be down before renaming. - logger.Info("Setting link state down", zap.String("containerVethName", containerVethName)) if err := nu.netlink.SetLinkState(containerVethName, false); err != nil { return newErrorNetworkUtils(err.Error()) } @@ -113,7 +111,6 @@ func (nu NetworkUtils) SetupContainerInterface(containerVethName, targetIfName s } // Bring the interface back up. - logger.Info("Setting link state up.", zap.String("targetIfName", targetIfName)) err := nu.netlink.SetLinkState(targetIfName, true) if err != nil { return newErrorNetworkUtils(err.Error()) diff --git a/network/snat/snat_linux.go b/network/snat/snat_linux.go index fb7f348b78..8150161d77 100644 --- a/network/snat/snat_linux.go +++ b/network/snat/snat_linux.go @@ -68,7 +68,6 @@ func NewSnatClient(hostIfName string, plClient platform.ExecClient, iptc ipTablesClient, ) Client { - logger.Info("Initialize new snat client") snatClient := Client{ hostSnatVethName: hostIfName, containerSnatVethName: contIfName, @@ -446,8 +445,6 @@ func (client *Client) createSnatBridge(snatBridgeIP, hostPrimaryMac string) erro return err } - logger.Info("Setting snat bridge mac", zap.String("hostPrimaryMac", hostPrimaryMac)) - ip, addr, _ := net.ParseCIDR(snatBridgeIP) err = client.netlink.AddIPAddress(SnatBridgeName, ip, addr) if err != nil && !strings.Contains(strings.ToLower(err.Error()), "file exists") { diff --git a/network/transparent_endpointclient_linux.go b/network/transparent_endpointclient_linux.go index f39986c0e4..db4935aceb 100644 --- a/network/transparent_endpointclient_linux.go +++ b/network/transparent_endpointclient_linux.go @@ -286,8 +286,6 @@ func (client *TransparentEndpointClient) ConfigureContainerInterfacesAndRoutes(e } func (client *TransparentEndpointClient) setupIPV6Routes() error { - logger.Info("Setting up ipv6 routes in container") - // add route for virtualgwip // ip -6 route add fe80::1234:5678:9abc/128 dev eth0 virtualGwIP, virtualGwNet, _ := net.ParseCIDR(virtualv6GwString) @@ -298,7 +296,7 @@ func (client *TransparentEndpointClient) setupIPV6Routes() error { // ip -6 route add default via fe80::1234:5678:9abc dev eth0 _, defaultIPNet, _ := net.ParseCIDR(defaultv6Cidr) - logger.Info("defaultv6ipnet", zap.Any("defaultIPNet", defaultIPNet)) + logger.Info("Setting up ipv6 routes in container", zap.Any("defaultIPNet", defaultIPNet)) defaultRoute := RouteInfo{ Dst: *defaultIPNet, Gw: virtualGwIP, diff --git a/network/transparent_vlan_endpointclient_linux.go b/network/transparent_vlan_endpointclient_linux.go index 6fcf9719e9..7c6d5d2869 100644 --- a/network/transparent_vlan_endpointclient_linux.go +++ b/network/transparent_vlan_endpointclient_linux.go @@ -212,7 +212,6 @@ func (client *TransparentVlanEndpointClient) PopulateVM(epInfo *EndpointInfo) er return errors.Wrap(err, "failed to get vm ns handle") } - logger.Info("Checking if NS exists...") var existingErr error client.vnetNSFileDescriptor, existingErr = client.netnsClient.GetFromName(client.vnetNSName) // If the ns does not exist, the below code will trigger to create it @@ -308,7 +307,7 @@ func (client *TransparentVlanEndpointClient) PopulateVM(epInfo *EndpointInfo) er // Get the default constant host veth mac mac, err := net.ParseMAC(defaultHostVethHwAddr) if err != nil { - logger.Info("Failed to parse the mac addrress", zap.String("defaultHostVethHwAddr", defaultHostVethHwAddr)) + logger.Info("Failed to parse the mac address", zap.String("defaultHostVethHwAddr", defaultHostVethHwAddr)) } // Create veth pair