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 21, 2024
1 parent eaece02 commit b710677
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/agent/controller/egress/egress_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1168,10 +1168,16 @@ func (c *EgressController) uninstallEgress(egressName string, eState *egressStat
return err
}
}
// Fetch the egress object to record the event.
egress, _ := c.egressLister.Get(egressName)
// Unassign the Egress IP from the local Node if it was assigned by the agent.
if _, err := c.ipAssigner.UnassignIP(eState.egressIP); err != nil {
unassigned, err := c.ipAssigner.UnassignIP(eState.egressIP)
if err != nil {
return err
}
if unassigned {
c.record.Eventf(egress, corev1.EventTypeNormal, "IPUnassigned", "Unassigned Egress %s with IP %s from Node %s", egress.Name, eState.egressIP, c.nodeName)
}
// Remove the Egress's state.
c.deleteEgressState(egressName)
return nil
Expand Down

0 comments on commit b710677

Please sign in to comment.