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

Skip to content

Conversation

@haircommander
Copy link
Member

What type of PR is this?

/kind api-change

What this PR does / why we need it:

this is a #3474 redux, built for the modern era! it also contains #3868 and #3910

With this PR, users can specify --drop-infra and cri-o will drop the infra container when able.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

add `--drop-infra` option to ask CRI-O to drop the infra container when a pod level pid namespace isn't requested. This feature is considered experimental

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels Jul 21, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander

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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 21, 2020
@haircommander haircommander force-pushed the check-pid-manage-ns-drop-infra branch 4 times, most recently from 2a86740 to aaca421 Compare July 23, 2020 14:51
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 23, 2020
@haircommander haircommander force-pushed the check-pid-manage-ns-drop-infra branch from aaca421 to 764277f Compare July 23, 2020 15:17
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 23, 2020
@haircommander haircommander force-pushed the check-pid-manage-ns-drop-infra branch 2 times, most recently from 0b9b4ec to 084fe24 Compare July 23, 2020 17:23
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 23, 2020
having exec sync update state each time is a bit excessive.
In addition to exec'ing extra, it causes potential for runc state to flake, causing the container to go down.
instead, we should just check if the pid is running, and proceed if so

Signed-off-by: Peter Hunt <[email protected]>
in any case where we want to directly manipulate a pid on the host. this is unsafe, as we can encounter pid wrap.
for those cases, we need to check the pid is the one we want to access, whether it's creating a namespace path with /proc
or directly killing a container

also, add unit tests for this fix, as well as refactor a few of the oci tests

Signed-off-by: Peter Hunt <[email protected]>
pid namespaces were special cased as a namespace that was not managed, because they function differently

For the other namespaces, we can pass a new namespace to the runtime when that namespace is private to the pod
However, it would be a bother creating a new pid namespace (conmon would have to unshare the namespace, then do the bind mount)

Instead, mount the pid namespace *after* the sandbox is created. This way, the infra container's runtime config doesn't list the namespace (more on that below)
but subsequent containers created can join the namespace, instead of the proc entry. This further protects us from pid wrap

A consequence of not adding the file to the config is the restore case is a bit odd. The other namespaces can join the namespace listed in the restored config.json,
but the pid namespace is not saved in its config json.

Work around this by saving the pidns location to the infra container's runDir

this PR also adds unit tests, and refactors a couple of things to make tests pass

Signed-off-by: Peter Hunt <[email protected]>
some changes this includes:
- allow for the infra container to not be created by the runtime, if sb.NeedsInfra() is false
- add concept of a 'spoofed' container. This allows us to make calls to ID(), Name(), and Description() without having the runtime create the container
- using spoof, change checks of podInfraContainer == nil to Spoofed(), as well as re-add Description() calls
- reorder some infra container creation code
- add unit tests for NeedsInfra and Spoofed
- add integration test for drop infra
- sysctls are configured in the runtime after the process unshares in the shared namespaces. since we aren't using a runtime, we need to repeat this step.
	- After unsharing, but before binding, configure the sysctls for the namespace.
- spoof container state

Signed-off-by: Peter Hunt <[email protected]>
@haircommander haircommander force-pushed the check-pid-manage-ns-drop-infra branch from 084fe24 to b924339 Compare July 28, 2020 19:07
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 28, 2020
@openshift-ci-robot
Copy link

@haircommander: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/kata-jenkins b924339 link /test kata-containers
ci/prow/e2e-aws b924339 link /test e2e-aws

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-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 30, 2020
@openshift-ci-robot
Copy link

@haircommander: PR needs rebase.

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.

@haircommander
Copy link
Member Author

superceded by #4165

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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

2 participants