Skip to content

fix(cli/clistat): improve detection of container environment #8643

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 2 commits into from
Jul 21, 2023

Conversation

johnstcn
Copy link
Member

In some Kubernetes environments, /proc/1/cgroup just ends up as 0::/ which means the current logic falls down. The presence of a file under the path /var/run/secrets/kubernetes.io/serviceaccount/token is a good indicator of being run inside a container, so adding this as another detection method.

@johnstcn johnstcn requested review from mafredri and mtojek July 21, 2023 10:02
@johnstcn johnstcn self-assigned this Jul 21, 2023
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

LGTM

@johnstcn johnstcn enabled auto-merge (squash) July 21, 2023 10:12
@johnstcn johnstcn merged commit fd372f6 into main Jul 21, 2023
@johnstcn johnstcn deleted the cj/stat-better-container-detection branch July 21, 2023 10:18
@github-actions github-actions bot locked and limited conversation to collaborators Jul 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants