Skip to content

Commit

Permalink
agent: fix nodeport service snat
Browse files Browse the repository at this point in the history
We snat when endpoint is not local, no need to do it when it is local.
This is for the returned traffic to pass by the node.
  • Loading branch information
hedibouattour authored and sknat committed Jul 26, 2023
1 parent c7cf3ef commit c8a2e7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions calico-vpp-agent/services/service_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ func buildCnatEntryForServicePort(servicePort *v1.ServicePort, service *v1.Servi
},
Flags: flags,
}
/* In nodeports, we also sNAT */
if isNodePort {
/* In nodeports, we need to sNAT when endpoint is not local to have a symmetric traffic */
if isNodePort && !isEndpointAddressLocal(&endpointAddress) {
backend.SrcEndpoint.IP = serviceIP
}
backends = append(backends, backend)
Expand Down

0 comments on commit c8a2e7c

Please sign in to comment.