-
Notifications
You must be signed in to change notification settings - Fork 185
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
Socket enricher for containerized gadgets #1997
Conversation
559afd2
to
22478a3
Compare
I rebased after #1825. I fixed some TODOs but left some for future PRs (see updated PR description). |
pkg/gadgets/run/tracer/tracer.go
Outdated
@@ -176,6 +180,21 @@ func (t *Tracer) installTracer() error { | |||
} | |||
} | |||
|
|||
// Only create socket enricher if this is used by the tracer | |||
for _, m := range t.spec.Maps { | |||
if m.Name == networktracer.SocketsMapName { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment, networktracer.SocketsMapName
is defined as follows:
SocketsMapName = "sockets"
What do you think about renaming it to "gadget_sockets" so that it is namespaced correctly for third-party gadget authors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I think we must rename that to avoid collisions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed it with the "ig_" prefix like some other maps and progs.
I also moved the constant from the networktracer
package to the socketenricher
package where it semantically belongs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed it with the "ig_" prefix like some other maps and progs.
I'm trying to use gadget_
everywhere as in https://github.com/inspektor-gadget/inspektor-gadget/blob/main/pkg/gadgets/common/mntns_filter.h for the API. I think we're using ig_
in the programs because the length restriction. However I don't have a preference in any of them, but I'd prefer everything aligned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I renamed to gadget_sockets.
I will merge once the CI finishes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Some comments, specially regarding the filtering capabilities of this gadget.
pkg/gadgets/run/tracer/tracer.go
Outdated
@@ -176,6 +180,21 @@ func (t *Tracer) installTracer() error { | |||
} | |||
} | |||
|
|||
// Only create socket enricher if this is used by the tracer | |||
for _, m := range t.spec.Maps { | |||
if m.Name == networktracer.SocketsMapName { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I think we must rename that to avoid collisions.
22478a3
to
3b6ea57
Compare
Thanks for the review. I've update the PR and it is ready for another review round. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one comment about the naming of the map, but it's not blocking. LGTM, thanks!
3b6ea57
to
46c61a0
Compare
Before this patch, the socket enricher was only available for built-in gadgets. This patch adds support for containerized gadgets. As example, it uses the tcpretrans gadget. Signed-off-by: Alban Crequy <albancrequy@linux.microsoft.com>
46c61a0
to
f5be9f7
Compare
Socket enricher for containerized gadgets
Before this patch, the socket enricher was only available for built-in gadgets. This patch adds support for containerized gadgets.
As example, it uses the tcpretrans gadget.
How to use
Testing done
Generate events with:
Observe events with:
Or:
TODO:
TODO unrelated to this PR (will be fixed in another PR):
Fixes #1920