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

tetragon: Remove sensors on exit not programs #1514

Merged
merged 6 commits into from Oct 5, 2023

Conversation

olsajiri
Copy link
Contributor

@olsajiri olsajiri commented Sep 27, 2023

The change loading and unloading sensors to be on the sensors level,
so instead of removing separate programs, we remove complete sensors.

This has benefit of triggering sensors' unload hooks.

@olsajiri olsajiri added the release-note/minor This PR introduces a minor user-visible change label Sep 27, 2023
@olsajiri olsajiri force-pushed the remove_all_sensors branch 4 times, most recently from ad743ef to f540ca1 Compare September 28, 2023 08:11
@netlify
Copy link

netlify bot commented Sep 28, 2023

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit 4887f79
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/651e49b4c04e7200073f769c
😎 Deploy Preview https://deploy-preview-1514--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@olsajiri olsajiri force-pushed the remove_all_sensors branch 7 times, most recently from 4bfb762 to bd6902a Compare October 3, 2023 12:06
olsajiri and others added 5 commits October 5, 2023 05:16
Using sensor manager AddTracingPolicy call to load sensors,
instead directly loading sensor.

This will allow us to get sensor's PreUnloadHook and
PostUnloadHook calls when we remove test observer object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Adding RemoveAllSensors to sensor manager that unloads and
removes all registered sensors.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Use new UnloadSensors function to unload sensors directly
with sensor.Unload and not by unloading all programs separately.

This way we call unload hooks on unload.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
And use it to remove sensors for test and tetragon.

Also making initial sensor a global variable so there's
just single programs/maps set of base sensor.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Currently, the observer uses a global variable for the sensor manager.
Tests may use the observer or create their own sensor manager. For the
latter case, a StartTestSensorManager was created. The idea behind the
test functions is that they make it easier to write tests by failing
when an error happens and registering cleanup functions when the test
finishes.

Some tests, however, require having an observer and others do not. This
patch:
 - Makes the sensor manager global variable in the observer a private
   one, and introduces access functions for it
   - This  allows us to check whether the global variable is set twice.
 - Changes the StartTestSensorManager to GetTestSensorManager that first
   checks if the global variable is set. If it is, it just returns the
   existing sensor manager.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
@olsajiri olsajiri marked this pull request as ready for review October 5, 2023 08:10
@olsajiri olsajiri requested a review from a team as a code owner October 5, 2023 08:10
@olsajiri olsajiri requested a review from jrfastab October 5, 2023 08:10
@olsajiri olsajiri merged commit 1e67653 into cilium:main Oct 5, 2023
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/minor This PR introduces a minor user-visible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants