Skip to content

Commit 94c514e

Browse files
fix(slr): support switchlbrules targeting subnets with non-default providers (#5376)
Signed-off-by: SkalaNetworks <contact@skala.network>
1 parent a2db6b1 commit 94c514e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pkg/controller/gc.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,19 @@ func (c *Controller) markAndCleanLSP() error {
395395
vipsMap := strset.NewWithSize(len(vips))
396396
for _, vip := range vips {
397397
if vip.Spec.Type != "" {
398-
portName := ovs.PodNameToPortName(vip.Name, vip.Spec.Namespace, util.OvnProvider)
398+
subnetName := vip.Spec.Subnet
399+
if subnetName == "" {
400+
klog.Errorf("failed to gc vip '%s', subnet should be set", vip.Name)
401+
continue
402+
}
403+
404+
subnet, err := c.subnetsLister.Get(subnetName)
405+
if err != nil {
406+
klog.Errorf("failed to get subnet %s: %v", subnetName, err)
407+
continue
408+
}
409+
410+
portName := ovs.PodNameToPortName(vip.Name, vip.Spec.Namespace, subnet.Spec.Provider)
399411
vipsMap.Add(portName)
400412
}
401413
}

0 commit comments

Comments
 (0)