-
Notifications
You must be signed in to change notification settings - Fork 336
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
Add --pvc-annotation-mappings arg to pass pvc annotations to parameters #173
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mkimuram If they are not already assigned, you can assign the PR to them by writing 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 |
Could you check if this PR fit to your use cases? @jsafrane @princerachit @saad-ali PTAL
|
@mkimuram I quickly glanced over, but I believe this only allows us to pass a fixed set of parameters, defined as an argument to the external provisioner. This still doesn't allow me to pass custom, dynamic data per volume ? |
Thank you for your feedback.
Do you intend to pass different annotation keys per volume, instead of different annotation values per volume? ex)
In other word, value for If different annotation keys per volume is required and they aren't decided at the time of csi external-provisioner start up, this PR won't meet the requirement, for all the set of annotation keys can't be passed as csi external-provisioner's argument. |
pkg/controller/controller.go
Outdated
@@ -834,3 +838,21 @@ func bytesToGiQuantity(bytes int64) resource.Quantity { | |||
stringQuantity := fmt.Sprintf("%v%s", num, suffix) | |||
return resource.MustParse(stringQuantity) | |||
} | |||
|
|||
func createVolumeRequestParameters(options controller.VolumeOptions, mappings map[string]string) map[string]string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a UT for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your comment.
I will add unit tests for this, once we reach to the agreement that this specification is good to everyone.
I rebased and add unit tests. PTAL I hope that you could also review this, because you recently changed the related codes, so you have knowledge on how csi external provisioner should pass parameters from k8s to CSI drivers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code change mostly lgtm.
@@ -65,6 +66,7 @@ func init() { | |||
|
|||
flag.Var(utilflag.NewMapStringBool(&featureGates), "feature-gates", "A set of key=value pairs that describe feature gates for alpha/experimental features. "+ | |||
"Options are:\n"+strings.Join(utilfeature.DefaultFeatureGate.KnownFeatures(), "\n")) | |||
flag.Var(utilflag.NewMapStringString(&pvcAnnotationMappings), "pvc-annotation-mappings", "A set of key=value pairs that describe how pvc annotation should be mapped to parameters that are passed to csi drivers.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this description is a little confusing since its not really key=value
, it's actually more like pvcannotationkey=csidriverparameterkey
(<- this isn't actually good I urge you to reword so that this concept is more clear though)
func addSpecifiedAnnotationsToParameters(param map[string]string, annotation map[string]string, mapping map[string]string) map[string]string { | ||
newParam := map[string]string{} | ||
// Copy all existing parameters | ||
for k, v := range param { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add to existing param map instead of creating a new one?
@mkimuram I am a little concerned with the overall design of this feature though. But also I don't think I fully understand the use case. "Who" is setting the PVC annotation (end user)? Is this a different user than the one creating the storage class (an admin)? If these users are actually the same person (end user + admin), then why do we need the mapping, this user can just make sure that the names are not colliding and we can throw an error if the annotations collide with storage class parameters. But the concern about PVC providing information specific to a driver implementation is still present here. |
I strongly agree with @davidz627. The Kubernetes PVC object is intended for application portability. When we start leaking cluster specific details in to it we are violating that principle. And explicitly passing PVC annotations encourages that pattern. Let's discuss the specific use cases you have in mind, and see if we can come up with better solutions for each of those uses cases (for example, what we did for passing pod workload information to drivers on /hold |
Thank you for your confirmation. This should be the point that we all have the same understanding. As for my use case, it is end user who sets PVC annotation and the user is different from admin. One of the example use cases was cloning the volume from another volume like it is done in Gluster driver. I know that we are adding snapshot and cloning feature, so this feature won't be necessary for this particular use case. However, there will be other use cases that could be solved by this feature until k8s become available, like setting QOS, tiering policy, and so on, per volume basis. These kinds of parameters can also be defined to StorageClass, but number of StorageClasses will explode, if the number of combinations increase. Therefore, per volume parameter will be useful in such a situation.
I agree that above use of annotation would cause the situation that you mentioned and it potentially causes compatibility issues between cluster. However, I believe that PVC annotation was intended to allow enabling these kinds of things, so it will be more useful than harmful, if it is properly warned to end users. |
Workload portability is a corner stone of Kubernetes. It is one of the major reasons for the success of the project. We must be very careful when we violate it. And Driver developer velocity, to me, is not sufficient justification. When we add anything to the CSI I am happy to discuss this more at the SIG Storage meeting if folks want. |
Thank you for your comment.
I understand that discussion is going back to this comment and
I will wait for that someone provide better use cases or reasons that this feature should be prioritized over workload portability. Until then, anyone who need this feature will need to port this PR to their own external provisioner. (Or do their own implementation.) |
…-flags 2.0 prep: Remove deprecated flags
What this PR does / why we need it:
As discussed in #86, current csi external-provisioner doesn't pass any pvc annotations to a csi driver. This PR add command line option for csi external provisioner so that it can pass specific set of pvc annotations to a csi driver.
Which issue(s) this PR fixes
Fixes: #86
Special notes for your reviewer:
--pvc-annotation-mappings
command line option for csi external provisioner,--pvc-annotation-mappings=annotation1=parameter1,annotation2=annotation2
,[Annotations]
[Parameters]
--pvc-annotation-mappings
isn't specified,--pvc-annotation-mappings
,