Skip to content

Commit

Permalink
Merge pull request #3942 from tssurya/eip-cpip-fix-azure
Browse files Browse the repository at this point in the history
EIP: Fix CPIP updates on cloud environments
  • Loading branch information
trozet committed Oct 5, 2023
2 parents 1c9f73d + daafa09 commit 56a9e30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion go-controller/pkg/clustermanager/egressip_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ func (eIPC *egressIPClusterController) executeCloudPrivateIPConfigOps(egressIPNa
// if the object already exists and the request is for a different node, that's an error
} else if op.toAdd != "" {
if err == nil {
// Do not add if object is being deleted; either retry the add (if this was an update) OR (if this was a perm-delete)
// we will retry till we exhaust our retry count
if cloudPrivateIPConfig.GetDeletionTimestamp() != nil && !cloudPrivateIPConfig.GetDeletionTimestamp().IsZero() {
return fmt.Errorf("cloud update request failed, CloudPrivateIPConfig: %s is being deleted", cloudPrivateIPConfigName)
}
if op.toAdd == cloudPrivateIPConfig.Spec.Node {
klog.Infof("CloudPrivateIPConfig: %s already assigned to node: %s", cloudPrivateIPConfigName, cloudPrivateIPConfig.Spec.Node)
continue
Expand Down Expand Up @@ -630,7 +635,10 @@ func checkEgressNodesReachabilityIterate(eIPC *egressIPClusterController) {
}
} else {
klog.Infof("Node: %s is detected as reachable and ready again, adding it to egress assignment", nodeName)
if err := eIPC.addEgressNode(nodeName); err != nil {
nodeToAdd, err := eIPC.watchFactory.GetNode(nodeName)
if err != nil {
klog.Errorf("Node: %s is detected as reachable and ready again, but could not re-assign egress IPs, err: %v", nodeName, err)
} else if err := eIPC.retryEgressNodes.AddRetryObjWithAddNoBackoff(nodeToAdd); err != nil {
klog.Errorf("Node: %s is detected as reachable and ready again, but could not re-assign egress IPs, err: %v", nodeName, err)
}
}
Expand Down
2 changes: 2 additions & 0 deletions go-controller/pkg/clustermanager/egressip_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,8 @@ var _ = ginkgo.Describe("OVN cluster-manager EgressIP Operations", func() {
// egress IP should get assigned on the next checkEgressNodesReachabilityIterate call
// explicitly call check reachability, periodic checker is not active
checkEgressNodesReachabilityIterate(fakeClusterManagerOVN.eIPC)
// this will trigger an immediate add retry for the node which we need to simulate for this test
fakeClusterManagerOVN.eIPC.retryEgressNodes.RequestRetryObjs()
gomega.Eventually(getEgressIPStatusLen(eIP1.Name)).Should(gomega.Equal(1))

return nil
Expand Down

0 comments on commit 56a9e30

Please sign in to comment.