Skip to content

Commit

Permalink
egressgw: move endpoint.Networking.Addressing check
Browse files Browse the repository at this point in the history
inside getEndpointMetadata as that's where the rest of the checks for
the received CiliumEndpoint event live

Signed-off-by: Gilberto Bertin <jibi@cilium.io>
  • Loading branch information
jibi committed Jul 10, 2023
1 parent 9fb24de commit a1007ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 4 additions & 0 deletions pkg/egressgateway/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ func getEndpointMetadata(endpoint *k8sTypes.CiliumEndpoint, identityLabels label
return nil, fmt.Errorf("endpoint has no networking metadata")
}

if len(endpoint.Networking.Addressing) == 0 {
return nil, fmt.Errorf("failed to get valid endpoint IPs")
}

for _, pair := range endpoint.Networking.Addressing {
if pair.IPV4 != "" {
ipv4s = append(ipv4s, net.ParseIP(pair.IPV4).To4())
Expand Down
7 changes: 0 additions & 7 deletions pkg/egressgateway/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,6 @@ func (manager *Manager) addEndpoint(id types.NamespacedName) {
// encounter a failure it cannot be retried
delete(manager.pendingEndpointEvents, id)

if len(endpoint.Networking.Addressing) == 0 {
logger.WithError(err).
Error("Failed to get valid endpoint IPs, skipping update to egress policy.")

return
}

if epData, err = getEndpointMetadata(endpoint, identityLabels); err != nil {
logger.WithError(err).
Error("Failed to get valid endpoint metadata, skipping update to egress policy.")
Expand Down

0 comments on commit a1007ef

Please sign in to comment.