Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FlowExporter] More efficient IP checks #6960

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

antoninbas
Copy link
Contributor

@antoninbas antoninbas commented Jan 30, 2025

The FlowExporter in the Agent queries the NodeRouteController to determine whether the source / destination IPs are Pod IPs (NodeIPAM only). Prior to this change, these checks were expensive, involving an indexer lookup and conversions between different IP formats. The new implementation is about 10x faster, and performs no memory allocations.

The new implementation introduces a new set in the NodeRouteController, dedicated to storing all the PodCIDRs in the cluster. While I considered removing the dependency of the FlowExporter on the NodeRouteController altogether, it would have been a much bigger change. Additionally, in the long term, we could consider removing these checks from the FlowExporter altogether, and pushing the logic to the FlowAggregator.

We also make a few additional changes to the FlowExporter:

  • more consistently ignore connections where the source / destination IP is a gateway IP
  • classify Pod-to-Service traffic where the destination IP is not a Pod IP as Pod-to-External
  • log a warning if FlowExporter is enabled alongside AntreaIPAM

The FlowExporter in the Agent queries the NodeRouteController to
determine whether the source / destination IPs are Pod IPs (NodeIPAM
only). Prior to this change, these checks were expensive, involving an
indexer lookup and conversions between different IP formats. The new
implementation is about 10x faster, and peforms no memory allocations.

The new implementation introduces a new set in the NodeRouteController,
dedicated to storing all the PodCIDRs in the cluster. While I considered
removing the dependency of the FlowExporter on the NodeRouteController
altogether, it would have been a much bigger change. Additionally, in
the long term, we could consider removing these checks from the
FlowExporter altogether, and pushing the logic to the FlowAggregator.

We also make a few additional changes to the FlowExporter:
* more consistently ignore connections where the source / destination IP
  is a gateway IP
* classify Pod-to-Service traffic where the destination IP is not a Pod
  IP as Pod-to-External
* log a warning if FlowExporter is enabled alongside AntreaIPAM

Signed-off-by: Antonin Bas <[email protected]>
@antoninbas antoninbas force-pushed the improve-pod-ip-checks-in-flowexporter branch 2 times, most recently from 1d444b8 to 6b4b8e2 Compare January 30, 2025 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant