Skip to content

Commit 4eac3c5

Browse files
wppzxcoilbeater
authored andcommitted
fix bug for issuse #5597: when slr update, the same vip will be delete too (#5646)
Signed-off-by: wppzxc <[email protected]> (cherry picked from commit 00572c6)
1 parent c2dc2ad commit 4eac3c5

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

pkg/controller/service.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -348,20 +348,19 @@ func (c *Controller) handleUpdateService(svcObject *updateSvcObject) error {
348348

349349
if needUpdateEndpointQueue {
350350
c.addOrUpdateEndpointSliceQueue.Add(key)
351-
352-
// add the svc key which has the same vip
353-
vip, ok := svc.Annotations[util.SwitchLBRuleVipsAnnotation]
354-
if ok {
355-
allSlrs, err := c.switchLBRuleLister.List(labels.Everything())
356-
if err != nil {
357-
klog.Error(err)
358-
return err
359-
}
360-
for _, slr := range allSlrs {
361-
if slr.Spec.Vip == vip {
362-
slrKey := fmt.Sprintf("%s/slr-%s", svc.Namespace, slr.Name)
363-
c.addOrUpdateEndpointSliceQueue.Add(slrKey)
364-
}
351+
}
352+
// add the svc key which has the same vip
353+
vip, ok := svc.Annotations[util.SwitchLBRuleVipsAnnotation]
354+
if ok {
355+
allSlrs, err := c.switchLBRuleLister.List(labels.Everything())
356+
if err != nil {
357+
klog.Error(err)
358+
return err
359+
}
360+
for _, slr := range allSlrs {
361+
if slr.Spec.Vip == vip {
362+
slrKey := fmt.Sprintf("%s/slr-%s", slr.Spec.Namespace, slr.Name)
363+
c.addOrUpdateEndpointSliceQueue.Add(slrKey)
365364
}
366365
}
367366
}

0 commit comments

Comments
 (0)