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

fix: Update regex parsing for CGroup v1 to match agent spec. #2286

Merged
merged 2 commits into from Feb 28, 2024

Conversation

tippmar-nr
Copy link
Member

@tippmar-nr tippmar-nr commented Feb 28, 2024

Updates our container id parsing logic for CGroup v1 to match the agent spec and removes the "fallback" lookup we recently added. The spec requires that we find a line that has cpu in it and contains a 64-character hexadecimal string. The container ID is the 64-character string.

The logic should find a container id of 47cbd16b77c50cbf71401c069cd2189f0e659af17d5a2daca3bddf59d8a870b2 when parsing any of the following lines in /proc/self/cgroup:

1:cpuset:/docker/47cbd16b77c50cbf71401c069cd2189f0e659af17d5a2daca3bddf59d8a870b2
2:cpu:/docker/47cbd16b77c50cbf71401c069cd2189f0e659af17d5a2daca3bddf59d8a870b2
3:cpuacct,cpu:/docker/47cbd16b77c50cbf71401c069cd2189f0e659af17d5a2daca3bddf59d8a870b2
4:memory,cpu,cpuset:/docker/47cbd16b77c50cbf71401c069cd2189f0e659af17d5a2daca3bddf59d8a870b2
5:cpu,cpuacct:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod04f9c4b4_5e71_4a0a_aa3a_f62f089e3f73.slice/cri-containerd-47cbd16b77c50cbf71401c069cd2189f0e659af17d5a2daca3bddf59d8a870b2.scope
6:cpuset:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod04f9c4b4_5e71_4a0a_aa3a_f62f089e3f73.slice/cri-containerd-47cbd16b77c50cbf71401c069cd2189f0e659af17d5a2daca3bddf59d8a870b2.scope

Copy link
Member

@nr-ahemsath nr-ahemsath left a comment

Choose a reason for hiding this comment

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

Looks good.

@tippmar-nr tippmar-nr enabled auto-merge (squash) February 28, 2024 18:08
@tippmar-nr tippmar-nr merged commit 7fa3410 into main Feb 28, 2024
77 checks passed
@tippmar-nr tippmar-nr deleted the fix/cgroup-v1-regex-update branch February 28, 2024 18:09
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

3 participants