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

Readable volume names #334

Closed
wants to merge 26 commits into from

Conversation

mcronce
Copy link

@mcronce mcronce commented Aug 27, 2019

What type of PR is this?
/kind feature

What this PR does / why we need it:
Adds an option for the dynamic provisioner to produce PVs with human-readable names. This enables the storage administrator to go straight to the storage layer, usually[1] without having to detour to the Kubernetes API to ask about PV names, to manually inspect or hand-edit an application's config/database/etc.

[1] Even with this enabled, in cases where you have lots of PVCs with similar names in similarly-named namespaces, you might still need to ask the Kubernetes API to find the right PV.

Which issue(s) this PR fixes:
Fixes #67

Special notes for your reviewer:
I've had these changes made for nine months and have been merging master in periodically, using a container image built from my fork in a staging environment. It's definitely passed the test of time. :)

Does this PR introduce a user-facing change?:

Adds an option (`--volume-names-readable`) to produce PVs with human-readable names; with cooperation from the CSI driver, this can make it easier for storage administrators to find state for a given application.

Mike Cronce and others added 23 commits December 5, 2018 20:28
…re enabled, use a hash of the PVC namespace and name in place of the UID, making the entire PV name deterministic
Signed-off-by: Grant Griffiths <ggp493@gmail.com>
Backport kubernetes-csi#274 from the master
[release-1.2] Add secret support for Provision and Delete from pvc name and namespace
With the current implementation, In delayed binding case, CSI driver is offered
with all nodes topology that are matched with 'selected node' topology keys in
CreateVolumeRequest.AccessibilityRequirements. So this allows the driver to
select any node from the passed preferred list to create volume. But this
results in scheduling failure when the volume created on a node other than
Kubernetes selected node.

To address this, introduced new flag "--strict-topology', when set, in case of
delayed binding, the driver is offered with only selected node topology, so that
driver has to create the volume on this node.

Modified tests so that now every test is run with and without 'strict topology'.
[release-1.2]  Introduce new flag - strict-topology
[cherry-pick] Bump version of csi-translation-lib for CSI Migration support for Azure Disk/File, as well as fixes for GCE PD
…r election processes from running; Leader election namespacing
…ble-in-lib-1.12

Cherry-pick of kubernetes-csi#296: "Leader election: disable duplicate LE in provisioner lib; add lock namespacing"
Cherry-pick 1.2 changelog to release-1.2
Cherry-pick kubernetes-csi#302 to release-1.2: update readme with --leader-election-namespace flag
@k8s-ci-robot
Copy link
Contributor

Welcome @mcronce!

It looks like this is your first PR to kubernetes-csi/external-provisioner 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-csi/external-provisioner has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@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/feature Categorizes issue or PR as related to a new feature. labels Aug 27, 2019
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 27, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @mcronce. Thanks for your PR.

I'm waiting for a kubernetes-csi or kubernetes 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.

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 removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 5, 2019
pvcHash := md5.Sum([]byte(pvcNamespace + "/" + pvcName))
pvcNamespace = strings.Replace(pvcNamespace, "-", "", -1)
pvcName = strings.Replace(pvcName, "-", "", -1)
fullName = fmt.Sprintf("%s-%s-%x", pvcNamespace, pvcName, pvcHash)
Copy link
Contributor

@jsafrane jsafrane Sep 19, 2019

Choose a reason for hiding this comment

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

Both namespace name and PV names can be up 63 characters long. PV name is also limited to 63 characters. With long namespace names, there may be no space for PVC name nor the hash and the resulting name is not unique.

Copy link
Author

Choose a reason for hiding this comment

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

I didn't realize PV names were limited to 63 characters; however, even with that in mind, it's going to be desirable for some administrators (me, for example) to trade having to be careful about namespace/PVC naming for being able to find storage more easily.

I can certainly add more clarity to the help text on the flag.

Copy link
Contributor

Choose a reason for hiding this comment

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

Both namespace name and PV names can be up 63 characters long. PV name is also limited to 63 characters

I checked today and I was wrong, namespace name is has limit 63 characters, but PVC name can have 253 characters. CSI specifies that any string, incl. volume name, can have up to 128 characters. So you don't have even place for full PVC name, not mentioning the namespace.

@jsafrane
Copy link
Contributor

Please do not use merge commits, branch always from master branch and rebase periodically.

@jsafrane
Copy link
Contributor

And if you find a better way how to compute unique, yet human friendly names, please add unit tests.

@msau42
Copy link
Collaborator

msau42 commented Sep 20, 2019

The PVC name + namespace is available in the PV object. Is it sufficient when listing PV objects to have it output the PVC name + namespace?

@@ -53,6 +53,7 @@ var (
_ = deprecatedflags.Add("connection-timeout")
volumeNamePrefix = flag.String("volume-name-prefix", "pvc", "Prefix to apply to the name of a created volume.")
volumeNameUUIDLength = flag.Int("volume-name-uuid-length", -1, "Truncates generated UUID of a created volume to this length. Defaults behavior is to NOT truncate.")
volumeNamesReadable = flag.Bool("volume-names-readable", false, "If enabled, includes the PVC namespace and name in VolumeRequests' suggested names. Note that, combined with --volume-name-uuid-length, this can cause naming collisions.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Name collision can lead to stealing data. If attacker crafts namespace + pvc name that leads to collision with existing volume, CSI driver, obeying idempotency, must return the same volume as someone else is already using. Kubernetes is multi-tenant system and must not allow stealing data between namespaces.

Copy link
Author

Choose a reason for hiding this comment

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

Yes; that is a trade off that must be considered when using this option. Some of us are not administrating multi-tenant Kubernetes systems. We're administering single-tenant Kubernetes systems that, for example, require an easy to way to find a given application's data in the storage provider.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 10, 2019
@mcronce
Copy link
Author

mcronce commented Dec 12, 2019

The PVC name + namespace is available in the PV object. Is it sufficient when listing PV objects to have it output the PVC name + namespace?

Unfortunately, it does not. When I'm on a storage node I don't have access to the Kubernetes API.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 11, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mcronce
To complete the pull request process, please assign jsafrane
You can assign the PR to them by writing /assign @jsafrane in a comment when ready.

The full list of commands accepted by this bot can be found 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 removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 4, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 4, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

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

@mcronce: PR needs rebase.

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.

@mcronce
Copy link
Author

mcronce commented Jun 3, 2020

/reopen

@k8s-ci-robot
Copy link
Contributor

@mcronce: Reopened this PR.

In response to this:

/reopen

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 reopened this Jun 3, 2020
@k8s-ci-robot
Copy link
Contributor

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

Test name Commit Details Rerun command
pull-kubernetes-csi-external-provisioner-1-17-on-kubernetes-1-17 37f5d4c link /test pull-kubernetes-csi-external-provisioner-1-17-on-kubernetes-1-17
pull-kubernetes-csi-external-provisioner-1-18-on-kubernetes-1-18 37f5d4c link /test pull-kubernetes-csi-external-provisioner-1-18-on-kubernetes-1-18
pull-kubernetes-csi-external-provisioner-unit 37f5d4c link /test pull-kubernetes-csi-external-provisioner-unit
pull-kubernetes-csi-external-provisioner-1-16-on-kubernetes-1-16 37f5d4c link /test pull-kubernetes-csi-external-provisioner-1-16-on-kubernetes-1-16

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.

@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

PVC.UID for volume name unique but hard for humans to differentiate
10 participants