mirror of
https://github.com/cloudnativelabs/kube-router.git
synced 2026-05-05 14:46:14 +02:00
fix(lint): remove non-constant format string (govet)
This commit is contained in:
parent
48b631c4ea
commit
760fcd5c85
@ -574,7 +574,7 @@ func TestNetworkPolicyBuilder(t *testing.T) {
|
||||
}
|
||||
for ipFamily, filterTableRules := range krNetPol.filterTableRules {
|
||||
for _, np := range netpols {
|
||||
fmt.Printf(np.policyType)
|
||||
fmt.Print(np.policyType)
|
||||
if np.policyType == kubeEgressPolicyType || np.policyType == kubeBothPolicyType {
|
||||
err = krNetPol.processEgressRules(np, "", nil, "1", ipFamily)
|
||||
if err != nil {
|
||||
|
||||
@ -319,7 +319,7 @@ func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.Control
|
||||
// https://github.com/cloudnativelabs/kube-router/issues/282
|
||||
err = nsc.setupIpvsFirewall()
|
||||
if err != nil {
|
||||
klog.Fatalf("error setting up ipvs firewall: %s" + err.Error())
|
||||
klog.Fatalf("error setting up ipvs firewall: %v", err.Error())
|
||||
}
|
||||
nsc.ProxyFirewallSetup.Broadcast()
|
||||
|
||||
@ -362,7 +362,7 @@ func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.Control
|
||||
klog.V(1).Info("Performing requested full sync of services")
|
||||
err = nsc.doSync()
|
||||
if err != nil {
|
||||
klog.Errorf("Error during full sync in network service controller. Error: " + err.Error())
|
||||
klog.Errorf("error during full sync in network service controller. Error: %v", err)
|
||||
}
|
||||
case synctypeIpvs:
|
||||
// We call the component pieces of doSync() here because for methods that send this on the channel they
|
||||
@ -372,11 +372,11 @@ func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.Control
|
||||
nsc.mu.Lock()
|
||||
err = nsc.syncIpvsServices(nsc.serviceMap, nsc.endpointsMap)
|
||||
if err != nil {
|
||||
klog.Errorf("Error during ipvs sync in network service controller. Error: " + err.Error())
|
||||
klog.Errorf("error during ipvs sync in network service controller. Error: %v", err)
|
||||
}
|
||||
err = nsc.syncHairpinIptablesRules()
|
||||
if err != nil {
|
||||
klog.Errorf("Error syncing hairpin iptables rules: %s", err.Error())
|
||||
klog.Errorf("error syncing hairpin iptables rules: %v", err)
|
||||
}
|
||||
nsc.mu.Unlock()
|
||||
}
|
||||
@ -389,7 +389,7 @@ func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.Control
|
||||
healthcheck.SendHeartBeat(healthChan, healthcheck.NetworkServicesController)
|
||||
err := nsc.doSync()
|
||||
if err != nil {
|
||||
klog.Errorf("Error during periodic ipvs sync in network service controller. Error: " + err.Error())
|
||||
klog.Errorf("error during periodic ipvs sync in network service controller. Error: %v", err.Error())
|
||||
klog.Errorf("Skipping sending heartbeat from network service controller as periodic sync failed.")
|
||||
} else {
|
||||
healthcheck.SendHeartBeat(healthChan, healthcheck.NetworkServicesController)
|
||||
@ -1837,7 +1837,7 @@ func (nsc *NetworkServicesController) Cleanup() {
|
||||
} else {
|
||||
err = netlink.LinkDel(dummyVipInterface)
|
||||
if err != nil {
|
||||
klog.Errorf("Could not delete dummy interface " + KubeDummyIf + " due to " + err.Error())
|
||||
klog.Errorf("could not delete dummy interface %s due to: %v", KubeDummyIf, err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@ -824,7 +824,7 @@ func (nsc *NetworkServicesController) cleanupDSRService(fwMark uint32) error {
|
||||
mangleTableRulesDump := bytes.Buffer{}
|
||||
var mangleTableRules []string
|
||||
if err := utils.SaveInto(iptablesBinary, "mangle", &mangleTableRulesDump); err != nil {
|
||||
klog.Errorf("Failed to run iptables-save: %s" + err.Error())
|
||||
klog.Errorf("failed to run iptables-save: %v", err)
|
||||
} else {
|
||||
mangleTableRules = strings.Split(mangleTableRulesDump.String(), "\n")
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ func (nrc *NetworkRoutingController) disableSourceDestinationCheck() {
|
||||
providerID := strings.Replace(node.Spec.ProviderID, "///", "//", 1)
|
||||
URL, err := url.Parse(providerID)
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to parse URL for providerID " + providerID + " : " + err.Error())
|
||||
klog.Errorf("failed to parse URL for providerID %s: %v", providerID, err)
|
||||
return
|
||||
}
|
||||
instanceID := URL.Path
|
||||
@ -45,7 +45,7 @@ func (nrc *NetworkRoutingController) disableSourceDestinationCheck() {
|
||||
metadataClient := ec2metadata.New(sess)
|
||||
region, err := metadataClient.Region()
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to disable source destination check due to: " + err.Error())
|
||||
klog.Errorf("failed to disable source destination check due to: %v", err)
|
||||
return
|
||||
}
|
||||
sess.Config.Region = aws.String(region)
|
||||
@ -66,9 +66,9 @@ func (nrc *NetworkRoutingController) disableSourceDestinationCheck() {
|
||||
"disabling src-dst check.")
|
||||
return
|
||||
}
|
||||
klog.Errorf("Failed to disable source destination check due to: %v", err.Error())
|
||||
klog.Errorf("failed to disable source destination check due to: %v", err)
|
||||
} else {
|
||||
klog.Infof("Disabled source destination check for the instance: " + instanceID)
|
||||
klog.Infof("disabled source destination check for the instance: %s", instanceID)
|
||||
}
|
||||
|
||||
// to prevent EC2 rejecting API call due to API throttling give a delay between the calls
|
||||
|
||||
@ -394,8 +394,8 @@ func (nrc *NetworkRoutingController) Run(healthChan chan<- *healthcheck.Controll
|
||||
if err == nil {
|
||||
healthcheck.SendHeartBeat(healthChan, healthcheck.NetworkRoutesController)
|
||||
} else {
|
||||
klog.Errorf("Error during periodic sync in network routing controller. Error: " + err.Error())
|
||||
klog.Errorf("Skipping sending heartbeat from network routing controller as periodic sync failed.")
|
||||
klog.Errorf("error during periodic sync in network routing controller. Error: %v", err)
|
||||
klog.Errorf("skipping sending heartbeat from network routing controller as periodic sync failed.")
|
||||
}
|
||||
|
||||
select {
|
||||
@ -461,7 +461,7 @@ func (nrc *NetworkRoutingController) watchBgpUpdates() {
|
||||
}
|
||||
klog.V(2).Infof("Processing bgp route advertisement from peer: %s", path.NeighborIp)
|
||||
if err := nrc.injectRoute(path); err != nil {
|
||||
klog.Errorf("Failed to inject routes due to: " + err.Error())
|
||||
klog.Errorf("failed to inject routes due to: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -477,7 +477,7 @@ func (nrc *NetworkRoutingController) watchBgpUpdates() {
|
||||
},
|
||||
}, pathWatch)
|
||||
if err != nil {
|
||||
klog.Errorf("failed to register monitor global routing table callback due to : " + err.Error())
|
||||
klog.Errorf("failed to register monitor global routing table callback due to: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,7 +521,7 @@ func (nrc *NetworkRoutingController) advertisePodRoute() error {
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf(err.Error())
|
||||
return err
|
||||
}
|
||||
klog.V(1).Infof("Response from adding path: %s", response)
|
||||
}
|
||||
@ -567,7 +567,7 @@ func (nrc *NetworkRoutingController) advertisePodRoute() error {
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf(err.Error())
|
||||
return err
|
||||
}
|
||||
klog.V(1).Infof("Response from adding path: %s", response)
|
||||
}
|
||||
@ -778,11 +778,11 @@ func (nrc *NetworkRoutingController) Cleanup() {
|
||||
for _, ipset := range nrc.ipSetHandlers {
|
||||
err = ipset.Save()
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to clean up ipsets: " + err.Error())
|
||||
klog.Errorf("failed to clean up ipsets: %v", err)
|
||||
}
|
||||
err = ipset.DestroyAllWithin()
|
||||
if err != nil {
|
||||
klog.Warningf("Error deleting ipset: %s", err.Error())
|
||||
klog.Warningf("error deleting ipset: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1074,7 +1074,7 @@ func (nrc *NetworkRoutingController) startBgpServer(grpcServer bool) error {
|
||||
}
|
||||
|
||||
if err := nrc.bgpServer.StartBgp(context.Background(), &gobgpapi.StartBgpRequest{Global: global}); err != nil {
|
||||
return errors.New("failed to start BGP server due to : " + err.Error())
|
||||
return fmt.Errorf("failed to start BGP server due to: %v", err)
|
||||
}
|
||||
|
||||
go nrc.watchBgpUpdates()
|
||||
|
||||
@ -256,7 +256,7 @@ func CleanupTunnel(destinationSubnet *net.IPNet, tunnelName string) {
|
||||
klog.V(1).Infof("Cleaning up any lingering tunnel interfaces named: %s", tunnelName)
|
||||
if link, err := netlink.LinkByName(tunnelName); err == nil {
|
||||
if err = netlink.LinkDel(link); err != nil {
|
||||
klog.Errorf("Failed to delete tunnel link for the node due to " + err.Error())
|
||||
klog.Errorf("failed to delete tunnel link for the node due to %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user