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

cgidmap depends on cri for pod association #3381

Open
kkourt opened this issue Feb 10, 2025 · 0 comments
Open

cgidmap depends on cri for pod association #3381

kkourt opened this issue Feb 10, 2025 · 0 comments

Comments

@kkourt
Copy link
Contributor

kkourt commented Feb 10, 2025

#2776 Introduced pod association via cgroup ids.

Currently, there are two ways that the cgidmap can be updated.

By contacting the CRI:

m.Add(id.podID, id.contID, cgID)

Or, in the runtime hooks:
m.Add(podID, containerID, cgID)

This means that without --enable-cri being set, tetragon will not be able to do pod association for existing pods (even if runtime hooks are used).

This is reflected in the following warning:

level=warning msg="cgidmap is enabled but cri is not. This means that pod association will not work for existing pods. You can enable cri using --enable-cri"

One of the benefits of talking to the CRI is that it provides authoritative answers.

If --enable-cri is not set, we could scan the cgroup filesystem as we do in the policyfilter code:

func (s *cgfsFinder) findCgroupID(podID PodID, containerID string) (CgroupID, error) {
path, err := s.FindContainerPath(uuid.UUID(podID), containerID)
if errors.Is(err, fsscan.ErrContainerPathWithoutMatchingPodID) {
s.log.WithFields(logrus.Fields{
"pod-id": podID,
"container-id": containerID,
}).Info("FindCgroupID: found path without matching pod id, continuing.")
} else if err != nil {
return CgroupID(0), err
}
cgid, err := cgroups.GetCgroupIDFromSubCgroup(path)
return CgroupID(cgid), err
}

@kkourt kkourt changed the title cgidmap depends on cri for pod association. cgidmap depends on cri for pod association Feb 10, 2025
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

No branches or pull requests

1 participant