From 15f194868395ff0a8a11185e36de7524b1a995e5 Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Mon, 25 Mar 2024 14:32:07 +0100 Subject: [PATCH 1/3] gadgets/Makefile: add build parameters This allows to run 'make' with custom build parameters, such as --update-metadata. Signed-off-by: Alban Crequy --- gadgets/Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gadgets/Makefile b/gadgets/Makefile index 00b5df59bb7..d3f088fed55 100644 --- a/gadgets/Makefile +++ b/gadgets/Makefile @@ -28,11 +28,16 @@ all: build build: $(GADGETS) +# GADGET_BUILD_PARAMS can be used to pass additional parameters e.g +# GADGET_BUILD_PARAMS="--update-metadata" make build .PHONY: $(GADGETS) $(GADGETS): @echo "Building $@" - @sudo -E IG_EXPERIMENTAL=true $(IG) image build --builder-image $(BUILDER_IMAGE) \ - -t $(GADGET_REPOSITORY)/$@:$(GADGET_TAG) $@ + @sudo -E IG_EXPERIMENTAL=true $(IG) image build \ + --builder-image $(BUILDER_IMAGE) \ + -t $(GADGET_REPOSITORY)/$@:$(GADGET_TAG) \ + $$GADGET_BUILD_PARAMS \ + $@ .PHONY: push: build From f9dd7f1c80d505e454d16a3b877ba075263aeac4 Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Mon, 25 Mar 2024 14:33:23 +0100 Subject: [PATCH 2/3] ci: fail tests if metadata files not updated Signed-off-by: Alban Crequy --- .github/workflows/inspektor-gadget.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/inspektor-gadget.yml b/.github/workflows/inspektor-gadget.yml index 97ab491be98..6c78eaac360 100644 --- a/.github/workflows/inspektor-gadget.yml +++ b/.github/workflows/inspektor-gadget.yml @@ -369,6 +369,18 @@ jobs: with: category: ig-linux-${{ matrix.platform }} + build-official-image-based-gadgets: + name: Build gadgets + # level: 1 + needs: build-ig + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check if metadata files are updated + run: | + GADGET_BUILD_PARAMS="--update-metadata" make build-gadgets + git diff --exit-code HEAD -- + build-gadget-container-deps: # We only build this dependencies to check if they do not contain CWE. name: Build gadget-container-deps From cf45769097e654eed00d6564829134b9fbbdccd3 Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Mon, 25 Mar 2024 14:13:54 +0100 Subject: [PATCH 3/3] gadgets metadata: update and sync Signed-off-by: Alban Crequy --- gadgets/snapshot_process/gadget.yaml | 5 ++++- gadgets/snapshot_socket/gadget.yaml | 3 +++ gadgets/top_file/gadget.yaml | 5 ++++- gadgets/trace_dns/gadget.yaml | 9 ++++++--- gadgets/trace_exec/gadget.yaml | 3 +++ gadgets/trace_malloc/gadget.yaml | 3 +++ gadgets/trace_mount/gadget.yaml | 3 +++ gadgets/trace_oomkill/gadget.yaml | 8 ++++++-- gadgets/trace_open/gadget.yaml | 7 +++++-- gadgets/trace_signal/gadget.yaml | 23 +++++++++++++---------- gadgets/trace_sni/gadget.yaml | 12 +++++++----- gadgets/trace_tcp/gadget.yaml | 5 ++++- gadgets/trace_tcpconnect/gadget.yaml | 7 +++++-- gadgets/trace_tcpdrop/gadget.yaml | 5 ++++- gadgets/trace_tcpretrans/gadget.yaml | 11 +++++++---- 15 files changed, 77 insertions(+), 32 deletions(-) diff --git a/gadgets/snapshot_process/gadget.yaml b/gadgets/snapshot_process/gadget.yaml index 4fa3f097fbe..71e82760d23 100644 --- a/gadgets/snapshot_process/gadget.yaml +++ b/gadgets/snapshot_process/gadget.yaml @@ -1,5 +1,8 @@ name: snapshot process description: Show running processes +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ snapshotters: processes: structName: process_entry @@ -31,7 +34,7 @@ structs: attributes: template: uid - name: mntns_id - description: 'Mount namespace inode id' + description: Mount namespace inode id attributes: template: ns ebpfParams: diff --git a/gadgets/snapshot_socket/gadget.yaml b/gadgets/snapshot_socket/gadget.yaml index 0f753784097..fb3005e2252 100644 --- a/gadgets/snapshot_socket/gadget.yaml +++ b/gadgets/snapshot_socket/gadget.yaml @@ -1,5 +1,8 @@ name: snapshot socket description: Show TCP and UDP sockets +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ snapshotters: sockets: structName: socket_entry diff --git a/gadgets/top_file/gadget.yaml b/gadgets/top_file/gadget.yaml index eb7e28deb54..2317939a588 100644 --- a/gadgets/top_file/gadget.yaml +++ b/gadgets/top_file/gadget.yaml @@ -1,5 +1,8 @@ -name: file +name: top file description: Periodically report read/write activity by file +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ toppers: file: mapName: stats diff --git a/gadgets/trace_dns/gadget.yaml b/gadgets/trace_dns/gadget.yaml index 6b8a68b549b..bf5c827ac7b 100644 --- a/gadgets/trace_dns/gadget.yaml +++ b/gadgets/trace_dns/gadget.yaml @@ -1,5 +1,8 @@ -name: dns +name: trace dns description: trace dns requests and responses +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs/latest/ +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget tracers: dns: mapName: events @@ -55,11 +58,11 @@ structs: attributes: width: 16 - name: netns - description: 'Network namespace inode id' + description: Network namespace inode id attributes: template: ns - name: mntns_id - description: 'Mount namespace inode id' + description: Mount namespace inode id attributes: template: ns - name: tid diff --git a/gadgets/trace_exec/gadget.yaml b/gadgets/trace_exec/gadget.yaml index 30057d69c0d..e47a63dd2c0 100644 --- a/gadgets/trace_exec/gadget.yaml +++ b/gadgets/trace_exec/gadget.yaml @@ -1,5 +1,8 @@ name: trace exec description: trace process executions +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ tracers: exec: mapName: events diff --git a/gadgets/trace_malloc/gadget.yaml b/gadgets/trace_malloc/gadget.yaml index d3c79ecc074..d3605dbe7c3 100644 --- a/gadgets/trace_malloc/gadget.yaml +++ b/gadgets/trace_malloc/gadget.yaml @@ -1,5 +1,8 @@ name: trace malloc description: use uprobe to trace malloc and free in libc.so +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ tracers: malloc: mapName: events diff --git a/gadgets/trace_mount/gadget.yaml b/gadgets/trace_mount/gadget.yaml index 67f145d9b7b..1050befb0f5 100644 --- a/gadgets/trace_mount/gadget.yaml +++ b/gadgets/trace_mount/gadget.yaml @@ -1,5 +1,8 @@ name: trace mount description: trace mount syscalls +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ tracers: mount: mapName: events diff --git a/gadgets/trace_oomkill/gadget.yaml b/gadgets/trace_oomkill/gadget.yaml index d3c94202e57..780f83177f7 100644 --- a/gadgets/trace_oomkill/gadget.yaml +++ b/gadgets/trace_oomkill/gadget.yaml @@ -1,5 +1,8 @@ -name: oomkill +name: trace oomkill description: trace OOM killer +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ tracers: oomkill: mapName: events @@ -20,8 +23,9 @@ structs: attributes: template: pid - name: pages + attributes: {} - name: mntns_id - description: 'Mount namespace inode id' + description: Mount namespace inode id attributes: template: ns - name: timestamp diff --git a/gadgets/trace_open/gadget.yaml b/gadgets/trace_open/gadget.yaml index c74bb7e8519..23a42ae9bd4 100644 --- a/gadgets/trace_open/gadget.yaml +++ b/gadgets/trace_open/gadget.yaml @@ -1,5 +1,8 @@ -name: open +name: trace open description: trace open files +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ tracers: open: mapName: events @@ -41,7 +44,7 @@ structs: width: 32 minWidth: 24 - name: mntns_id - description: 'Mount namespace inode id' + description: Mount namespace inode id attributes: template: ns ebpfParams: diff --git a/gadgets/trace_signal/gadget.yaml b/gadgets/trace_signal/gadget.yaml index c0774ec7ca2..04916517f2a 100644 --- a/gadgets/trace_signal/gadget.yaml +++ b/gadgets/trace_signal/gadget.yaml @@ -1,5 +1,8 @@ -name: signal +name: trace signal description: trace signal +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ tracers: signal: mapName: events @@ -32,24 +35,24 @@ structs: attributes: width: 5 - name: mntns_id - description: 'Mount namespace inode id' + description: Mount namespace inode id attributes: template: ns ebpfParams: - filtered_pid: - key: pid - defaultValue: "" - description: Show only events generated by processes with this pid - target_signal: - key: signal - defaultValue: "" - description: Show only events generated by this signal failed_only: key: failed defaultValue: "false" description: Show only failed events + filtered_pid: + key: pid + defaultValue: "" + description: Show only events generated by processes with this pid kill_only: key: kill-only alias: k defaultValue: "false" description: Show only events generated by kill family syscalls + target_signal: + key: signal + defaultValue: "" + description: Show only events generated by this signal diff --git a/gadgets/trace_sni/gadget.yaml b/gadgets/trace_sni/gadget.yaml index 76413bc7e09..f6e660f0c05 100644 --- a/gadgets/trace_sni/gadget.yaml +++ b/gadgets/trace_sni/gadget.yaml @@ -1,10 +1,12 @@ -name: sni +name: trace sni description: trace sni +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ tracers: sni: mapName: events structName: event_t - structs: event_t: fields: @@ -30,15 +32,15 @@ structs: attributes: width: 30 - name: netns - description: 'Network namespace inode id' + description: Network namespace inode id attributes: template: ns - name: mntns_id - description: 'Mount namespace inode id' + description: Mount namespace inode id attributes: template: ns - name: tid description: TID of the thread sending the request attributes: - template: pid hidden: true + template: pid diff --git a/gadgets/trace_tcp/gadget.yaml b/gadgets/trace_tcp/gadget.yaml index a01faf6f607..33d068582ab 100644 --- a/gadgets/trace_tcp/gadget.yaml +++ b/gadgets/trace_tcp/gadget.yaml @@ -1,5 +1,8 @@ -name: tracetcp +name: trace tcp description: monitor connect, accept and close events of TCP connections +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ tracers: tracetcp: mapName: events diff --git a/gadgets/trace_tcpconnect/gadget.yaml b/gadgets/trace_tcpconnect/gadget.yaml index a53fbd3bedb..0071f2786ca 100644 --- a/gadgets/trace_tcpconnect/gadget.yaml +++ b/gadgets/trace_tcpconnect/gadget.yaml @@ -1,5 +1,8 @@ -name: tcpconnect +name: trace tcpconnect description: trace tcp connections +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ tracers: tcpconnect: mapName: events @@ -37,6 +40,6 @@ structs: alignment: left hidden: true - name: mntns_id - description: 'Mount namespace inode id' + description: Mount namespace inode id attributes: template: ns diff --git a/gadgets/trace_tcpdrop/gadget.yaml b/gadgets/trace_tcpdrop/gadget.yaml index 1efe3bac4ec..a3e6824f493 100644 --- a/gadgets/trace_tcpdrop/gadget.yaml +++ b/gadgets/trace_tcpdrop/gadget.yaml @@ -1,5 +1,8 @@ -name: tcpdrop +name: trace tcpdrop description: trace TCP packets dropped by the kernel +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ tracers: tcpdrop: mapName: events diff --git a/gadgets/trace_tcpretrans/gadget.yaml b/gadgets/trace_tcpretrans/gadget.yaml index 9bdc7687956..8e3277cdd87 100644 --- a/gadgets/trace_tcpretrans/gadget.yaml +++ b/gadgets/trace_tcpretrans/gadget.yaml @@ -1,5 +1,8 @@ -name: tcpretrans +name: trace tcpretrans description: trace TCP retransmissions +homepageURL: https://inspektor-gadget.io/ +documentationURL: https://inspektor-gadget.io/docs +sourceURL: https://github.com/inspektor-gadget/inspektor-gadget/ tracers: tcpretrans: mapName: events @@ -49,17 +52,17 @@ structs: alignment: left ellipsis: end - name: netns - description: 'Network namespace inode id' + description: Network namespace inode id attributes: template: ns - name: type - description: 'Type of the retransmission, either RETRANS or LOSS' + description: Type of the retransmission, either RETRANS or LOSS attributes: width: 7 alignment: left ellipsis: end - name: mntns_id - description: 'Mount namespace inode id' + description: Mount namespace inode id attributes: template: ns - name: state