Skip to content

runtime hooks support for tetragon #695

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

Merged
merged 4 commits into from
Feb 21, 2023
Merged

runtime hooks support for tetragon #695

merged 4 commits into from
Feb 21, 2023

Conversation

kkourt
Copy link
Contributor

@kkourt kkourt commented Feb 10, 2023

This PR introduces a gRPC interface that can be used by run-time hooks to inform the tetragon agent about events such as container creation. Sensors can add hooks into these events so that they can be notified about them.

@kkourt kkourt marked this pull request as ready for review February 10, 2023 16:07
@kkourt kkourt requested a review from a team as a code owner February 10, 2023 16:07
@kkourt kkourt requested review from olsajiri and tpapagian February 10, 2023 16:07
Copy link
Member

@tpapagian tpapagian left a comment

Choose a reason for hiding this comment

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

Thanks! Other than minor issues, LGTM.

@kkourt kkourt force-pushed the pr/kkourt/rt-hooks branch from 114f8a5 to 5258052 Compare February 15, 2023 08:45
Copy link
Member

@tixxdz tixxdz left a comment

Choose a reason for hiding this comment

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

Could we have a workflow doc from how the OCI runtime hooks are triggered and how it propagates and relates to k8s watcher?

Also let's add OCI word here, clear confusion that runtime hooks are OCI runtime hooks right?

This is intended for runtime hooks to pass information to the agent.
In this patch we add a CreateContainer call so that the agent can be
notified about the creation of a new container.

- cgroupsPath: cgroups path
- rootDir: root directory of the container
- annotations: annotations for the container see https://github.com/opencontainers/runtime-spec/blob/main/config.md#annotations

This patch modifies the proto definition and introduces stub functions
The next patch will generate the necessary code from the proto file.

Signed-off-by: Kornilios Kourtis <[email protected]>
generate code.

Signed-off-by: Kornilios Kourtis <[email protected]>
This patch adds pkg/rthooks which can be used by sensors to add
callbacks on RuntimeHookRequest (grpc) requests.

There is a global runner, where sensors can register their callbacks.
The server will serve the request by running all the callbacks
registered in the runner, when a grpc request is issued.

The callbacks have two arguments:
 - the grpc request itself
 - the k8s wathcer, that allows callbacks to retrieve k8s information as
   needed.

For example, a callback may need to retrieve the namespaces or the
labels of a pod when a container for that pod starts.

Signed-off-by: Kornilios Kourtis <[email protected]>
This patch adds a create-container command to the tetra CLI, which will
issue a CreateContainer grpc request to the agent. It's intended for
testing/debugging so it's hidden from users.

Signed-off-by: Kornilios Kourtis <[email protected]>
@kkourt kkourt force-pushed the pr/kkourt/rt-hooks branch from 5258052 to 5b82ba5 Compare February 17, 2023 09:50
@kkourt
Copy link
Contributor Author

kkourt commented Feb 17, 2023

Could we have a workflow doc from how the OCI runtime hooks are triggered and how it propagates and relates to k8s watcher?

Also let's add OCI word here, clear confusion that runtime hooks are OCI runtime hooks right?

Updated description. The intended use is for OCI hooks, but that does not mean that we cannot use it from elsewhere.

@kkourt kkourt mentioned this pull request Feb 17, 2023
@jrfastab jrfastab merged commit f4d6ac4 into main Feb 21, 2023
@jrfastab jrfastab deleted the pr/kkourt/rt-hooks branch February 21, 2023 01:03
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.

4 participants