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

rthooks fixes #2874

Merged
merged 4 commits into from
Sep 4, 2024
Merged

rthooks fixes #2874

merged 4 commits into from
Sep 4, 2024

Conversation

kkourt
Copy link
Contributor

@kkourt kkourt commented Sep 4, 2024

Assorted rthooks fixes and updates. See commits.

Fixes: #2872

cgroup paths such as:
/kubepods.slice/kubepods-besteffort.slice/kubepods-besteffort-pod4c9f1974_5c46_44c2_b42f_3bbf0e98eef9.slice/cri-containerd-bacb920470900725e0aa7d914fee5eb0854315448b024b6b8420ad8429c607ba.scope

Are not correctly handled by the rthooks code. Add a check for .slice in
pods and a check for .scope in containers.

Signed-off-by: Kornilios Kourtis <[email protected]>
Signed-off-by: Kornilios Kourtis <[email protected]>
cgidmap requires cri for pod association to work with existing pods.
Currently, if cri is not enabled the cgidmap code will panic:

E0904 10:02:54.892524   22765 runtime.go:79] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
goroutine 13 [running]:
k8s.io/apimachinery/pkg/util/runtime.logPanic({0x276f260, 0x4a09c00})
        /home/kkourt/src/tetragon/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:75 +0x85
k8s.io/apimachinery/pkg/util/runtime.HandleCrash({0x0, 0x0, 0xc004fd3340?})
        /home/kkourt/src/tetragon/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:49 +0x6b
panic({0x276f260?, 0x4a09c00?})
        /opt/go/src/runtime/panic.go:770 +0x132
github.com/cilium/tetragon/pkg/cgidmap.(*criResolver).enqeue(0x0, {0xc005434f20, 0xc004fdfb28?, 0x40?})

This commit adds a nil check to avoid the panic and issues a warning if
cri is not enabled but cgidmap is.

Signed-off-by: Kornilios Kourtis <[email protected]>
Currently, if cgidmap is disabled (this is the default), the agent
issues the following warning:

level=warning msg="failed to retrieve cgidmap, not registering rthook" error="cgidmap disabled"

This commit changes the message to indicate that this actually happens
in the podhook and, also, does not emit a warning if the error is that
cgidmap is disabled.

Signed-off-by: Kornilios Kourtis <[email protected]>
@kkourt kkourt requested a review from a team as a code owner September 4, 2024 10:49
@kkourt kkourt requested a review from tpapagian September 4, 2024 10:49
Copy link

netlify bot commented Sep 4, 2024

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit 60986a6
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/66d83b59275be30008ce009d
😎 Deploy Preview https://deploy-preview-2874--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.

@kkourt kkourt added the release-note/misc This PR makes changes that have no direct user impact. label Sep 4, 2024
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.

LGTM, thanks!

@kkourt kkourt merged commit 8e4feb4 into main Sep 4, 2024
50 of 51 checks passed
@kkourt kkourt deleted the pr/kkourt/rthooks-fixes branch September 4, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[rthooks] issue parsing getting podID from cgroup path
2 participants