Skip to content

Commit

Permalink
Merge pull request kube-vip#670 from thebsdbox/lint_fix_routing
Browse files Browse the repository at this point in the history
Fixes to linting for routing table
  • Loading branch information
thebsdbox authored Dec 3, 2023
2 parents 4792424 + b0f7aa1 commit 6a642c7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
Expand Down
18 changes: 9 additions & 9 deletions pkg/cluster/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,16 @@ func (cluster *Cluster) StartLoadBalancerService(c *kubevip.Config, bgp *bgp.Ser
// Stop the Arp context if it is running
cancelArp()

if c.EnableRoutingTable {
err = cluster.Network.DeleteRoute()
if err != nil {
log.Warnf("%v", err)
}
}

close(cluster.completed)
return
if c.EnableRoutingTable {
err = cluster.Network.DeleteRoute()
if err != nil {
log.Warnf("%v", err)
}

close(cluster.completed)
return
}

log.Info("[LOADBALANCER] Stopping load balancers")
log.Infof("[VIP] Releasing the Virtual IP [%s]", c.VIP)
err = cluster.Network.DeleteIP()
Expand Down
12 changes: 6 additions & 6 deletions pkg/vip/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ func NewConfig(address string, iface string, subnet string, isDDNS bool, tableID

// AddRoute - Add an IP address to a route table
func (configurator *network) AddRoute() error {
route_scope := netlink.SCOPE_UNIVERSE
routeScope := netlink.SCOPE_UNIVERSE
if configurator.routingTableType == unix.RTN_LOCAL {
route_scope = netlink.SCOPE_LINK
routeScope = netlink.SCOPE_LINK
}
route := &netlink.Route{
Scope: route_scope,
Scope: routeScope,
Dst: configurator.address.IPNet,
LinkIndex: configurator.link.Attrs().Index,
Table: configurator.routeTable,
Expand All @@ -140,12 +140,12 @@ func (configurator *network) AddRoute() error {

// DeleteRoute - Delete an IP address from a route table
func (configurator *network) DeleteRoute() error {
route_scope := netlink.SCOPE_UNIVERSE
routeScope := netlink.SCOPE_UNIVERSE
if configurator.routingTableType == unix.RTN_LOCAL {
route_scope = netlink.SCOPE_LINK
routeScope = netlink.SCOPE_LINK
}
route := &netlink.Route{
Scope: route_scope,
Scope: routeScope,
Dst: configurator.address.IPNet,
LinkIndex: configurator.link.Attrs().Index,
Table: configurator.routeTable,
Expand Down

0 comments on commit 6a642c7

Please sign in to comment.