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

pkg/{runcfanotify, container-hook}: Refactor code to use notify package. #2766

Merged
merged 2 commits into from
May 28, 2024

Conversation

eiffel-fl
Copy link
Member

Hi.

This PR refactors the common code between runcfanotify and container-hook.
I also unified the runtime paths array, so they now count the same number for both hooks and it is now easier to add a new hook.

Best regards.

@@ -47,7 +47,6 @@ import (

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should this. Instead, we should deprecate and delete runc-fanotify in favour of container-hook #1831.

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, but we can still refactor the code between the env variable code path and the for one.

pkg/utils/notify/notify.go Outdated Show resolved Hide resolved
@alban
Copy link
Member

alban commented May 13, 2024

Supersedes: #2764

"/usr/local/bin/runc",
"/usr/local/sbin/runc",
"/usr/lib/cri-o-runc/sbin/runc",
"/run/torcx/unpack/docker/bin/runc", // Used in TODO
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
"/run/torcx/unpack/docker/bin/runc", // Used in TODO
"/run/torcx/unpack/docker/bin/runc", // Used in Flatcar Container Linux

Copy link
Member

Choose a reason for hiding this comment

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

Actually, https://www.flatcar.org/blog/2024/04/os-innovation-with-systemd-sysext/ says:

Therefore, we recently removed Torcx and recommend using systemd-sysext for deploying custom Docker/containerd versions.

But we can keep the torcx path for a while for compatibility with older Flatcar versions.

@pothos When using systemd-sysext to install runc, crun or conmon, will it be in /usr/bin/ or do we need to add another path here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I also would like to add a link to some documentation pointing to this, do you have one?

Copy link
Contributor

Choose a reason for hiding this comment

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

pkg/container-hook/tracer.go Outdated Show resolved Hide resolved
@eiffel-fl
Copy link
Member Author

Supersedes: #2764

This does not supersede #2764 but it paves the way to easily add rancher support.

@eiffel-fl eiffel-fl force-pushed the francis/factorize-hook branch 3 times, most recently from b0f9951 to e8da160 Compare May 13, 2024 15:28
Copy link
Member

@alban alban left a comment

Choose a reason for hiding this comment

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

3 small things to fix, LGTM after that (if CI is green), from code inspection.

I would like @blanquicet to say whether his concern is addressed. In my opinion, this is fine to merge this PR even if we remove runcfanotify after.

pkg/container-hook/tracer.go Outdated Show resolved Hide resolved
pkg/runcfanotify/runcfanotify.go Outdated Show resolved Hide resolved
pkg/container-hook/tracer.go Outdated Show resolved Hide resolved
As runc path is a symlink, we also need to use SecureJoin as done in
bf76847 ("resolve symlinks in runtime path, add path for k3s").

Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
@eiffel-fl eiffel-fl force-pushed the francis/factorize-hook branch 3 times, most recently from ada8e57 to 8691113 Compare May 27, 2024 10:44
@eiffel-fl
Copy link
Member Author

The linter was drunken and removed a needed package, it is fixed now.

…er package.

The runtime-finder package hosts the runtime paths array as well as a function
used to try marking a runtime path.

Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
@eiffel-fl eiffel-fl merged commit 54fe2ac into main May 28, 2024
60 checks passed
@eiffel-fl eiffel-fl deleted the francis/factorize-hook branch May 28, 2024 12:24
@eiffel-fl
Copy link
Member Author

Thank you for the reviews!
We should have deprecated runcfanotiy since september 2023 according to #1831 and we sadly did not, so let's merge it as is and address the deprecation later.
Particularly as this PR makes the deprecation easier.

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.

None yet

4 participants