Skip to content

Commit 22330ab

Browse files
authored
Merge pull request #146 from cloudnativelabs/goreportcard
fix gofmt, go_vet, misspells
2 parents b171f22 + ed935a4 commit 22330ab

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

app/controllers/network_policy_controller.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ type networkPolicyInfo struct {
5656
// set of pods matching network policy spec podselector label selector
5757
destPods map[string]podInfo
5858

59-
// whitelist ingress rules from the netwrok policy spec
59+
// whitelist ingress rules from the network policy spec
6060
ingressRules []ingressRule
6161
}
6262

@@ -120,7 +120,7 @@ func (npc *NetworkPolicyController) OnPodUpdate(podUpdate *watchers.PodUpdate) {
120120
if watchers.PodWatcher.HasSynced() && watchers.NetworkPolicyWatcher.HasSynced() {
121121
err := npc.Sync()
122122
if err != nil {
123-
glog.Errorf("Error syncing on pod update: ", err)
123+
glog.Errorf("Error syncing on pod update: %s", err)
124124
}
125125
} else {
126126
glog.Infof("Received pod update, but controller not in sync")
@@ -131,7 +131,7 @@ func (npc *NetworkPolicyController) OnNetworkPolicyUpdate(networkPolicyUpdate *w
131131
if watchers.PodWatcher.HasSynced() && watchers.NetworkPolicyWatcher.HasSynced() {
132132
err := npc.Sync()
133133
if err != nil {
134-
glog.Errorf("Error syncing on network policy update: ", err)
134+
glog.Errorf("Error syncing on network policy update: %s", err)
135135
}
136136
} else {
137137
glog.Infof("Received network policy update, but controller not in sync")
@@ -149,7 +149,7 @@ func (npc *NetworkPolicyController) OnNamespaceUpdate(namespaceUpdate *watchers.
149149
if watchers.PodWatcher.HasSynced() && watchers.NetworkPolicyWatcher.HasSynced() {
150150
err := npc.Sync()
151151
if err != nil {
152-
glog.Errorf("Error syncing on namespace update: ", err)
152+
glog.Errorf("Error syncing on namespace update: %s", err)
153153
}
154154
} else {
155155
glog.Infof("Received namspace update, but controller not in sync")
@@ -372,7 +372,7 @@ func (npc *NetworkPolicyController) syncPodFirewallChains() (map[string]bool, er
372372
continue
373373
}
374374

375-
// ensure pod specfic firewall chain exist for all the pods that need ingress firewall
375+
// ensure pod specific firewall chain exist for all the pods that need ingress firewall
376376
podFwChainName := podFirewallChainName(pod.namespace, pod.name)
377377
err = iptablesCmdHandler.NewChain("filter", podFwChainName)
378378
if err != nil && err.(*iptables.Error).ExitStatus() != 1 {

app/controllers/network_routes_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (nrc *NetworkRoutingController) Run(stopCh <-chan struct{}, wg *sync.WaitGr
8989
// In case of cluster provisioned on AWS disable source-destination check
9090
nrc.disableSourceDestinationCheck()
9191

92-
// enable IP forwarding for the packets coming in/out from ther pods
92+
// enable IP forwarding for the packets coming in/out from the pods
9393
err = nrc.enableForwarding()
9494
if err != nil {
9595
glog.Errorf("Failed to enable IP forwarding of traffic from pods: %s", err.Error())
@@ -119,7 +119,7 @@ func (nrc *NetworkRoutingController) Run(stopCh <-chan struct{}, wg *sync.WaitGr
119119
} else {
120120
glog.Infoln("Disabling Pod egress.")
121121
err = deletePodEgressRule()
122-
// TODO: Don't error if removing non-existant Pod egress rules/ipsets.
122+
// TODO: Don't error if removing non-existent Pod egress rules/ipsets.
123123
if err != nil {
124124
glog.Infof("Error disabling Pod egress: %s", err.Error())
125125
}
@@ -273,7 +273,7 @@ func (nrc *NetworkRoutingController) advertiseRoute() error {
273273

274274
cidrStr := strings.Split(cidr, "/")
275275
subnet := cidrStr[0]
276-
cidrLen, err := strconv.Atoi(cidrStr[1])
276+
cidrLen, _ := strconv.Atoi(cidrStr[1])
277277
attrs := []bgp.PathAttributeInterface{
278278
bgp.NewPathAttributeOrigin(0),
279279
bgp.NewPathAttributeNextHop(nrc.nodeIP.String()),
@@ -318,7 +318,7 @@ func (nrc *NetworkRoutingController) AdvertiseClusterIp(clusterIp string) error
318318
// Each node advertises its pod CIDR to the nodes with same ASN (iBGP peers) and to the global BGP peer
319319
// or per node BGP peer. Each node ends up advertising not only pod CIDR assigned to the self but other
320320
// routers learned to the node pod CIDR's as well to global BGP peer or per node BGP peers. external BGP
321-
// peer will randomly (since all path have equal selection atributes) select the routes from multiple
321+
// peer will randomly (since all path have equal selection attributes) select the routes from multiple
322322
// routes to a pod CIDR which will result in extra hop. To prevent this behaviour this methods add
323323
// defult export policy to reject. and explicit policy is added so that each node only advertised the
324324
// pod CIDR assigned to it. Additionally export policy is added so that a node advertises cluster IP's

app/controllers/network_services_controller.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ func (nsc *NetworkServicesController) syncIpvsServices(serviceInfoMap serviceInf
251251
// create IPVS service for the service to be exposed through the cluster ip
252252
ipvs_cluster_vip_svc, err := ipvsAddService(svc.clusterIP, protocol, uint16(svc.port), svc.sessionAffinity)
253253
if err != nil {
254-
glog.Errorf("Failed to create ipvs service for cluster ip: ", err.Error())
254+
glog.Errorf("Failed to create ipvs service for cluster ip: %s", err.Error())
255255
continue
256256
}
257257
var clusterServiceId = generateIpPortId(svc.clusterIP.String(), svc.protocol, strconv.Itoa(svc.port))
@@ -319,7 +319,7 @@ func (nsc *NetworkServicesController) syncIpvsServices(serviceInfoMap serviceInf
319319
glog.Infof("Found a IPVS service %s:%s:%s which is no longer needed so cleaning up", ipvsSvc.Address.String(), protocol, strconv.Itoa(int(ipvsSvc.Port)))
320320
err := h.DelService(ipvsSvc)
321321
if err != nil {
322-
glog.Errorf("Failed to delete stale IPVS service: ", err.Error())
322+
glog.Errorf("Failed to delete stale IPVS service: %s", err.Error())
323323
continue
324324
}
325325
} else {
@@ -786,7 +786,7 @@ func (nsc *NetworkServicesController) Cleanup() {
786786

787787
handle, err := ipvs.New("")
788788
if err != nil {
789-
glog.Errorf("Failed to cleanup ipvs rules: ", err.Error())
789+
glog.Errorf("Failed to cleanup ipvs rules: %s", err.Error())
790790
return
791791
}
792792

@@ -795,14 +795,14 @@ func (nsc *NetworkServicesController) Cleanup() {
795795
// cleanup iptable masqurade rule
796796
err = deleteMasqueradeIptablesRule()
797797
if err != nil {
798-
glog.Errorf("Failed to cleanup iptable masquerade rule due to: ", err.Error())
798+
glog.Errorf("Failed to cleanup iptable masquerade rule due to: %s", err.Error())
799799
return
800800
}
801801

802802
// cleanup iptable hairpin rules
803803
err = deleteHairpinIptablesRules()
804804
if err != nil {
805-
glog.Errorf("Failed to cleanup iptable hairpin rules: ", err.Error())
805+
glog.Errorf("Failed to cleanup iptable hairpin rules: %s", err.Error())
806806
return
807807
}
808808

@@ -815,7 +815,7 @@ func (nsc *NetworkServicesController) Cleanup() {
815815
} else {
816816
err = netlink.LinkDel(dummyVipInterface)
817817
if err != nil {
818-
glog.Errorf("Could not delete dummy interface: "+KUBE_DUMMY_IF, err.Error())
818+
glog.Errorf("Could not delete dummy interface " + KUBE_DUMMY_IF + " due to " + err.Error())
819819
return
820820
}
821821
}

0 commit comments

Comments
 (0)