-
Notifications
You must be signed in to change notification settings - Fork 376
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
Fix a regression on tetra tracingpolicy enable/disable #1562
Conversation
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
0da5bb1
to
2a724dc
Compare
2a724dc
to
10c6857
Compare
10c6857
to
8e637bc
Compare
maybe it would be reasonable to add a test covering that regression. |
8e637bc
to
8867b22
Compare
I added a test in c738ea3. |
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.
Thanks! LGTM!
The only thing I'm not sure about is what to do when destroy fails. If we cannot recover from such a case, I'd suggest we just remove the sensor anyway and issue a warning. I'm happy to be convinced otherwise though.
All other comments are just nits.
// Previously, enabled, filterID and error were bundled in a | ||
// string. To have a retro-compatible tetra command, we scan | ||
// the string. If the scan fails, it means something else | ||
// might be in Info and we print it. |
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.
Let's make a note of the version that required this (0.11) so that we can remove it eventually.
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.
sure good idea
6f7d645
to
77ebd7e
Compare
// destroy will attempt to destroy all the sensors in a collection | ||
func (c *collection) destroy() { | ||
for _, s := range c.sensors { | ||
s.Destroy() | ||
} | ||
} |
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.
better like that
Commit 310846e introduced a cleanup of the kprobe table entry on unload, which introduced some issues because unload is using when disabling sensors (that might be re-enabled later). Previous pre and post-hooks are still useful for resources management on unload. The kprobe table entry is added on creation (not load) and then it must be cleaned up on deletion introducing the new sensor.Destroy() method. 'Destroy' expresses the idea that the sensor is not usable past this point and must be recreated to be loaded. Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
Add support of enable and disable Tracing Policy in tetra CLI. Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
Commands were implemented in a way that most of them would not return an exit code != 0 on error and no messages on success. This fixes the issues for the tracing policy subcommands and cleanup the implem. Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
Enable and disable were the only features that were only available trough the sensors command and gRPCs, now that they are implemented in the tracingpolicy interface, let's deprecate/hide the sensors command. Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
Previously, enabled, filter_id and error were bundled into the info string. We add new dedicated fields and make the new tetra also retrocompatible with the old API missing those fields by parsing the info string. Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
This should make sure the regression #1489 doesn't appear anymore: disabling/enabling broke because we cleaned up the generic kprobe table on unloading, which should have been done only on destroying the probe. Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
The testutils Config.TetragonLib (or in the end ConfigDefault.TetragonLib) was never written to the actual option.Config.HubbleLib. We noticed it was done manually all over the place in tests so this commit adds it in TestSensorRun that runs in TestMain. Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
77ebd7e
to
0690282
Compare
Fixes #1489.
See individual commits, this PR:
PostUnloadHook