Skip to content

Conversation

@rata
Copy link
Contributor

@rata rata commented Dec 30, 2022

This is a follow-up to address one item of this comment by @fuweid: #7679 (review)

The first commit fixes an issue running the tests (assert vs require, so the function result can be nil by mistake instead of failing early).

The second commit is the follow-up itself. I didn't use reflect, as it might be too slow to use on the container creation path. But this means we need to update sameUsernsConfig() if the runtime.UserNamespace type changes. Let me know if you prefer to use reflect here.

The third commit just removes a variable that is not really helpful. It is a cosmetic change, no functional change.

Currently we require that c.containerSpec() does not return an error
if test.err is not set.

However, if the require fails (i.e. it indeed returned an error) the
rest of the code is executed anyways. The rest of the code assumes it
did not return an error (so code assumes spec is not nil). This fails
miserably if it indeed returned an error, as spec is nil and go crashes
while running the unit tests.

Let's require it is not an error, so code does not continue to execute
if that fails and go doesn't crash.

In the test.err case is not harmful the bug of using assert, but let's
switch it to require too as that is what we really want.

Signed-off-by: Rodrigo Campos <[email protected]>
@k8s-ci-robot
Copy link

Hi @rata. Thanks for your PR.

I'm waiting for a containerd 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.

The sandbox and container both have the userns config. Lets make sure
they are the same, therefore consistent.

Signed-off-by: Rodrigo Campos <[email protected]>
@rata rata force-pushed the rata/userns-stateless-pods branch from 56b5946 to 2752da6 Compare December 30, 2022 18:08
Signed-off-by: Rodrigo Campos <[email protected]>
@rata rata force-pushed the rata/userns-stateless-pods branch from 2752da6 to 72ef986 Compare December 30, 2022 19:50
@rata
Copy link
Contributor Author

rata commented Dec 30, 2022

CI failures are unrelated, but pushing again to trigger a retest

@samuelkarp
Copy link
Member

/ok-to-test

@samuelkarp samuelkarp added area/cri Container Runtime Interface (CRI) cherry-pick/sbserver labels Dec 31, 2022
@samuelkarp samuelkarp merged commit d769f03 into containerd:main Dec 31, 2022
@rata rata deleted the rata/userns-stateless-pods branch December 31, 2022 17:59
mxpv added a commit to mxpv/containerd that referenced this pull request Jan 17, 2023
mxpv added a commit to mxpv/containerd that referenced this pull request Jan 17, 2023
@mxpv mxpv added cherry-picked/sbserver Changes are backported to sbserver and removed cherry-pick/sbserver labels Jan 19, 2023
jsturtevant pushed a commit to jsturtevant/containerd that referenced this pull request Sep 21, 2023
kiashok pushed a commit to kiashok/containerd that referenced this pull request Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cri Container Runtime Interface (CRI) cherry-picked/sbserver Changes are backported to sbserver ok-to-test

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants