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

feat: enable support for single AP per SC #1

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

portellaa
Copy link
Member

@portellaa portellaa commented Sep 15, 2022

Is this a bug fix or adding new feature?
This PR is based on the work from @jonathanrainer in the PR kubernetes-sigs#640

What is this PR about? / Why do we need it?
The only change we did that fits our needs was add a new parameter to the storage class to allow the developer to specify a single AccessPoint that will be used through all the Volumes created by that StorageClass.
We suffer a lot with the 120 APs limitation, since we dynamically provision new resources based on user input or needs.

Also we don't run our workloads with root access, so we can't use the dir options also introduced in the PR kubernetes-sigs#732

Yes, we could create a static PV and use the PV across all the workloads, **and probably that's the best solution for most of the people), but giving the way we have our architecture, this wouldn't fit well.

What testing is done?
We are testing this yet, so far so good it seems to be working.

⚠️ Disclaimer ⚠️
Probably this isn't the best option for the case, or something that most of the people will approve or thing as useful, but it fits our necessity.
We will think in a solution that we would that could fit most of the people that needs this, so far for us this makes sense, because each AP is limited to a UID/GID and you can create folder inside of it, for example, let's imagine users home directory, for multiple users:

AP 1, UID=1001, GID=1001

  • /user1/desktop
  • /user1/downloads
  • /user1/pictures
  • /user1/pictures/bananas
  • ...

AP2, UID=1002, GID=1002

  • /user2/desktop
  • /user2/downloads
  • /user2/pictures
  • ...

for example this works, of course you would need to specify a storage class per user and you are still limited to the 120 APs, but well, we are trying to get somewhere to "bypass" that limitation and still have permissions in the structure.

jonathanrainer and others added 13 commits June 25, 2022 21:10
Adding subPathPattern allows us to support more use cases than before because
now users can specify a template they wish to be created when the access
point is created. This template matches the form of the nfs-subdir-provioner
which aids consistency. This defaults to /${.PV.name} to be in keeping with
current behaviour but allows much more flexibility.
These functions allow us to take a pattern and turn it into a valid directory name. These can then be called in the method that builds up the directory name to be sent to the API.
Adds happy path testing for subPathPattern including whether it plays nicely with existing basePath parameter
Removing the 0-length check allows us to support not setting a basePath but having
an empty pattern, as distinct from not setting subPathPattern, which means "/" can
be used as a valid accessPoint path.
This ensures we can control when we want directories created under
dynamic provisioning to be unique and when we don't (poweruser mode).
This also adds some successful tests, next commit will add the
failure cases to make sure all bases are covered.
Added a fix around the handling for misconfiguration of the
ensureUniqueDirectory whereby if it's misconfigured it will fall through
to its default value.
This has come up in several issues on the repo where people set
basePath to `/` and this leads to problems. This proves this PR
resolves that issue and doesn't lead to the problems of a path like
`//`
Copy link

@renatoaguimaraes renatoaguimaraes left a comment

Choose a reason for hiding this comment

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

well done 🚀

pkg/driver/controller.go Show resolved Hide resolved
pkg/driver/controller.go Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants