-
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
gadgets/run: Support iterators programs. #1866
Conversation
In order to support both binary struct printed with commit ddfacce Support for The event struct should have placeholder fields for each text field of arbitrary length:
The bpf program should write an event with bpf_seq_write(), followed by
Then it will be placed in virtual columns:
Columns are difficult to read when they have multilines content. It can
|
3340cde
to
945a31f
Compare
de3ba9f
to
57bf650
Compare
2762f15
to
60aa95d
Compare
57bf650
to
94c214f
Compare
4106265
to
2f602ca
Compare
60aa95d
to
3d10bf5
Compare
3eed5f4
to
591c1b8
Compare
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.
This looks cool!
I have some comments nonetheless:
591c1b8
to
eec1905
Compare
b248be5
to
9516b8d
Compare
ca0715d
to
41e1ea8
Compare
a2787df
to
6ef5a79
Compare
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.
It works perfectly! Thank you!
$ sudo -E ./ig run -c competent_yalow ghcr.io/inspektor-gadget/gadget/snapshot_process:test
INFO[0000] Experimental features enabled
RUNTIME.CONTAINERNAME COMM PID TID PPID UID GID
competent_yalow nginx 63124 63124 63100 0 0
competent_yalow nginx 63172 63172 63124 101 101
competent_yalow nginx 63173 63173 63124 101 101
competent_yalow nginx 63174 63174 63124 101 101
competent_yalow nginx 63175 63175 63124 101 101
competent_yalow nginx 63176 63176 63124 101 101
competent_yalow nginx 63177 63177 63124 101 101
competent_yalow nginx 63178 63178 63124 101 101
competent_yalow nginx 63179 63179 63124 101 101
$ sudo -E ./ig run -c competent_yalow ghcr.io/inspektor-gadget/gadget/snapshot_socket:test
INFO[0000] Experimental features enabled
RUNTIME.CONTAINERNAME SRC DST
competent_yalow [::]:80 [::]:0
competent_yalow 0.0.0.0:80 0.0.0.0:0
b24dbcc
to
937178d
Compare
6160b3d
to
4e66675
Compare
I updated the PR to include |
937178d
to
ced35d7
Compare
Signed-off-by: Mauricio Vásquez <mauriciov@microsoft.com>
4e66675
to
1bb0350
Compare
The gadget type is used to determine the flags that are supported by a given gadget. In the case of containerized gadgets, this changes according to the gadget being run, hence the previous approach wasn't totally right. This commit makes this field more "dyanmic", specifically it: - Introduces logic to get this field according to get gadget's behavior - Adds this to GadgetInfo - Moves flag creation to PreRunE (once gadget type is known) - Introduces the "run" gadget type Signed-off-by: Mauricio Vásquez <mauriciov@microsoft.com>
Signed-off-by: Mauricio Vásquez <mauriciov@microsoft.com>
As in the tracers case, BTF is a key component as it's used to convert binary data to a human readable format. Inspektor Gadget loads and attaches all iterators programs it finds. When the gadget is run, it reads the results of the iterator and uses the BTF information provided above to format the data. Signed-off-by: Mauricio Vásquez <mauriciov@microsoft.com>
Signed-off-by: Mauricio Vásquez <mauriciov@microsoft.com>
Signed-off-by: Mauricio Vásquez <mauriciov@microsoft.com>
Signed-off-by: Mauricio Vásquez <mauriciov@microsoft.com>
Signed-off-by: Mauricio Vásquez <mauriciov@microsoft.com>
1bb0350
to
71e180e
Compare
This PR implements support for bpf iterators in the run command.
The snapshot process and snapshot gadget are ported. They have almost the same functionality, some things that we can't support now are:
How to use
Snapshot process
$ go run -exec "sudo -E" ./cmd/ig/. run --prog @./gadgets/snapshot_process_x86.bpf.o --definition @./gadgets/snapshot_process.yaml INFO[0000] Experimental features enabled RUNTIME.CONTAINERNAME RUNTIME.CONTAINERIMAGENAME TGID PID COMM UID GID PPID local-registry 3092 3092 registry 0 0 3072 buildx_buildkit_amazing_wozniak0 52766 52766 docker-init 0 0 52747 buildx_buildkit_amazing_wozniak0 52790 52790 buildkitd 0 0 52766 test-ig-close 241219 241219 sh 0 0 241168 mycontainer2 306374 306374 sh 0 0 306354 mycontainer2 446574 446574 nc 1001 1005 306374
Snapshot socket
$ go run -exec "sudo -E" ./cmd/ig/. run --prog @./gadgets/snapshot_socket_x86.bpf.o --definition @./gadgets/sna pshot_socket.yaml INFO[0000] Experimental features enabled RUNTIME.CONTAINERNAME RUNTIME.CONTAINERIMAGENAME SRC DST STATE mycontainer2 127.0.0.1:8555 0.0.0.0:0 10
Fixes #1918
TODO:
gadgets: Make gadget type dynamic
approachRelated #1724