From 473f7e44b12a91b6ea4bd5c10726e47bb5e4d36e Mon Sep 17 00:00:00 2001 From: backguynn Date: Fri, 1 Dec 2023 12:15:13 +0900 Subject: [PATCH 1/2] support external loxilb-lb master --- cmd/loxilb-agent/agent.go | 1 + pkg/agent/manager/loadbalancer/loadbalancer.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/loxilb-agent/agent.go b/cmd/loxilb-agent/agent.go index 79ca345..07e5c95 100644 --- a/cmd/loxilb-agent/agent.go +++ b/cmd/loxilb-agent/agent.go @@ -182,6 +182,7 @@ func run(o *Options) error { if len(networkConfig.LoxilbURLs) <= 0 { lbManager.DiscoverLoxiLBServices(loxiLBLiveCh, loxiLBPurgeCh) } + lbManager.DiscoverLoxiLBPeerServices(loxiLBLiveCh, loxiLBPurgeCh) if networkConfig.SetRoles != "" { lbManager.SelectLoxiLBRoles(true, loxiLBSelMasterEvent) diff --git a/pkg/agent/manager/loadbalancer/loadbalancer.go b/pkg/agent/manager/loadbalancer/loadbalancer.go index 4002cff..95f585f 100644 --- a/pkg/agent/manager/loadbalancer/loadbalancer.go +++ b/pkg/agent/manager/loadbalancer/loadbalancer.go @@ -1278,9 +1278,11 @@ func (m *Manager) DiscoverLoxiLBServices(loxiLBAliveCh chan *api.LoxiClient, lox } } m.LoxiClients = tmp +} +func (m *Manager) DiscoverLoxiLBPeerServices(loxiLBAliveCh chan *api.LoxiClient, loxiLBPurgeCh chan *api.LoxiClient) { var tmploxilbPeerClients []*api.LoxiClient - ips, err = k8s.GetServiceEndPoints(m.kubeClient, "loxilb-peer-service", "kube-system") + ips, err := k8s.GetServiceEndPoints(m.kubeClient, "loxilb-peer-service", "kube-system") klog.Infof("loxilb-peer-service end-points: %v", ips) if err != nil { ips = []net.IP{} From 43a69f06fd4d32e230d8ef5bdbfc4fb2e4c61f29 Mon Sep 17 00:00:00 2001 From: backguynn Date: Fri, 1 Dec 2023 14:10:43 +0900 Subject: [PATCH 2/2] change set-bgp-global log --- pkg/agent/manager/loadbalancer/loadbalancer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/agent/manager/loadbalancer/loadbalancer.go b/pkg/agent/manager/loadbalancer/loadbalancer.go index 516ef7c..42897ec 100644 --- a/pkg/agent/manager/loadbalancer/loadbalancer.go +++ b/pkg/agent/manager/loadbalancer/loadbalancer.go @@ -1502,9 +1502,9 @@ loop: }(&bgpGlobalCfg) if err == nil { - klog.Infof("set-bgp-global success") + klog.Infof("loxilb(%s) set-bgp-global success", aliveClient.Host) } else { - klog.Infof("set-bgp-global failed(%s)", err) + klog.Infof("loxilb(%s) set-bgp-global failed(%s)", aliveClient.Host, err) m.checkHandleBGPCfgErrors(loxiAliveCh, aliveClient, err) }