From 2a47fd96f8ba3cee074cd96c44e8d42428a2d1c2 Mon Sep 17 00:00:00 2001 From: bobz965 Date: Wed, 30 Oct 2024 02:31:31 +0000 Subject: [PATCH] fix: cache eip should not update Signed-off-by: bobz965 --- pkg/controller/ovn_eip.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/controller/ovn_eip.go b/pkg/controller/ovn_eip.go index 65400ca3355..3abdba9289f 100644 --- a/pkg/controller/ovn_eip.go +++ b/pkg/controller/ovn_eip.go @@ -125,14 +125,15 @@ func (c *Controller) handleAddOvnEip(key string) error { return err } } + var natType string if cachedEip.Spec.Type == "" { // the eip only used by nat: fip, dnat, snat - cachedEip.Spec.Type = util.OvnEipTypeNAT + natType = util.OvnEipTypeNAT } else if cachedEip.Spec.Type != util.OvnEipTypeLRP && cachedEip.Spec.Type != util.OvnEipTypeLSP { - cachedEip.Spec.Type = util.OvnEipTypeNAT + natType = util.OvnEipTypeNAT } - if err = c.createOrUpdateOvnEipCR(key, subnet.Name, v4ip, v6ip, mac, cachedEip.Spec.Type); err != nil { + if err = c.createOrUpdateOvnEipCR(key, subnet.Name, v4ip, v6ip, mac, natType); err != nil { klog.Errorf("failed to create or update ovn eip '%s', %v", cachedEip.Name, err) return err }