Skip to content

Commit 0d5973f

Browse files
committed
fix(slr): deleting old entries from ipmapping to avoid clogging loadbalancer
Signed-off-by: SkalaNetworks <[email protected]>
1 parent 28ea867 commit 0d5973f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pkg/ovs/ovn-nb-load_balancer.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,24 @@ func (c *OVNNbClient) LoadBalancerUpdateIPPortMapping(lbName, vipEndpoint string
535535
ops, err := c.LoadBalancerOp(
536536
lbName,
537537
func(lb *ovnnb.LoadBalancer) []model.Mutation {
538+
// Delete from the IPPortMappings any outdated mapping
539+
mappingToDelete := make(map[string]string)
540+
for portIP, portMapVip := range lb.IPPortMappings {
541+
if _, ok := ipPortMappings[portIP]; !ok {
542+
mappingToDelete[portIP] = portMapVip
543+
}
544+
}
545+
546+
if len(mappingToDelete) > 0 {
547+
klog.Infof("deleting outdated entry from ipportmapping %v", mappingToDelete)
548+
}
549+
538550
return []model.Mutation{
551+
{
552+
Field: &lb.IPPortMappings,
553+
Value: mappingToDelete,
554+
Mutator: ovsdb.MutateOperationDelete,
555+
},
539556
{
540557
Field: &lb.IPPortMappings,
541558
Value: ipPortMappings,

0 commit comments

Comments
 (0)