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

StorageOS configurable device directory and mount options #58816

Merged

Conversation

croomes
Copy link
Contributor

@croomes croomes commented Jan 25, 2018

What this PR does / why we need it:
This allows StorageOS volumes to be mounted when the kubelet is running in a container and we are unable to use the default device location (/var/lib/storageos/volumes). With this PR, the node's device location is requested via the StorageOS api, falling back to the current behaviour if not configured. The node's device location can be supplied as an environment variable (DEVICE_DIR) to the StorageOS container. This is backwards-compatible and no changes are needed to existing deployments.

The PR also allows Mount options to be set for StorageOS volumes in the same way they're enabled for other volume plugins.

The StorageOS API dependency was updated to the latest version, but no functionality changes besides adding the DeviceDir property to the Controller object.

There is also a small refactor of the loopback device handling code in storageos_utils.go to capture stderr output.

Release note:

StorageOS volume plugin updated to support mount options and environments where the kubelet runs in a container and the device location should be specified.

Not sure why godep changed the comments of unrelated packages in Godeps.json...

/sig storage

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 25, 2018
@@ -323,27 +346,30 @@ func getLoopDevice(path string, exec mount.Exec) (string, error) {
}

args := []string{"-j", path}
out, err := exec.Run(losetupPath, args...)
cmd := exec.Command(losetupPath, args...)
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment that you intentionally run where kubelet is (e.g. in kubelet's container).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsafrane thanks for the review, but quick question as I noticed that I reverted the VolumeHost.GetExec() change you made without fully understanding it.

While we expect the mount utilities (incl losetup) to run where the kubelet runs, we don't require it. We just need the device and mount to be available in the correct place and where the kubelet can see them.

Unless you can think of any gotchas or I'm misunderstanding, I'll revert this bit.

Also fyi: the Block Volume support loop device code seems to have used this as a base, and doesn't use VolumeHost.GetExec(). Not sure if this was intentional, and if it was do I need the same here? https://github.com/kubernetes/kubernetes/blob/master/pkg/volume/util/util_linux.go. Maybe @mtanino can advise?

Copy link
Member

Choose a reason for hiding this comment

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

In 1.9 there is a possibility to run mount utilities (mount.nfs, iscsiadm, mkfs.btrfs, ..., losetup) in a dedicated container instead of the host (which can be a minimal one like CoreOS) or in the container where kubelet runs (which can have just kubelet). The setup is quite elaborate and it is dedicated only for testing in our e2e tests, which run quite minimal GCI image (but it has losetup). VolumeHost.GetExec() is used to execute things in these containers with mount utilities instead of on the host. You probably should use this interface for losetup too, just in case someone has really minimal OS without it.

In addition, it would be great if you could prepare container(s) with the server parts of StorageOS and e2e tests that would deploy it and test the plugin against. This way, we could test our plugin and make sure there are no regressions as the plugin evolves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll revert this bit. We're working on the e2e tests separately. I'm hoping we can get a PR for them in the next few weeks.

Copy link
Member

Choose a reason for hiding this comment

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

I still see you use exec.Command directly, did you plan to revert it back to mount.Exec interface?

out, err := exec.Run(losetupPath, args...)
func makeLoopDevice(path string) (string, error) {
args := []string{"-f", "-P", "--show", path}
cmd := exec.Command(losetupPath, args...)
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment that you intentionally run where kubelet is (e.g. in kubelet's container).

args := []string{"-d", device}
out, err := exec.Run(losetupPath, args...)
cmd := exec.Command(losetupPath, args...)
Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment that you intentionally run where kubelet is (e.g. in kubelet's container).

@jsafrane
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 29, 2018
@jsafrane
Copy link
Member

/retest

@jsafrane
Copy link
Member

flake: #58975

@cblecker
Copy link
Member

/retest

@croomes croomes force-pushed the storageos_containerized_kubelet branch from 3500580 to 81456bf Compare February 5, 2018 17:00
@croomes
Copy link
Contributor Author

croomes commented Feb 6, 2018

@jsafrane reverted the exec changes, but just noticed the Godeps conflict, will resolve tomorrow.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 6, 2018
@croomes croomes force-pushed the storageos_containerized_kubelet branch from 81456bf to 035a080 Compare February 6, 2018 13:36
This change queries the StorageOS API to retrieve the volume
device dir when a volume is attached, rather than relying on
the default /var/lib/storageos/volumes directory.  This allows
all or some nodes to have kubelet running in a container with
the StorageOS volume path mounted in, which is required for
Azure ACS support.

Volume mount options are also supported.
@croomes croomes force-pushed the storageos_containerized_kubelet branch from 035a080 to 1a91403 Compare February 6, 2018 13:52
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 6, 2018
@croomes
Copy link
Contributor Author

croomes commented Feb 7, 2018

@jsafrane I think this is good to go now, PTAL - thanks

@jsafrane
Copy link
Member

jsafrane commented Feb 9, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 9, 2018
@jsafrane
Copy link
Member

jsafrane commented Feb 9, 2018

/assign @thockin
for vendor approval

@jsafrane
Copy link
Member

/approve no-issue
/retest

@croomes
Copy link
Contributor Author

croomes commented Feb 12, 2018

/test pull-kubernetes-e2e-kubeadm-gce-canary

1 similar comment
@croomes
Copy link
Contributor Author

croomes commented Feb 13, 2018

/test pull-kubernetes-e2e-kubeadm-gce-canary

@croomes
Copy link
Contributor Author

croomes commented Feb 15, 2018

/test pull-kubernetes-e2e-kubeadm-gce-canary

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Feb 15, 2018

@croomes: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-kubeadm-gce-canary 1a91403 link /test pull-kubernetes-e2e-kubeadm-gce-canary

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@croomes
Copy link
Contributor Author

croomes commented Feb 19, 2018

/test pull-kubernetes-e2e-kubeadm-gce-canary

@thockin
Copy link
Member

thockin commented Feb 23, 2018

In the future, please file bugs so we can xref them in PRs.

/lgtm
/approve no-issue

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: croomes, jsafrane, 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 Feb 23, 2018
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 9a75b4d into kubernetes:master Feb 23, 2018
@croomes
Copy link
Contributor Author

croomes commented Feb 27, 2018

/status approved-for-milestone

@k8s-ci-robot
Copy link
Contributor

You must be a member of the kubernetes/kubernetes-milestone-maintainers github team to add status labels.

@croomes
Copy link
Contributor Author

croomes commented Feb 27, 2018

@saad-ali are you able to help get this into 1.10 release? Was hoping it would have gone in automatically...

@jsafrane
Copy link
Member

Don't worry, it's merged into master so it's going to be part of 1.10. It splits from master in upcoming week(s).

@croomes
Copy link
Contributor Author

croomes commented Feb 27, 2018

Fantastic, thanks for letting me know!

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/storage Categorizes an issue or PR as relevant to SIG Storage. 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.

6 participants