-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add .containerenv file to containers #5463
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
Conversation
|
Hi @pjbgf. Thanks for your PR. I'm waiting for a cri-o member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
saschagrunert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ok-to-test
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pjbgf, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Code LGTM, I think we can add the integration test later on, too. |
Codecov Report
@@ Coverage Diff @@
## main #5463 +/- ##
==========================================
- Coverage 43.53% 43.53% -0.01%
==========================================
Files 118 118
Lines 11869 11890 +21
==========================================
+ Hits 5167 5176 +9
- Misses 6209 6219 +10
- Partials 493 495 +2 |
server/container_create_linux.go
Outdated
| return nil, err | ||
| } | ||
|
|
||
| // the existence of this file indicates that this is a container environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function creates a file /run/.containerenv on the host, but doesn't mount it into the container. You'll want to do something similar to:
https://github.com/cri-o/cri-o/blob/main/server/container_create_linux.go#L596
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haircommander that makes sense now. I made a few changes and added a few tests. PTAL
thanks @saschagrunert. I ended up adding a few tests on this PR as to ensure it is working as expected - as I am not very familiar with the codebase. PTAL |
|
/retest-required |
|
ci/kata-jenkins is failing on the new test in ctr.bats : |
server/container_create_linux.go
Outdated
| if err := sb.SetContainerEnvFile(); err != nil { | ||
| return nil, err | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be called in server/sandbox_run_linux.go as it's recreating containerenv file each time a container is created, when i believe the intention is to share the container env file for the whole pod
|
/retest |
|
/test kata-containers |
This file indicates that the current environment is inside a container environment. The same technique is used by podman and docker. The same file name/path as podman was used, as it is vendor agnostic. Signed-off-by: Paulo Gomes <[email protected]>
|
/retest-required |
|
I don't think the test failures are related, they've been a bit funky lately. this LGTM, I am going to wait to give the final tag so our bot doesn't spam retests. Thank you for your contribution @pjbgf ! |
|
/retest-required |
thank you @haircommander for the review and feedback. I am sure it won't be my last contribution. 🤞 |
excellent to hear 😎 let me know if you are looking for new tasks, we've got plenty 😃 |
|
/retest-required |
@haircommander I am trying to get a few things done on spo, once that is done I will reach out. 👍 |
|
/lgtm sounds good! |
|
@pjbgf: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
/retest-required Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
|
/retest-required Please review the full test history for this PR and help us cut down flakes. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This aligns CRI-O with podman, by adding a specific file to help programs running inside its containers to detected they are in fact running inside a container.
Which issue(s) this PR fixes:
Fixes #5461
Special notes for your reviewer:
Decided to use the same file name as podman, given that docker's approach is vendor specific.
Does this PR introduce a user-facing change?