Skip to content

Commit d5e43cf

Browse files
author
OpenShift Bot
authored
Merge pull request #13154 from pravisankar/fix-sdn-lowercase
Merged by openshift-bot
2 parents ab24ed6 + c102653 commit d5e43cf

15 files changed

+43
-43
lines changed

pkg/sdn/api/validation/validation.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func ValidateHostSubnet(hs *sdnapi.HostSubnet) field.ErrorList {
9393
if hs.Subnet == "" {
9494
// check if annotation exists, then let the Subnet field be empty
9595
if _, ok := hs.Annotations[sdnapi.AssignHostSubnetAnnotation]; !ok {
96-
allErrs = append(allErrs, field.Invalid(field.NewPath("subnet"), hs.Subnet, "Field cannot be empty"))
96+
allErrs = append(allErrs, field.Invalid(field.NewPath("subnet"), hs.Subnet, "field cannot be empty"))
9797
}
9898
} else {
9999
_, _, err := net.ParseCIDR(hs.Subnet)

pkg/sdn/plugin/cniserver/cniserver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func cniRequestToPodRequest(r *http.Request) (*PodRequest, error) {
182182

183183
cmd, ok := cr.Env["CNI_COMMAND"]
184184
if !ok {
185-
return nil, fmt.Errorf("Unexpected or missing CNI_COMMAND")
185+
return nil, fmt.Errorf("unexpected or missing CNI_COMMAND")
186186
}
187187

188188
req := &PodRequest{

pkg/sdn/plugin/cniserver/cniserver_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func TestCNIServer(t *testing.T) {
172172
Config: []byte("{\"cniVersion\": \"0.1.0\",\"name\": \"openshift-sdn\",\"type\": \"openshift-sdn\"}"),
173173
},
174174
result: nil,
175-
errorPrefix: "Unexpected or missing CNI_COMMAND",
175+
errorPrefix: "unexpected or missing CNI_COMMAND",
176176
},
177177
}
178178

pkg/sdn/plugin/common.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ type NetworkInfo struct {
4141
func parseNetworkInfo(clusterNetwork string, serviceNetwork string) (*NetworkInfo, error) {
4242
_, cn, err := net.ParseCIDR(clusterNetwork)
4343
if err != nil {
44-
return nil, fmt.Errorf("Failed to parse ClusterNetwork CIDR %s: %v", clusterNetwork, err)
44+
return nil, fmt.Errorf("failed to parse ClusterNetwork CIDR %s: %v", clusterNetwork, err)
4545
}
4646
_, sn, err := net.ParseCIDR(serviceNetwork)
4747
if err != nil {
48-
return nil, fmt.Errorf("Failed to parse ServiceNetwork CIDR %s: %v", serviceNetwork, err)
48+
return nil, fmt.Errorf("failed to parse ServiceNetwork CIDR %s: %v", serviceNetwork, err)
4949
}
5050

5151
return &NetworkInfo{
@@ -56,21 +56,21 @@ func parseNetworkInfo(clusterNetwork string, serviceNetwork string) (*NetworkInf
5656

5757
func (ni *NetworkInfo) validateNodeIP(nodeIP string) error {
5858
if nodeIP == "" || nodeIP == "127.0.0.1" {
59-
return fmt.Errorf("Invalid node IP %q", nodeIP)
59+
return fmt.Errorf("invalid node IP %q", nodeIP)
6060
}
6161

6262
// Ensure each node's NodeIP is not contained by the cluster network,
6363
// which could cause a routing loop. (rhbz#1295486)
6464
ipaddr := net.ParseIP(nodeIP)
6565
if ipaddr == nil {
66-
return fmt.Errorf("Failed to parse node IP %s", nodeIP)
66+
return fmt.Errorf("failed to parse node IP %s", nodeIP)
6767
}
6868

6969
if ni.ClusterNetwork.Contains(ipaddr) {
70-
return fmt.Errorf("Node IP %s conflicts with cluster network %s", nodeIP, ni.ClusterNetwork.String())
70+
return fmt.Errorf("node IP %s conflicts with cluster network %s", nodeIP, ni.ClusterNetwork.String())
7171
}
7272
if ni.ServiceNetwork.Contains(ipaddr) {
73-
return fmt.Errorf("Node IP %s conflicts with service network %s", nodeIP, ni.ServiceNetwork.String())
73+
return fmt.Errorf("node IP %s conflicts with service network %s", nodeIP, ni.ServiceNetwork.String())
7474
}
7575

7676
return nil

pkg/sdn/plugin/controller.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ func (plugin *OsdnNode) getLocalSubnet() (string, error) {
7575
}
7676
})
7777
if err != nil {
78-
return "", fmt.Errorf("Failed to get subnet for this host: %s, error: %v", plugin.hostName, err)
78+
return "", fmt.Errorf("failed to get subnet for this host: %s, error: %v", plugin.hostName, err)
7979
}
8080

8181
if err = plugin.networkInfo.validateNodeIP(subnet.HostIP); err != nil {
82-
return "", fmt.Errorf("Failed to validate own HostSubnet: %v", err)
82+
return "", fmt.Errorf("failed to validate own HostSubnet: %v", err)
8383
}
8484

8585
return subnet.Subnet, nil
@@ -347,11 +347,11 @@ func (plugin *OsdnNode) SetupSDN() (bool, error) {
347347
// Enable IP forwarding for ipv4 packets
348348
err = sysctl.SetSysctl("net/ipv4/ip_forward", 1)
349349
if err != nil {
350-
return false, fmt.Errorf("Could not enable IPv4 forwarding: %s", err)
350+
return false, fmt.Errorf("could not enable IPv4 forwarding: %s", err)
351351
}
352352
err = sysctl.SetSysctl(fmt.Sprintf("net/ipv4/conf/%s/forwarding", TUN), 1)
353353
if err != nil {
354-
return false, fmt.Errorf("Could not enable IPv4 forwarding on %s: %s", TUN, err)
354+
return false, fmt.Errorf("could not enable IPv4 forwarding on %s: %s", TUN, err)
355355
}
356356

357357
// Table 253: rule version; note action is hex bytes separated by '.'

pkg/sdn/plugin/egress_network_policy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (plugin *OsdnNode) watchEgressNetworkPolicies() {
4141

4242
vnid, err := plugin.policy.GetVNID(policy.Namespace)
4343
if err != nil {
44-
return fmt.Errorf("Could not find netid for namespace %q: %v", policy.Namespace, err)
44+
return fmt.Errorf("could not find netid for namespace %q: %v", policy.Namespace, err)
4545
}
4646

4747
policies := plugin.egressPolicies[vnid]

pkg/sdn/plugin/eventqueue_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ func TestEventQueueDeletedFinalStateUnknown(t *testing.T) {
620620
called = true
621621
if _, ok := delta.Object.(cache.DeletedFinalStateUnknown); !ok {
622622
// Capture error that Pop() logs the error but doesn't return
623-
processErr = fmt.Errorf("Unexpected item type %T", delta.Object)
623+
processErr = fmt.Errorf("unexpected item type %T", delta.Object)
624624
return processErr
625625
}
626626
return nil
@@ -649,7 +649,7 @@ func TestEventQueueDeletedFinalStateUnknown(t *testing.T) {
649649
called = true
650650
if _, ok := delta.Object.(*api.ObjectMeta); !ok {
651651
// Capture error that Pop() logs the error but doesn't return
652-
processErr = fmt.Errorf("Unexpected item type %T", delta.Object)
652+
processErr = fmt.Errorf("unexpected item type %T", delta.Object)
653653
return processErr
654654
}
655655
return nil

pkg/sdn/plugin/master.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -120,32 +120,32 @@ func (master *OsdnMaster) validateNetworkConfig() error {
120120
// Ensure cluster and service network don't overlap with host networks
121121
for _, ipNet := range hostIPNets {
122122
if ipNet.Contains(ni.ClusterNetwork.IP) {
123-
errList = append(errList, fmt.Errorf("Error: Cluster IP: %s conflicts with host network: %s", ni.ClusterNetwork.IP.String(), ipNet.String()))
123+
errList = append(errList, fmt.Errorf("cluster IP: %s conflicts with host network: %s", ni.ClusterNetwork.IP.String(), ipNet.String()))
124124
}
125125
if ni.ClusterNetwork.Contains(ipNet.IP) {
126-
errList = append(errList, fmt.Errorf("Error: Host network with IP: %s conflicts with cluster network: %s", ipNet.IP.String(), ni.ClusterNetwork.String()))
126+
errList = append(errList, fmt.Errorf("host network with IP: %s conflicts with cluster network: %s", ipNet.IP.String(), ni.ClusterNetwork.String()))
127127
}
128128
if ipNet.Contains(ni.ServiceNetwork.IP) {
129-
errList = append(errList, fmt.Errorf("Error: Service IP: %s conflicts with host network: %s", ni.ServiceNetwork.String(), ipNet.String()))
129+
errList = append(errList, fmt.Errorf("service IP: %s conflicts with host network: %s", ni.ServiceNetwork.String(), ipNet.String()))
130130
}
131131
if ni.ServiceNetwork.Contains(ipNet.IP) {
132-
errList = append(errList, fmt.Errorf("Error: Host network with IP: %s conflicts with service network: %s", ipNet.IP.String(), ni.ServiceNetwork.String()))
132+
errList = append(errList, fmt.Errorf("host network with IP: %s conflicts with service network: %s", ipNet.IP.String(), ni.ServiceNetwork.String()))
133133
}
134134
}
135135

136136
// Ensure each host subnet is within the cluster network
137137
subnets, err := master.osClient.HostSubnets().List(kapi.ListOptions{})
138138
if err != nil {
139-
return fmt.Errorf("Error in initializing/fetching subnets: %v", err)
139+
return fmt.Errorf("error in initializing/fetching subnets: %v", err)
140140
}
141141
for _, sub := range subnets.Items {
142142
subnetIP, _, _ := net.ParseCIDR(sub.Subnet)
143143
if subnetIP == nil {
144-
errList = append(errList, fmt.Errorf("Failed to parse network address: %s", sub.Subnet))
144+
errList = append(errList, fmt.Errorf("failed to parse network address: %s", sub.Subnet))
145145
continue
146146
}
147147
if !ni.ClusterNetwork.Contains(subnetIP) {
148-
errList = append(errList, fmt.Errorf("Error: Existing node subnet: %s is not part of cluster network: %s", sub.Subnet, ni.ClusterNetwork.String()))
148+
errList = append(errList, fmt.Errorf("existing node subnet: %s is not part of cluster network: %s", sub.Subnet, ni.ClusterNetwork.String()))
149149
}
150150
}
151151

@@ -156,7 +156,7 @@ func (master *OsdnMaster) validateNetworkConfig() error {
156156
}
157157
for _, svc := range services.Items {
158158
if !ni.ServiceNetwork.Contains(net.ParseIP(svc.Spec.ClusterIP)) {
159-
errList = append(errList, fmt.Errorf("Error: Existing service with IP: %s is not part of service network: %s", svc.Spec.ClusterIP, ni.ServiceNetwork.String()))
159+
errList = append(errList, fmt.Errorf("existing service with IP: %s is not part of service network: %s", svc.Spec.ClusterIP, ni.ServiceNetwork.String()))
160160
}
161161
}
162162

pkg/sdn/plugin/node.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ func (node *OsdnNode) Start() error {
198198
var err error
199199
node.networkInfo, err = getNetworkInfo(node.osClient)
200200
if err != nil {
201-
return fmt.Errorf("Failed to get network information: %v", err)
201+
return fmt.Errorf("failed to get network information: %v", err)
202202
}
203203

204204
nodeIPTables := newNodeIPTables(node.networkInfo.ClusterNetwork.String(), node.iptablesSyncPeriod)
205205
if err = nodeIPTables.Setup(); err != nil {
206-
return fmt.Errorf("Failed to set up iptables: %v", err)
206+
return fmt.Errorf("failed to set up iptables: %v", err)
207207
}
208208

209209
node.localSubnetCIDR, err = node.getLocalSubnet()

pkg/sdn/plugin/node_iptables.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (n *NodeIPTables) syncIPTableRules() error {
8282
for _, rule := range rules {
8383
_, err := n.ipt.EnsureRule(iptables.Prepend, iptables.Table(rule.table), iptables.Chain(rule.chain), rule.args...)
8484
if err != nil {
85-
return fmt.Errorf("Failed to ensure rule %v exists: %v", rule, err)
85+
return fmt.Errorf("failed to ensure rule %v exists: %v", rule, err)
8686
}
8787
}
8888
return nil

pkg/sdn/plugin/pod_linux.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func (m *podManager) getNonExitedPods() ([]*kcontainer.Pod, error) {
287287
ret := []*kcontainer.Pod{}
288288
pods, err := m.host.GetRuntime().GetPods(true)
289289
if err != nil {
290-
return nil, fmt.Errorf("Failed to retrieve pods from runtime: %v", err)
290+
return nil, fmt.Errorf("failed to retrieve pods from runtime: %v", err)
291291
}
292292
for _, p := range pods {
293293
if podIsExited(p) {

pkg/sdn/plugin/proxy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (proxy *OsdnProxy) Start(baseHandler pconfig.EndpointsConfigHandler) error
5858

5959
policies, err := proxy.osClient.EgressNetworkPolicies(kapi.NamespaceAll).List(kapi.ListOptions{})
6060
if err != nil {
61-
return fmt.Errorf("Could not get EgressNetworkPolicies: %s", err)
61+
return fmt.Errorf("could not get EgressNetworkPolicies: %s", err)
6262
}
6363
for _, policy := range policies.Items {
6464
proxy.updateNetworkPolicy(policy)

pkg/sdn/plugin/subnets.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (master *OsdnMaster) addNode(nodeName string, nodeIP string, hsAnnotations
6464
sub.HostIP = nodeIP
6565
sub, err = master.osClient.HostSubnets().Update(sub)
6666
if err != nil {
67-
return fmt.Errorf("Error updating subnet %s for node %s: %v", sub.Subnet, nodeName, err)
67+
return fmt.Errorf("error updating subnet %s for node %s: %v", sub.Subnet, nodeName, err)
6868
}
6969
log.Infof("Updated HostSubnet %s", hostSubnetToString(sub))
7070
return nil
@@ -74,7 +74,7 @@ func (master *OsdnMaster) addNode(nodeName string, nodeIP string, hsAnnotations
7474
// Create new subnet
7575
sn, err := master.subnetAllocator.GetNetwork()
7676
if err != nil {
77-
return fmt.Errorf("Error allocating network for node %s: %v", nodeName, err)
77+
return fmt.Errorf("error allocating network for node %s: %v", nodeName, err)
7878
}
7979

8080
sub = &osapi.HostSubnet{
@@ -87,7 +87,7 @@ func (master *OsdnMaster) addNode(nodeName string, nodeIP string, hsAnnotations
8787
sub, err = master.osClient.HostSubnets().Create(sub)
8888
if err != nil {
8989
master.subnetAllocator.ReleaseNetwork(sn)
90-
return fmt.Errorf("Error creating subnet %s for node %s: %v", sn.String(), nodeName, err)
90+
return fmt.Errorf("error creating subnet %s for node %s: %v", sn.String(), nodeName, err)
9191
}
9292
log.Infof("Created HostSubnet %s", hostSubnetToString(sub))
9393
return nil
@@ -96,11 +96,11 @@ func (master *OsdnMaster) addNode(nodeName string, nodeIP string, hsAnnotations
9696
func (master *OsdnMaster) deleteNode(nodeName string) error {
9797
sub, err := master.osClient.HostSubnets().Get(nodeName)
9898
if err != nil {
99-
return fmt.Errorf("Error fetching subnet for node %q for deletion: %v", nodeName, err)
99+
return fmt.Errorf("error fetching subnet for node %q for deletion: %v", nodeName, err)
100100
}
101101
err = master.osClient.HostSubnets().Delete(nodeName)
102102
if err != nil {
103-
return fmt.Errorf("Error deleting subnet %v for node %q: %v", sub, nodeName, err)
103+
return fmt.Errorf("error deleting subnet %v for node %q: %v", sub, nodeName, err)
104104
}
105105

106106
log.Infof("Deleted HostSubnet %s", hostSubnetToString(sub))
@@ -158,7 +158,7 @@ func (master *OsdnMaster) clearInitialNodeNetworkUnavailableCondition(node *kapi
158158
return err
159159
})
160160
if resultErr != nil {
161-
utilruntime.HandleError(fmt.Errorf("Status update failed for local node: %v", resultErr))
161+
utilruntime.HandleError(fmt.Errorf("status update failed for local node: %v", resultErr))
162162
} else if cleared {
163163
log.Infof("Cleared node NetworkUnavailable/NoRouteCreated condition for %s", node.ObjectMeta.Name)
164164
}
@@ -197,7 +197,7 @@ func (master *OsdnMaster) watchNodes() {
197197

198198
err = master.deleteNode(name)
199199
if err != nil {
200-
return fmt.Errorf("Error deleting node %s: %v", name, err)
200+
return fmt.Errorf("error deleting node %s: %v", name, err)
201201
}
202202
}
203203
return nil
@@ -253,7 +253,7 @@ func (master *OsdnMaster) watchSubnets() {
253253
// release the subnet
254254
_, ipnet, err := net.ParseCIDR(subnet)
255255
if err != nil {
256-
return fmt.Errorf("Error parsing subnet %q for node %q for deletion: %v", subnet, name, err)
256+
return fmt.Errorf("error parsing subnet %q for node %q for deletion: %v", subnet, name, err)
257257
}
258258
master.subnetAllocator.ReleaseNetwork(ipnet)
259259
}

pkg/sdn/plugin/vnids_master.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,11 @@ func (master *OsdnMaster) watchNamespaces() {
288288
switch delta.Type {
289289
case cache.Sync, cache.Added, cache.Updated:
290290
if err := master.vnids.assignVNID(master.osClient, name); err != nil {
291-
return fmt.Errorf("Error assigning netid: %v", err)
291+
return fmt.Errorf("error assigning netid: %v", err)
292292
}
293293
case cache.Deleted:
294294
if err := master.vnids.revokeVNID(master.osClient, name); err != nil {
295-
return fmt.Errorf("Error revoking netid: %v", err)
295+
return fmt.Errorf("error revoking netid: %v", err)
296296
}
297297
}
298298
return nil
@@ -309,7 +309,7 @@ func (master *OsdnMaster) watchNetNamespaces() {
309309
case cache.Sync, cache.Added, cache.Updated:
310310
err := master.vnids.updateVNID(master.osClient, netns)
311311
if err != nil {
312-
return fmt.Errorf("Error updating netid: %v", err)
312+
return fmt.Errorf("error updating netid: %v", err)
313313
}
314314
}
315315
return nil

pkg/sdn/plugin/vnids_node.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (vmap *nodeVNIDMap) GetVNID(name string) (uint32, error) {
7373
if id, ok := vmap.ids[name]; ok {
7474
return id, nil
7575
}
76-
return 0, fmt.Errorf("Failed to find netid for namespace: %s in vnid map", name)
76+
return 0, fmt.Errorf("failed to find netid for namespace: %s in vnid map", name)
7777
}
7878

7979
func (vmap *nodeVNIDMap) GetMulticastEnabled(id uint32) bool {
@@ -113,7 +113,7 @@ func (vmap *nodeVNIDMap) WaitAndGetVNID(name string) (uint32, error) {
113113
if err == nil {
114114
return id, nil
115115
} else {
116-
return 0, fmt.Errorf("Failed to find netid for namespace: %s in vnid map", name)
116+
return 0, fmt.Errorf("failed to find netid for namespace: %s in vnid map", name)
117117
}
118118
}
119119

@@ -137,7 +137,7 @@ func (vmap *nodeVNIDMap) unsetVNID(name string) (id uint32, err error) {
137137

138138
id, found := vmap.ids[name]
139139
if !found {
140-
return 0, fmt.Errorf("Failed to find netid for namespace: %s in vnid map", name)
140+
return 0, fmt.Errorf("failed to find netid for namespace: %s in vnid map", name)
141141
}
142142
vmap.removeNamespaceFromSet(name, id)
143143
delete(vmap.ids, name)

0 commit comments

Comments
 (0)