-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add support for attaching TCX, TC and XDP programs inside containers. #345
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #345 +/- ##
==========================================
- Coverage 27.66% 27.10% -0.57%
==========================================
Files 87 87
Lines 7503 7711 +208
==========================================
+ Hits 2076 2090 +14
- Misses 5227 5412 +185
- Partials 200 209 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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. I'm testing now, but no real issues.
@@ -97,12 +97,9 @@ spec: | |||
name: mountpoint-dir | |||
- mountPath: /tmp | |||
name: tmp-dir | |||
# host-proc is used to attach programs inside of containers | |||
# Used to attach programs inside of containers |
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.
The changes were added in commit 1, then backed out in commit 2. I assume this was on purpose and the daemonset doesn't need this volume?
} | ||
} else { | ||
for _, iface := range r.interfaces { | ||
attachPoint := iface + "-" + r.currentTcProgram.Spec.Direction |
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 like patterns, easier to follow. Can you make this of the form attachPoint := fmt.Sprintf("%s-%s", ...
like the previous attachPoint creations? Just for readability. Same for other files that do this.
@anfredette, this pull request is now in conflict and requires a rebase. |
Signed-off-by: Andre Fredette <afredette@redhat.com>
GetPrimaryNodeInterface() only finds the primary "node" interface, which may or may not be the name of the primary interface inside of a container. Signed-off-by: Andre Fredette <afredette@redhat.com>
b6a6061
to
d5cb7ad
Compare
…bpfman#345) * Add ContainerSelector to tc, tcx, and xdp programs * Add netns support for TCX, TC and XDP programs. GetPrimaryNodeInterface() only finds the primary "node" interface, which may or may not be the name of the primary interface inside of a container. Signed-off-by: Andre Fredette <afredette@redhat.com>
To achieve this support, an optional container selector has been added to the TCX, TC and XDP attach info. The agent code then finds the network namespaces of the containers and passes them to bpfman using code that already existed for attaching uprobes inside containers.
One caveat is that
GetPrimaryNodeInterface()
only finds the primary "node" interface, which may or may not be the name of the primary interface inside of a container. As a side note, it probably works for many cases, especially when running on kind, where both the node's primary interface and containers' primary interfaces are typically named "eth0".I propose that we leave it as-is for now, and either generalize this function to
GetPrimaryInterface()
, or add aGetPrimaryPodInterface()
when we implement interface discovery. We can also expand the interface selection options to include wildcards and regular expressions at that time.