From acebebabcf878daf9e0d2a1d52027c9ac0957068 Mon Sep 17 00:00:00 2001 From: Ashley Dumaine Date: Thu, 23 May 2024 10:19:25 -0400 Subject: [PATCH] add more comments --- cloud/linode/cilium_loadbalancers.go | 5 +++++ cloud/linode/loadbalancers.go | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cloud/linode/cilium_loadbalancers.go b/cloud/linode/cilium_loadbalancers.go index 9f19be0d..7bf8632a 100644 --- a/cloud/linode/cilium_loadbalancers.go +++ b/cloud/linode/cilium_loadbalancers.go @@ -409,6 +409,10 @@ func (l *loadbalancers) ensureCiliumBGPPeeringPolicy(ctx context.Context) error LocalASN: 65001, ExportPodCIDR: ptr.To(true), ServiceSelector: &slimv1.LabelSelector{ + // By default, virtual routers will not announce any services. + // This selector makes it so all services within the cluster are announced. + // See https://docs.cilium.io/en/stable/network/bgp-control-plane/#service-announcements + // for more information. MatchExpressions: []slimv1.LabelSelectorRequirement{{ Key: "somekey", Operator: slimv1.LabelSelectorOpNotIn, @@ -418,6 +422,7 @@ func (l *loadbalancers) ensureCiliumBGPPeeringPolicy(ctx context.Context) error }}, }, } + // As in https://github.com/linode/lelastic, there are 4 peers per DC for i := 1; i <= 4; i++ { neighbor := v2alpha1.CiliumBGPNeighbor{ PeerAddress: fmt.Sprintf("2600:3c0f:%d:34::%d/64", regionID, i), diff --git a/cloud/linode/loadbalancers.go b/cloud/linode/loadbalancers.go index 3f03435b..673f27c9 100644 --- a/cloud/linode/loadbalancers.go +++ b/cloud/linode/loadbalancers.go @@ -208,7 +208,8 @@ func (l *loadbalancers) EnsureLoadBalancer(ctx context.Context, clusterName stri // check for existing CiliumLoadBalancerIPPool for service pool, err := l.getCiliumLBIPPool(ctx, service) - // if the CiliumLoadBalancerIPPool doesn't exist, it's not nil, just empty + // if the CiliumLoadBalancerIPPool doesn't exist, it's not nil, instead an empty struct + // gets returned, so we check if this is so via the Name being empty if pool != nil && pool.Name != "" { klog.Infof("Cilium LB IP pool %s for Service %s ensured", pool.Name, serviceNn) // ingress will be set by Cilium