From b0f7aa169860a4022329bb5be0f883a1830d89f9 Mon Sep 17 00:00:00 2001 From: Dan Finneran Date: Sun, 3 Dec 2023 10:32:51 +0000 Subject: [PATCH] Fixes to linting for routing table Signed-off-by: Dan Finneran --- go.sum | 1 + pkg/cluster/service.go | 18 +++++++++--------- pkg/vip/address.go | 12 ++++++------ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/go.sum b/go.sum index 052cc0fb..1795cd49 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/pkg/cluster/service.go b/pkg/cluster/service.go index 84c6c01d..d57264ba 100644 --- a/pkg/cluster/service.go +++ b/pkg/cluster/service.go @@ -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() diff --git a/pkg/vip/address.go b/pkg/vip/address.go index 193c11ec..086b76a3 100644 --- a/pkg/vip/address.go +++ b/pkg/vip/address.go @@ -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, @@ -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,