Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pjbgf
Copy link
Contributor

@pjbgf pjbgf commented Nov 16, 2021

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?

Containers now have a `/run/.containerenv` file to help applications identify that they are running inside a container.

@pjbgf pjbgf requested review from mrunalp and runcom as code owners November 16, 2021 13:27
@openshift-ci openshift-ci bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 16, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 16, 2021

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@openshift-ci openshift-ci bot requested review from giuseppe and sameo November 16, 2021 13:27
Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 16, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 16, 2021

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 16, 2021
@saschagrunert
Copy link
Member

Code LGTM, I think we can add the integration test later on, too.

@codecov
Copy link

codecov bot commented Nov 16, 2021

Codecov Report

Merging #5463 (3064a9d) into main (407d866) will decrease coverage by 0.00%.
The diff coverage is 38.09%.

@@            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     

return nil, err
}

// the existence of this file indicates that this is a container environment.
Copy link
Member

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

Copy link
Contributor Author

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

@pjbgf
Copy link
Contributor Author

pjbgf commented Nov 17, 2021

Code LGTM, I think we can add the integration test later on, too.

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

@pjbgf
Copy link
Contributor Author

pjbgf commented Nov 17, 2021

/retest-required

@littlejawa
Copy link
Contributor

ci/kata-jenkins is failing on the new test in ctr.bats :
# stat: can't stat '/run/.containerenv': No such file or directory

Comment on lines 595 to 597
if err := sb.SetContainerEnvFile(); err != nil {
return nil, err
}
Copy link
Member

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

@pjbgf
Copy link
Contributor Author

pjbgf commented Nov 17, 2021

/retest

@pjbgf
Copy link
Contributor Author

pjbgf commented Nov 18, 2021

/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]>
@pjbgf
Copy link
Contributor Author

pjbgf commented Nov 18, 2021

/retest-required

@haircommander
Copy link
Member

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 !

@haircommander
Copy link
Member

/retest-required

@pjbgf
Copy link
Contributor Author

pjbgf commented Nov 18, 2021

Thank you for your contribution @pjbgf !

thank you @haircommander for the review and feedback. I am sure it won't be my last contribution. 🤞

@haircommander
Copy link
Member

Thank you for your contribution @pjbgf !

thank you @haircommander for the review and feedback. I am sure it won't be my last contribution. crossed_fingers

excellent to hear 😎 let me know if you are looking for new tasks, we've got plenty 😃

@pjbgf
Copy link
Contributor Author

pjbgf commented Nov 19, 2021

/retest-required

@pjbgf
Copy link
Contributor Author

pjbgf commented Nov 19, 2021

excellent to hear sunglasses let me know if you are looking for new tasks, we've got plenty smiley

@haircommander I am trying to get a few things done on spo, once that is done I will reach out. 👍

@haircommander
Copy link
Member

/lgtm

sounds good!

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 19, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 19, 2021

@pjbgf: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/openshift-jenkins/integration_crun_cgroupv2 3064a9d link false /test integration_cgroupv2
ci/openshift-jenkins/e2e_crun_cgroupv2 3064a9d link false /test e2e_cgroupv2

Full PR test history. Your PR dashboard.

Details

Instructions 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.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add /run/.containerenv file

6 participants