Skip to content

Deleting FIP sets EIP to ready #5141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/controller/ovn_dnat.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (c *Controller) handleAddOvnDnatRule(key string) error {
klog.Errorf("failed to patch status for dnat %s, %v", key, err)
return err
}
if err = c.patchOvnEipStatus(eipName, true); err != nil {
if err = c.patchOvnEipStatus(eipName); err != nil {
klog.Errorf("failed to patch status for eip %s, %v", key, err)
return err
}
Expand Down
10 changes: 3 additions & 7 deletions pkg/controller/ovn_eip.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (c *Controller) handleAddOvnEip(key string) error {
}
if cachedEip.Spec.Type != util.OvnEipTypeLSP {
// node ext gw use lsp eip, has a nic on gw node, so left node to make it ready
if err = c.patchOvnEipStatus(key, true); err != nil {
if err = c.patchOvnEipStatus(key); err != nil {
klog.Errorf("failed to patch ovn eip %s: %v", key, err)
return err
}
Expand Down Expand Up @@ -193,7 +193,7 @@ func (c *Controller) handleResetOvnEip(key string) error {
return nil
}
klog.Infof("handle reset ovn eip %s", cachedEip.Name)
if err := c.patchOvnEipStatus(key, true); err != nil {
if err := c.patchOvnEipStatus(key); err != nil {
klog.Errorf("failed to reset nat for eip %s, %v", key, err)
return err
}
Expand Down Expand Up @@ -364,18 +364,14 @@ func (c *Controller) createOrUpdateOvnEipCR(key, subnet, v4ip, v6ip, mac, usageT
return nil
}

func (c *Controller) patchOvnEipStatus(key string, ready bool) error {
func (c *Controller) patchOvnEipStatus(key string) error {
cachedOvnEip, err := c.ovnEipsLister.Get(key)
if err != nil {
klog.Errorf("failed to get cached ovn eip '%s', %v", key, err)
return err
}
ovnEip := cachedOvnEip.DeepCopy()
changed := false
if ovnEip.Status.Ready != ready {
ovnEip.Status.Ready = ready
changed = true
}
if ovnEip.Status.MacAddress == "" {
// not support change ip
ovnEip.Status.V4Ip = cachedOvnEip.Spec.V4Ip
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/ovn_fip.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func (c *Controller) handleAddOvnFip(key string) error {
klog.Errorf("failed to patch status for fip %s, %v", key, err)
return err
}
if err = c.patchOvnEipStatus(eipName, true); err != nil {
if err = c.patchOvnEipStatus(eipName); err != nil {
klog.Errorf("failed to patch status for eip %s, %v", key, err)
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/ovn_snat.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (c *Controller) handleAddOvnSnatRule(key string) error {
klog.Errorf("failed to update status for snat %s, %v", key, err)
return err
}
if err = c.patchOvnEipStatus(eipName, true); err != nil {
if err = c.patchOvnEipStatus(eipName); err != nil {
klog.Errorf("failed to patch status for eip %s, %v", key, err)
return err
}
Expand Down
Loading