Skip to content

Commit

Permalink
Make addEgressNode and deleteEgressNode use caches for pulling EIPs
Browse files Browse the repository at this point in the history
Since in the previous commit we will always call addEgressNode
for every kubelet update which is every 10seconds for every node,
we must stop using kapi listing for EIPs since this will not
scale well. Let us use the informer caches to pull EIPs and then
unless there are EIPs that have status.items != spec.items
rest will be shortcircuited in this function.

Signed-off-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>
  • Loading branch information
tssurya committed Feb 16, 2024
1 parent 0ebf9b6 commit ff8d45c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions go-controller/pkg/clustermanager/egressip_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,9 @@ func (eIPC *egressIPClusterController) addEgressNode(nodeName string) error {
// egress IPs which are missing an assignment. If there are, we need to send a
// synthetic update since reconcileEgressIP will then try to assign those IPs to
// this node (if possible)
egressIPs, err := eIPC.kube.GetEgressIPs()
egressIPs, err := eIPC.watchFactory.GetEgressIPs()
if err != nil {
return fmt.Errorf("unable to list EgressIPs, err: %v", err)
return fmt.Errorf("unable to fetch EgressIPs, err: %v", err)
}
for _, egressIP := range egressIPs {
egressIP := *egressIP
Expand Down Expand Up @@ -793,9 +793,9 @@ func (eIPC *egressIPClusterController) deleteEgressNode(nodeName string) error {
// Since the node has been labelled as "not usable" for egress IP
// assignments we need to find all egress IPs which have an assignment to
// it, and move them elsewhere.
egressIPs, err := eIPC.kube.GetEgressIPs()
egressIPs, err := eIPC.watchFactory.GetEgressIPs()
if err != nil {
return fmt.Errorf("unable to list EgressIPs, err: %v", err)
return fmt.Errorf("unable to fetch EgressIPs, err: %v", err)
}
for _, egressIP := range egressIPs {
egressIP := *egressIP
Expand Down

0 comments on commit ff8d45c

Please sign in to comment.