-
Notifications
You must be signed in to change notification settings - Fork 38.9k
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
Support dynamic provisioning for CSI migration scenarios #73653
Conversation
/sig storage |
@ddebroy thanks for this PR! I will review shortly. Would recommend that you create a separate PR for the translation library staging change. Since the external provisioner depends on it lets fast track that and merge it separately. |
// Set provisionerName to CSI plugin name for setClaimProvisioner | ||
provisionerName, err = csitranslation.GetCSINameFromIntreeName(storageClass.Provisioner) | ||
if err != nil { | ||
strerr := fmt.Sprintf("Failed to get CSI name for In tree plugin: %s", storageClass.Provisioner) |
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 print the
err
so it's instrerr
itself? - also we can drop the klog as we are returning the err as well as logging it.
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.
The convention in provisionClaimOperation
appears to be to klog.V(2|3).Infof(...)
all errors besides returning them as well as reporting the event with ctrl.eventRecorder.Event
. So I was following the convention elsewhere in provisionClaimOperation
. @jsafrane please confirm the convention.
I will change the error message to include the whole error as suggested.
PR #73734 supersedes the csi-translation-lib bits of of this PR. |
if plugin != nil { | ||
pluginName = plugin.GetPluginName() | ||
if plugin.IsMigratedToCSI() { |
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.
Please add an unit test for this. "11-17 - external provisioner"
could be a good start. You need to inject a volume plugin that's migrated to CSI, some variant of wrapTestWithPluginCalls
might be 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.
Updated PR with 11-21 - external provisioner for CSI migration
testcase to make sure for CSI migration scenarios, provisioning ends up waiting for a claim with annotation vendor.com/MockCSIPlugin
and event Normal ExternalProvisioning
.
@@ -40,6 +40,11 @@ func NewAWSElasticBlockStoreCSITranslator() InTreePlugin { | |||
return &awsElasticBlockStoreCSITranslator{} | |||
} | |||
|
|||
// TranslateInTreeStorageClassParametersToCSI translates InTree EBS storage class parameters to CSI storage class |
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.
IMO, this can be removed now.
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.
Thanks for the test! Please remove one commented-out line and I think we're good to go.
|
||
// For testing only: hook to intercept CSI driver name <=> Intree plugin name mapping | ||
// Not used when set to nil | ||
csiNameFromIntreeNameHook func(pluginName string) (string, error) |
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.
In long term it would be better if CSI translation library provided an interface instead of function calls so its callers can create fake implementations for unit tests. As a separate PR, of course, no need to fix it here.
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.
Agree.
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.
xref" #74594
// of not setting pluginName for external provisioners (including CSI) | ||
// Set provisionerName to CSI plugin name for setClaimProvisioner | ||
provisionerName, err = ctrl.getCSINameFromIntreeName(storageClass.Provisioner) | ||
// provisionerName, err = csitranslation.GetCSINameFromIntreeName(storageClass.Provisioner) |
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: please remove
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
Signed-off-by: Deep Debroy <ddebroy@docker.com>
Addressed code review comment and squashed commits |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ddebroy, jsafrane 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 |
/retest Review the full test history for this PR. Silence the bot with an |
2 similar comments
/retest Review the full test history for this PR. Silence the bot with an |
/retest Review the full test history for this PR. Silence the bot with an |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR introduces a set of changes needed in in-tree PV Controller to call out to the external provisioning controller for in-tree plugins if they are migratable to CSI. The basic steps are:
annStorageProvisioner
in the PVC to CSI plugin name that superseded the specified in-tree plugin.In addition to the above, the PR also introduces a new API
TranslateInTreeStorageClassParametersToCSI
in the CSI translation staging repo. This will be used by the external provisioner to translate from in-tree storage class parameters to CSI plugin parameters.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Part of enhancements for kubernetes/enhancements#625
For the changes in this PR to take an effect, we need a separate set of changes in https://github.com/kubernetes-sigs/sig-storage-lib-external-provisioner.git which does the following:
getStorageClassFields
to check (throughGetCSINameFromIntreeName
) if the storageclass provisioner has a corresponding CSI plugin that supersedes it. If so:getStorageClassFields
aware that it's handling dynamic volume provisioning for an in-tree plugin that has been migrated to CSI because [a] For regular in-tree provisioning path, external provisioning will never get invoked [b] For regular CSI provisioning path,GetCSINameFromIntreeName
would not return anything for a CSI plugin name.getStorageClassFields
to [a] translate in-tree storage class parameters to the corresponding CSI plugin parameters usingTranslateInTreeStorageClassParametersToCSI
[b] return the CSI plugin name (instead of the storage class in-tree provisioner) as the provisioner name (so that it aligns withctrl.provisionerName
) and [c] return a boolean toprovisionClaimOperation
indicating dynamic provisioning in a CSI migration contextprovisionClaimOperation
to invokeTranslateCSIPVToInTree
for dynamic provisioning in a CSI migration context.The above PR depends on
TranslateInTreeStorageClassParametersToCSI
from this PR to be staged first.Does this PR introduce a user-facing change?:
/sig-storage
/assign @jsafrane @saad-ali
/cc @msau42 @leakingtapan @davidz627