-
Notifications
You must be signed in to change notification settings - Fork 349
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 metadata to createvolume req #399
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. |
Welcome @zetsub0u! |
Hi @zetsub0u. Thanks for your PR. I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
/assign @msau42 |
@zetsub0u please sign the CLA |
Hi, yes i followed the steps but i'm not getting the document to sign via email and i'm trying to figure out what to do now. Also i'll check the unittests, i completely forgot to run them as it was a simple change. |
CLA signed, i guess need to wait for the bot to retest. |
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.
pkg/controller/controller.go
Outdated
@@ -101,6 +101,11 @@ const ( | |||
nodePublishSecretNameKey = "csiNodePublishSecretName" | |||
nodePublishSecretNamespaceKey = "csiNodePublishSecretNamespace" | |||
|
|||
// PVC's name and namespace passed on create requests, useful for the plugin to query for extra data | |||
// prior to performing operations | |||
pvcNameKey = "kubernetes.io/created-for/pvc/name" |
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.
can we also add pv name as one of these?
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.
We thought about this but, the PV name is generated in the provisioner and passed in the request as the Name field already and always, do you see any need for adding it into the parameters also?
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.
would prefer it is added to the parameters as well. Using it as the name is just an implementation choice in the provisioner not an explicit contract so it could technically change.
pkg/controller/controller.go
Outdated
@@ -567,6 +572,10 @@ func (p *csiProvisioner) ProvisionExt(options controller.ProvisionOptions) (*v1. | |||
return nil, controller.ProvisioningFinished, fmt.Errorf("failed to strip CSI Parameters of prefixed keys: %v", err) | |||
} | |||
|
|||
// add pvc metadata to request for use by the plugin | |||
req.Parameters[pvcNameKey] = options.PVC.GetName() |
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.
we should gate this behind a feature flag or binary flag of some sort. This is a breaking change for drivers that do validation on parameters and don't expect extra stuff coming in. (this should default to off and you can turn it on if you want this information)
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.
It seems like the featureGate flag used here is being pulled from the api server, i'm not too sure if i should extend it with custom provisioner-only feature gates or just add a boolean flag say --inject-pvc-metadata
, what do you think is the best approach?
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 a boolean flag is fine. I suck at naming so I can't come up with another solution but I don't think it should contain pvc
in it since we will inject pv/pvc
name. It should also have some sort of information of "where" it is injecting the metadata. extra-create-params-metadata
?
Can you add a comment disclaimer as a flag comment along the lines of:
This metadata should only be used for tagging or descriptive purposes and should in no circumstances be consumed and acted on programatically by a CSI Driver.
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.
Are we going to follow some sort of Alpha->Beta->GA plan for this flag?
If so can we include the stage in the name '--extra-create-params=alpha-pvc'?
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.
no need for a stage - just a single flag should be fine
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.
Or do you prefer
--enable-extra-metadata-for-create-req If set, add pv/pvc metadata to plugin create requests as parameters.
I have both implement, just let me know which makes more sense.
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 personally prefer the feature gate and have it go to default at some point.
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.
we can't set this as a default unless we bump the major version of the provisioner - it is a breaking change to drivers as this is adding "unexpected" parameters to their CreateVolume API call. I don't really see the value of feature gating this as the intention for that is to slowly "graduate" features to minimize risk. I wouldn't really consider this a risky feature in terms of potential impact or implementation
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.
Ok, i'll add a standard flag for this, any suggestions on naming? Anything else needing change? I couldn't find any place to document this feature for consumption...
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.
Also open an issue to track changing it to default, and we can add it to the 2.0 milestone
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.
mostly lgtm
leaderElectionType = flag.String("leader-election-type", "endpoints", "the type of leader election, options are 'endpoints' (default) or 'leases' (strongly recommended). The 'endpoints' option is deprecated in favor of 'leases'.") | ||
leaderElectionNamespace = flag.String("leader-election-namespace", "", "Namespace where the leader election resource lives. Defaults to the pod namespace if not set.") | ||
strictTopology = flag.Bool("strict-topology", false, "Passes only selected node topology to CreateVolume Request, unlike default behavior of passing aggregated cluster topologies that match with topology keys of the selected node.") | ||
enableExtraMetadataForCreateReq = flag.Bool("enable-extra-metadata-for-create-req", false, "If set, add pv/pvc metadata to plugin create requests as parameters.") |
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.
nit: enable
not necessary (implied by boolean flag), req
not required (implied by create)
extra-create-metadata
is probably sufficient
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.
Done, i hate naming things :)
pkg/controller/controller.go
Outdated
// PV and PVC metadata, used for sending to drivers in the create requests, added as parameters, optional. | ||
pvcNameKey = "kubernetes.io/created-for/pvc/name" | ||
pvcNamespaceKey = "kubernetes.io/created-for/pvc/namespace" | ||
pvNameKey = "kubernetes.io/created-for/pv/name" |
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.
cc @saad-ali is this an acceptable prefix? maybe it should be one of the volume specific prefixes?
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 would prefer to use the same prefix as for pod info on mount: csi.storage.k8s.io/...
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.
Sounds good, updated.
@davidz627 Let me know if you need any other changes. Thanks. |
pkg/controller/controller.go
Outdated
pvcNameKey = "csi.storage.k8s.io/created-for/pvc/name" | ||
pvcNamespaceKey = "csi.storage.k8s.io/created-for/pvc/namespace" | ||
pvNameKey = "csi.storage.k8s.io/created-for/pv/name" |
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.
Would it make sense to use the same schema we use in NodePublish?
csi.storage.k8s.io/pvc/name
csi.storage.k8s.io/pvc/namespace
csi.storage.k8s.io/pv/name
I know CSI drivers that support migration need to translate it to created-for/
format, still, it would make life of all the non-migrating drivers a bit easier.
Oh, and please edit the first comment and add useful release note there (instead of |
@zetsub0u Thanks for the change! Please squash commits to 1 well described commit :) |
Adds --extraCreateMetadata flag which, when enabled, will inject parameters onto CreateVolume driver requests with PVC and PV metadata. Injected keys: - csi.storage.k8s.io/pvc/name - csi.storage.k8s.io/pvc/namespace - csi.storage.k8s.io/pv/name Co-authored-by: abrden <[email protected]>
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: davidz627, jsafrane, zetsub0u 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 |
Thanks! We really needed this feature and didn't want to fork :) |
the external-csi provisioner optionally injects metadata in the CreateVolume that we now preserve as tags on the volume. kubernetes-csi/external-provisioner#399
The external CSI provisioner optionally injects metadata in the CreateVolume that we can pass onto the volume as additional tags. See kubernetes-csi/external-provisioner#399 Signed-off-by: Fabian Ruff <[email protected]>
The external CSI provisioner optionally injects metadata in the CreateVolume that we can pass onto the volume as additional tags. See kubernetes-csi/external-provisioner#399 Signed-off-by: Fabian Ruff <[email protected]>
The external CSI provisioner optionally injects metadata in the CreateVolume that we can pass onto the volume as additional tags. See kubernetes-csi/external-provisioner#399 Signed-off-by: Fabian Ruff <[email protected]>
* [cinder-csi-plugin] Tag volume with optional metadata The external CSI provisioner optionally injects metadata in the CreateVolume that we can pass onto the volume as additional tags. See kubernetes-csi/external-provisioner#399 Signed-off-by: Fabian Ruff <[email protected]> * Add --extra-create-metadata to csi-provisoner manifests Signed-off-by: Fabian Ruff <[email protected]> * Add unit test for extra metadata Signed-off-by: Fabian Ruff <[email protected]> * Bump chart again. Signed-off-by: Fabian Ruff <[email protected]>
…tes#1492) * [cinder-csi-plugin] Tag volume with optional metadata The external CSI provisioner optionally injects metadata in the CreateVolume that we can pass onto the volume as additional tags. See kubernetes-csi/external-provisioner#399 Signed-off-by: Fabian Ruff <[email protected]> * Add --extra-create-metadata to csi-provisoner manifests Signed-off-by: Fabian Ruff <[email protected]> * Add unit test for extra metadata Signed-off-by: Fabian Ruff <[email protected]> * Bump chart again. Signed-off-by: Fabian Ruff <[email protected]>
Update CHANGELOG-4.1.md
Co-authored-by: abrden [email protected]
What type of PR is this?
What this PR does / why we need it:
Add PVC metadata to plugin call in the CreateVolume operation for it to be able to query for more information if needed during volume creation.
Which issue(s) this PR fixes:
Fixes #370
Special notes for your reviewer:
Does this PR introduce a user-facing change?: