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

test: add bpf test with DNS gadget from local-gadget #260

Merged
merged 4 commits into from
Dec 7, 2021

Conversation

tormath1
Copy link
Contributor

@tormath1 tormath1 commented Nov 30, 2021

In this PR, we test IG and related BPF features on Flatcar with local-gadget starting with DNS gadget.

We basically install local-gadget and prepare its run using CLC.

It currently runs without SELinux due to this: flatcar/Flatcar#509

How to use

./build kola
./bin/kola list | grep gadget
bpf.local-gadget			[all]								[all]		[cl]		[all]		[all]

Testing done

=== RUN   bpf.local-gadget
=== RUN   bpf.local-gadget/dns_gadget
--- PASS: bpf.local-gadget (20.63s)
    --- PASS: bpf.local-gadget/dns_gadget (18.47s)
PASS, output in _kola_temp/qemu-2021-12-01-1126-8837

Related-to: flatcar/Flatcar#89

It could be merged with: #233 to kickoff BPF tests on Flatcar.

@tormath1 tormath1 changed the title test: add local-gadget test [wip] test: add local-gadget test Dec 1, 2021
this method is quite handy to generate Docker image based on host
binaries. It helps to circumvent Docker rate limit and it also remove
third-party dependencies.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
c.Fatalf("unable to run docker cmd: %v", err)
}

out, err := c.SSH(node, "cat /tmp/local-gadget.res | grep pkt_type | head --lines 1 | jq -r .name")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
out, err := c.SSH(node, "cat /tmp/local-gadget.res | grep pkt_type | head --lines 1 | jq -r .name")
out, err := c.SSH(node, "grep -m 1 pkt_type /tmp/local-gadget.res | jq -r .name")

This makes the processes run without error, not a real problem but if it gets copied later where pipefail is set, grep will fail when head terminates earlier because it does not consume the full input

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tip.

Run: localGadgetTest,
Name: `bpf.local-gadget`,
Distros: []string{"cl"},
// required while SELinux policy is not correcly updated to support
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's see if it works on the current LTS, otherwise we can add a minimum version later

@tormath1
Copy link
Contributor Author

tormath1 commented Dec 1, 2021

@pothos thanks for this quick review 😂 but it's still WIP, currently adding seccomp-gadget test.

@tormath1 tormath1 changed the title [wip] test: add local-gadget test test: add bpf test with DNS gadget from local-gadget Dec 3, 2021
@tormath1 tormath1 marked this pull request as ready for review December 3, 2021 09:24
@tormath1 tormath1 requested a review from a team December 3, 2021 09:24
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
@tormath1 tormath1 merged commit e03efb5 into flatcar-master Dec 7, 2021
@tormath1 tormath1 deleted the tormath1/local-gadget branch December 7, 2021 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants