Skip to content

Commit

Permalink
Record event when EgressIP remains unassigned
Browse files Browse the repository at this point in the history
Modified the code to record an event for case, when an egressIP is
unassigned from a node and is not assigned to any other node.

Signed-off-by: Pulkit Jain <jainpu@vmware.com>
  • Loading branch information
Pulkit Jain committed Feb 22, 2024
1 parent b0cf760 commit d8cee6f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/agent/controller/egress/egress_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1169,9 +1169,14 @@ func (c *EgressController) uninstallEgress(egressName string, eState *egressStat
}
}
// Unassign the Egress IP from the local Node if it was assigned by the agent.
if _, err := c.ipAssigner.UnassignIP(eState.egressIP); err != nil {
egress, _ := c.egressLister.Get(egressName)
unassigned, err := c.ipAssigner.UnassignIP(eState.egressIP)
if err != nil {
return err
}
if unassigned && egress != nil {
c.record.Eventf(egress, corev1.EventTypeNormal, "IPUnassigned", "Unassigned Egress %s with IP %s from Node %s", egressName, eState.egressIP, c.nodeName)
}
// Remove the Egress's state.
c.deleteEgressState(egressName)
return nil
Expand Down

0 comments on commit d8cee6f

Please sign in to comment.