Skip to content
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

storage validation: accept generic ephemeral volumes as volume device #105682

Merged

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Oct 14, 2021

What type of PR is this?

/kind bug

What this PR does / why we need it:

Raw block devices are possible with generic ephemeral volumes, so rejecting a
pod with that combination is wrong.

Special notes for your reviewer:

Found while working on E2E tests. Here's an example of a failures from those tests: https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/105659/pull-kubernetes-e2e-gce-csi-serial/1448711002941034496/

Does this PR introduce a user-facing change?

Generic ephemeral volumes can be used also as raw block devices, but the Pod validation was refusing to create pods with that combination.

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

- [KEP]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/1698-generic-ephemeral-volumes

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 14, 2021
@k8s-ci-robot
Copy link
Contributor

@pohly: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added 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 Oct 14, 2021
@pohly
Copy link
Contributor Author

pohly commented Oct 14, 2021

/sig storage
/priority important-soon

@k8s-ci-robot k8s-ci-robot added sig/storage Categorizes an issue or PR as relevant to SIG Storage. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 14, 2021
@k8s-ci-robot k8s-ci-robot added the sig/apps Categorizes an issue or PR as relevant to SIG Apps. label Oct 14, 2021
@jsafrane
Copy link
Member

/lgtm
from sig-storage POV.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 14, 2021
@pohly
Copy link
Contributor Author

pohly commented Oct 14, 2021

/retest

test flake

@pohly
Copy link
Contributor Author

pohly commented Oct 14, 2021

/assign @smarterclayton

For approval.

@pohly pohly force-pushed the generic-ephemeral-volume-raw-block branch from 01977a0 to 119725c Compare October 15, 2021 11:49
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 15, 2021
@pohly
Copy link
Contributor Author

pohly commented Oct 15, 2021

After considering potential merge conflicts (now and during backporting, should we decide to do that) my conclusion is that it should be safe to merge the E2E modifications in this PR. Then #105659 can be merged independently.

I also added unit test cases.

/cc @mauriciopoppe

@k8s-ci-robot k8s-ci-robot added area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Oct 15, 2021
@pohly pohly force-pushed the generic-ephemeral-volume-raw-block branch from 119725c to f75913e Compare October 15, 2021 13:08
@pohly
Copy link
Contributor Author

pohly commented Oct 15, 2021

/retest

@@ -418,7 +418,8 @@ func IsMatchedVolume(name string, volumes map[string]core.VolumeSource) bool {

func isMatchedDevice(name string, volumes map[string]core.VolumeSource) (bool, bool) {
Copy link
Member

Choose a reason for hiding this comment

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

it's kinda hard to understand the return value without any comments :(, I read that it's used as didMatch, isPVC := isMatchedDevice(devName, volumes)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's how it was before, but I can of course enhance this while I am touching the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Please take another look.

@@ -297,6 +297,13 @@ var (
SnapshotType: DynamicCreatedSnapshot,
SnapshotDeletionPolicy: DeleteSnapshot,
}
// BlockVolModeGenericEphemeralVolume is for generic ephemeral inline volumes in raw block mode.
BlockVolModeGenericEphemeralVolume = TestPattern{
Name: "Generic Ephemeral-volume (block volmode) (late-binding)",
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about what's our rule to add tags, e.g. [Feature:x] vs (block volmode) or (late-binding)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Round brackets are just comments. They have no special meaning.

if framework.NodeOSDistroIs("windows") {
command = "ls /mnt/test* && sleep 10000"
}
command := "sleep 10000"
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason we're not checking in the Pod command that the paths were mounted? I'm not sure why this command would need to change for block volumes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Block volumes don't get mounted.

The code here could have been made more intelligent, but it was already redundant (the same mount check is done also in individual tests), so I decided to simplify here.

Copy link
Member

@mauriciopoppe mauriciopoppe left a comment

Choose a reason for hiding this comment

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

A few comments about the pattern name and the TestEphemeral command change

Raw block devices are possible with generic ephemeral volumes, so rejecting a
pod with that combination is wrong.
This adds a new test pattern and uses it for the inline volume tests. Because
the kind of volume now varies more, validation of the mount or block device is
always done by the caller of TestEphemeral.
@pohly pohly force-pushed the generic-ephemeral-volume-raw-block branch from f75913e to a90a3c6 Compare October 19, 2021 11:31
@mauriciopoppe
Copy link
Member

Thanks for addressing the comments
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 19, 2021
@pohly
Copy link
Contributor Author

pohly commented Oct 19, 2021

@smarterclayton: PR is ready for approval...

@thockin
Copy link
Member

thockin commented Oct 22, 2021

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pohly, thockin

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 Oct 22, 2021
@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@k8s-ci-robot k8s-ci-robot merged commit 7fbb384 into kubernetes:master Oct 23, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.23 milestone Oct 23, 2021
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/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/storage Categorizes an issue or PR as relevant to SIG Storage. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants