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

feat: Don't add k8s attributes when source/destination IP matches agent IP #260

Merged
merged 8 commits into from
Oct 3, 2023

Conversation

MikeGoldsmith
Copy link
Contributor

@MikeGoldsmith MikeGoldsmith commented Oct 2, 2023

Which problem is this PR solving?

When processing events, the agent tries to lookup the source and destination IPs in the list of cached k8s pods. However, because the agent uses host network, the agent gets the same IP as the node and any other pods who also use host networking which leads to inconsistent results.

This PR updates event processing to not lookup pod attributes if the source or destination IP matches the agent IP.

Short description of the changes

  • Move cached client utils functions onto the cached client as member funcs
  • Update GetAttr* funcs to also take agent IP
  • Return from getting attributes early if pod IP and agent IP match
  • Add unit test to verify behaviour

How to verify that this has the expected result

When processing an event when the source or dest IPs match the agent IP, k8s attributes are no longer added.

@MikeGoldsmith MikeGoldsmith added the type: enhancement New feature or request label Oct 2, 2023
@MikeGoldsmith MikeGoldsmith requested a review from a team October 2, 2023 13:55
@MikeGoldsmith MikeGoldsmith self-assigned this Oct 2, 2023
@MikeGoldsmith MikeGoldsmith changed the title feat: Don't add k8s attributes when pod IP matches agent IP feat: Don't add k8s attributes when source/destination IP matches agent IP Oct 2, 2023
utils/cached_k8s_client.go Outdated Show resolved Hide resolved
@MikeGoldsmith MikeGoldsmith merged commit d455fd5 into main Oct 3, 2023
3 checks passed
@MikeGoldsmith MikeGoldsmith deleted the mike/ignore-agent-k8s-attrs branch October 3, 2023 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't add k8s metadata for agent's own events
3 participants