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: Process Manager args cleanup #236

Merged
merged 8 commits into from
Jul 16, 2022
Merged

Conversation

jrfastab
Copy link
Contributor

This simplifies Process manager and arg handling creating common pkg to handle getting/setting args. After this series ./pkg/option is also used for standard configuration options such as ProcessNS and ProcessCreds.

With this we can simplify Process Manager arg passing and avoid pushing args down through multiple layers of calls. And additionally logs can pretty print the args at any debug or info point we need them.

Finally fixes up cache init flow to only enable the eventCache when the K8s watcher is also enabled. This further simplifies bringing the ProcessManager up because we no longer need to pass the arg through. And finally, we can drop storing the cache in the process manager object. Caches are singular objects you can't have multiple caches of the same type. Historically, we allowed this but it was thoroughly confusing and when some poor person had to debug it you end up asking questions like -- which cache is not working, is the event in the other cache , and so on-- so we removed this logic long ago, but process manager never came along with it until now.

jrfastab added 5 commits July 14, 2022 19:23
We are not going to enforce all our vendor code follows the format
rules otherwise we get large patch diffs and break go vendor.

Signed-off-by: John Fastabend <[email protected]>
Passing options through series of calls gets old fast. Lets clean these up
by creating an options pkgs where options can be set and retrieved without
having to wonder if we passed them through the stack correctly.

Then any of our sensors can just read them as needed. End goal is to
remove these New() creators after which we can lose per sensor shell
structures used to hold only the args.

We leave aggregator options alone for now because we will build a
aaggregator config struct for them later.

Signed-off-by: John Fastabend <[email protected]>
ProcessManager has a bool we call enableEventCache as an argument. In
theory this could enable/disable using the event cache, but its not
actually hooked up to anything. Lets remove it because its not used
and then use options pkg later if we want to control if cache runs
or not.

Signed-off-by: John Fastabend <[email protected]>
Remove passing options through New() creators in the grpc tracing pkg.
Instead access directly through the option pkg.

Signed-off-by: John Fastabend <[email protected]>
Remove passing options through New() creators in the grpc exec pkg.
Instead access directly through the option pkg.

Signed-off-by: John Fastabend <[email protected]>
@jrfastab jrfastab requested a review from a team as a code owner July 15, 2022 02:28
@jrfastab jrfastab requested a review from sharlns July 15, 2022 02:28
jrfastab added 3 commits July 15, 2022 13:24
ProcessManager no longer needs to pass options around because they get
pushed through pkg/option lets drop them.

todo: testers need to set config.Enable* options directly

Signed-off-by: John Fastabend <[email protected]>
Fix A bug where we enabled eventCache even when K8s api was
disabled. In this case its useless because K8s watcher will never
give us metadata so trying to map events to their metadata is always
nil, there is no metadata.

Signed-off-by: John Fastabend <[email protected]>
The users of execCache use a getter to pull it directly because there
can only ever be one. Remove the extra var holding it in the struct.

Signed-off-by: John Fastabend <[email protected]>
@jrfastab jrfastab force-pushed the pr/jrfastab/pmArgsCleanup branch from 5f2436b to e3bcfbd Compare July 15, 2022 20:26
@jrfastab jrfastab merged commit 6cf7b07 into main Jul 16, 2022
@jrfastab jrfastab deleted the pr/jrfastab/pmArgsCleanup branch July 16, 2022 00:13
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.

1 participant