Skip to content

e2e_node: add a test to verify kubelet fails to create pod if userns isn't supported #127484

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 1 commit into from
Mar 20, 2025

Conversation

haircommander
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

... and the pod requests a user namespace

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

none

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Sep 19, 2024
@haircommander
Copy link
Contributor Author

/hold

requires kubernetes/test-infra#33511 to actually run

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. area/test sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 19, 2024
@haircommander
Copy link
Contributor Author

/test pull-kubernetes-node-crio-cgrpv2-userns-e2e-serial

@bart0sh
Copy link
Contributor

bart0sh commented Sep 19, 2024

/triage accepted
/priority important-soon

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Sep 19, 2024
@kannon92
Copy link
Contributor

/hold

Let's confirm that the test you added works before merge.

@haircommander
Copy link
Contributor Author

/hold cancel

new test passed https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/127484/pull-kubernetes-node-crio-cgrpv2-userns-e2e-serial/1836871735580823552 some other test that's now in this suite failed, but that shouldn't block IMO

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 20, 2024
admissionapi "k8s.io/pod-security-admission/api"
)

var _ = SIGDescribe("UserNamespaces", "[LinuxOnly]", nodefeature.UserNamespacesSupport, framework.WithSerial(), func() {
Copy link
Member

Choose a reason for hiding this comment

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

is this test really serial?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, when ever a feature gate is toggled for kubelet, the test has to be serial. Changing kubelet configs triggers a restart of kubelet.

Copy link
Member

Choose a reason for hiding this comment

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

Til, thanks, this explains why some test here are tagged as serial when they are not ..., authors may forget to remove the serial decorator when it is ga .... @pohly does it make sense to automate this behavior for the e2e_node so authors don't need to worry about this behavior?

cc @SergeyKanzhelev

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see how. nodefeature.UserNamespacesSupport just says "this test depends on this feature", it doesn't say "this test needs to toogle that feature", so nodefeature.UserNamespacesSupport should not implicitly add the serial tag.

authors may forget to remove the serial decorator when it is ga

Doesn't it say below that the entire test needs to be removed once the feature is GA?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah this test is only serial because it changes the kubelet's feature gates, not specifically toggles user namespaces. Once user namespaces are GA'd (and specifically when the feature gate is dropped), we have to remove this test because we can't test with user namespaces disabled anymore

Copy link
Contributor

@esotsal esotsal Jan 22, 2025

Choose a reason for hiding this comment

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

Once user namespaces are GA'd (and specifically when the feature gate is dropped), we have to remove this test because we can't test with user namespaces disabled anymore

Do we need to capture this in userns GA plan not to forget ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually with apiserver emulated versions we'll keep feature gates around after GA, so it will only be removed when it's been GA everywhere for a while. I think this test could also be updated in the future to handle when the node doesn't support userns


// Pod should stay in pending
// Events would be a better way to tell this, as we could actually read the event,
// but history proves events aren't reliable enough to base a test on.
Copy link
Member

Choose a reason for hiding this comment

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

v1.Events? those must no be used on tests, are best effort , there is no guarantee there are going to be delivered

Copy link
Contributor Author

Choose a reason for hiding this comment

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

exactly

Copy link
Contributor

Choose a reason for hiding this comment

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

A bit confused, how to interpret lines 75 - 76, do you mean events are not a better way ( so we could just delete the two comment lines ) or you mean we should improve reliability of events ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean they'd be a more accurate way if they could be relied on, but since they can't be relied on we can't use them, even though it'd give us the exact reason the pod is still in pending

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for clarifying

@esotsal
Copy link
Contributor

esotsal commented Mar 11, 2025

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 11, 2025
@esotsal esotsal moved this from PRs Waiting on Author to PRs - Needs Approver in SIG Node CI/Test Board Mar 11, 2025
@esotsal esotsal moved this from Waiting on Author to Needs Approver in SIG Node: code and documentation PRs Mar 11, 2025
@esotsal
Copy link
Contributor

esotsal commented Mar 11, 2025

/hold

@aojea , @pohly , @bart0sh and @SergeyKanzhelev please review / approve and decide if it is ok to cancel hold, thanks

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 11, 2025
@pohly
Copy link
Contributor

pohly commented Mar 12, 2025

Looks good to me. I think the pending discussions have been resolved.

This is a SIG Node test. It should be approved by someone from SIG Node, not me as SIG Testing TL.

Copy link
Member

@SergeyKanzhelev SergeyKanzhelev left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander, SergeyKanzhelev

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 19, 2025
@esotsal
Copy link
Contributor

esotsal commented Mar 20, 2025

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 20, 2025
@esotsal
Copy link
Contributor

esotsal commented Mar 20, 2025

/lgtm cancel

@haircommander this PR cannot be merged because of [KEP-3041] - remove nodefeatures from k/k repo

/cc @kannon92

@k8s-ci-robot k8s-ci-robot requested a review from kannon92 March 20, 2025 09:21
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2025
…isn't supported

and the pod requests a user namespace

Signed-off-by: Peter Hunt <[email protected]>
@haircommander
Copy link
Contributor Author

oops good point! fixed

@haircommander
Copy link
Contributor Author

/retest

@esotsal
Copy link
Contributor

esotsal commented Mar 20, 2025

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: c9efe769ec6e02c1b0c200a6ebab5e1b5b507470

@BenTheElder
Copy link
Member

... and the pod requests a user namespace

Phew, I had a huge ???? moment when this PR showed up in the merge queue and the title elided this part 😂

I feel like maybe the super long title would be worth it this time 🙃 🚲 🏠 🎨 🖌️

@haircommander
Copy link
Contributor Author

We have to urge users to switch to userns pods somehow 😈

@k8s-ci-robot k8s-ci-robot merged commit 48ba25a into kubernetes:master Mar 20, 2025
14 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.33 milestone Mar 20, 2025
@github-project-automation github-project-automation bot moved this from PRs - Needs Approver to Done in SIG Node CI/Test Board Mar 20, 2025
@github-project-automation github-project-automation bot moved this from Needs Approver to Done in SIG Node: code and documentation PRs Mar 20, 2025
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. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Development

Successfully merging this pull request may close these issues.