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

Disable in-tree plugin without enabling CSI migration #98243

Merged
merged 1 commit into from Jan 29, 2021

Conversation

Jiawei0227
Copy link
Contributor

@Jiawei0227 Jiawei0227 commented Jan 20, 2021

What type of PR is this?
/kind feature

What this PR does / why we need it:
This commit replaces all the alpha CSIMigrationXXXComplete
flag with InTreePluginXXUnregister flag. This new flag will
be a superset of the CSIMigrationXXXComplete. But this
decouple the plugin unregister from CSI migration. So
if a K8s distribution want to go directly with CSI and
do not support in-tree, they can use this flag directly.

For the only beta feature CSIMigrationvSphereComplete, we
deprecate it and it will be removed in 1.22.

Testing:

  1. Enable the InTreePluginXXUnregister and not CSIMigrationXXX,
    verify that the PVC using old plugin name will have error
    saying cannot find the plugin
  2. Enable both the InTreePluginXXUnregister and CSIMigrationXXX
    verify that the PVC using old plugin name will start to use
    the migrated CSI plugin

Which issue(s) this PR fixes:

Fixes #96730

Special notes for your reviewer:
We will deprecate the CSIMigrationvSphereComplete feature flag.

Does this PR introduce a user-facing change?:

ACTION REQUIRED: Remove alpha CSIMigrationXXComplete flag and add alpha InTreePluginXXUnregister flag. Deprecate CSIMigrationvSphereComplete flag and it will be removed in 1.22.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


TODO:
Remove CSIMigrationvSphereComplete flag after deprecation over.

/sig storage
/assign @msau42 @mattcary

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. sig/storage Categorizes an issue or PR as relevant to SIG Storage. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubelet sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/node Categorizes an issue or PR as relevant to SIG Node. labels Jan 20, 2021
@ehashman ehashman added this to Waiting on Author in SIG Node PR Triage Jan 20, 2021
@Jiawei0227 Jiawei0227 changed the title [WIP]Disable in-tree plugin without enabling CSI migration Disable in-tree plugin without enabling CSI migration Jan 21, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 21, 2021
@Jiawei0227
Copy link
Contributor Author

/cc @gnufied @xing-yang

@xing-yang
Copy link
Contributor

/cc @divyenpatel

@fedebongio
Copy link
Contributor

/remove-sig api-machinery

@k8s-ci-robot k8s-ci-robot removed the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jan 21, 2021
if err != nil {
klog.Warningf("Unexpected CSI Migration Feature Flags combination detected: %v. CSI Migration may not take effect", err)
// TODO: fail and return here once alpha only tests can set the feature flags for a plugin correctly
}
if featureGate.Enabled(features.CSIMigration) && featureGate.Enabled(pluginMigration) && featureGate.Enabled(pluginMigrationComplete) {
klog.Infof("Skip registration of plugin %s since feature flag %v is enabled", inTreePluginName, pluginMigrationComplete)
if featureGate.Enabled(pluginInfo.pluginUnregisterFeature) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we combine this and the vSphere-specific check at line 53 into a single function in csimigration? Then instead of copying these two stanzas across cmd/kubelet, cmd/kube-controller-manager, etc etc we have the logic consolidated into one place. That will make it easier to remove the vSphere flag anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 22, 2021
SIG Node PR Triage automation moved this from Needs Approver to Done Jan 29, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Jan 29, 2021
rfranzke added a commit to gardener/gardener-extension-provider-aws that referenced this pull request Apr 9, 2021
rfranzke added a commit to gardener/gardener-extension-provider-aws that referenced this pull request Apr 9, 2021
rfranzke added a commit to gardener/gardener-extension-provider-openstack that referenced this pull request Apr 9, 2021
rfranzke added a commit to gardener/gardener-extension-provider-gcp that referenced this pull request Apr 9, 2021
rfranzke added a commit to gardener/gardener-extension-provider-azure that referenced this pull request Apr 9, 2021
rfranzke added a commit to gardener/gardener-extension-provider-aws that referenced this pull request Apr 9, 2021
rfranzke added a commit to gardener/gardener-extension-provider-gcp that referenced this pull request Apr 9, 2021
rfranzke added a commit to gardener/gardener-extension-provider-azure that referenced this pull request Apr 9, 2021
rfranzke added a commit to gardener/gardener-extension-provider-aws that referenced this pull request Apr 14, 2021
rfranzke added a commit to gardener/gardener-extension-provider-gcp that referenced this pull request Apr 14, 2021
rfranzke added a commit to gardener/gardener-extension-provider-azure that referenced this pull request Apr 14, 2021
rfranzke added a commit to gardener/gardener-extension-provider-openstack that referenced this pull request Apr 14, 2021
Porges added a commit to Porges/website that referenced this pull request May 31, 2021
A bunch of flags were removed/renamed by kubernetes/kubernetes#98243
@andyzhangx
Copy link
Member

andyzhangx commented Jul 19, 2021

@Jiawei0227 @msau42 We(Azure disk & file drivers) would like to Enable both the InTreePluginXXUnregister and CSIMigrationXXX, while block in-tree Azure Disk & file dynamic PV creation, is that possible? One solution could be add one special tag in TranslateInTreePVToCSI func, and return error in CSI CreateVolume func if it's in-tree PV request, does it work? We want to add such a tag in 1.22 first, and finally CSI driver could control whether we could block in-tree PV request or not.

@andyzhangx
Copy link
Member

@Jiawei0227 @msau42 We(Azure disk & file drivers) would like to Enable both the InTreePluginXXUnregister and CSIMigrationXXX, while block in-tree Azure Disk & file dynamic PV creation, is that possible? One solution could be add one special tag in TranslateInTreePVToCSI func, and return error in CSI CreateVolume func if it's in-tree PV request, does it work? We want to add such a tag in 1.22 first, and finally CSI driver could control whether we could block in-tree PV request or not.

anyway, I worked out a PR to add a migration flag in csi migration logic: #103768, and then CSI driver could decide whether disable CreateVolume for csi migrated PV requests.

@Jiawei0227
Copy link
Contributor Author

We(Azure disk & file drivers) would like to Enable both the InTreePluginXXUnregister and CSIMigrationXXX, while block in-tree Azure Disk & file dynamic PV creation, is that possible?

If you enable both InTreePluginXXUnregister and CSIMigrationXXX, the XXX intree plugin will not be registered anymore. So there will not be any intree disk & file dynamic PV creation for sure. In fact, if you only enable InTreePluginXXUnregister, it will unregister the intree plugin XXX. Adding CSIMigrationXXX to it will enable the CSI migration part for the intree so that if anyone is still using the intree plugin, it can get redirect to CSI driver.

One solution could be add one special tag in TranslateInTreePVToCSI func, and return error in CSI CreateVolume func if it's in-tree PV request, does it work?

I dont think this is necessary, why do you want to do this? Enabling InTreePluginXXUnregister and CSIMigrationXXX means CSI migration is complete. There will be no intree plugin code used any more

@andyzhangx
Copy link
Member

InTreePluginXXUnregister

@Jiawei0227 thanks for the clarification, so if both InTreePluginXXUnregister and CSIMigrationXXX are enabled, existing in-tree PVs still works while we cannot create dynamic in-tree volumes by the in-tree driver anymore, right?

@msau42
Copy link
Member

msau42 commented Jul 23, 2021

Enabling both flags means provisioning with in-tree API will go through the CSI driver.

@Jiawei0227
Copy link
Contributor Author

@Jiawei0227 thanks for the clarification, so if both InTreePluginXXUnregister and CSIMigrationXXX are enabled, existing in-tree PVs still works while we cannot create dynamic in-tree volumes by the in-tree driver anymore, right?

@andyzhangx , Sorry for the late reply. Enable both means, all intree traffic will be redirected to CSI driver. The intree will not even be registered. So the intree code will never be able to execute anymore.

@andyzhangx
Copy link
Member

We(Azure disk & file drivers) would like to Enable both the InTreePluginXXUnregister and CSIMigrationXXX, while block in-tree Azure Disk & file dynamic PV creation, is that possible?

If you enable both InTreePluginXXUnregister and CSIMigrationXXX, the XXX intree plugin will not be registered anymore. So there will not be any intree disk & file dynamic PV creation for sure. In fact, if you only enable InTreePluginXXUnregister, it will unregister the intree plugin XXX. Adding CSIMigrationXXX to it will enable the CSI migration part for the intree so that if anyone is still using the intree plugin, it can get redirect to CSI driver.

One solution could be add one special tag in TranslateInTreePVToCSI func, and return error in CSI CreateVolume func if it's in-tree PV request, does it work?

I dont think this is necessary, why do you want to do this? Enabling InTreePluginXXUnregister and CSIMigrationXXX means CSI migration is complete. There will be no intree plugin code used any more

@Jiawei0227 I tried --feature-gates="CSIMigration=true,CSIMigrationAzureDisk=true,InTreePluginAzureDiskUnregister=true" with kube-controller-manager, and it could still create dynamic PV by in-tree storage class, I think that's not my original intention. Is there a way to only disallow dynamic PV by in-tree storage class, while make existing in-tree PV attach/mount working? Looks like I still needs this PR? #103768
cc @msau42

@andyzhangx
Copy link
Member

the IsMigrationCompleteForPlugin func is only called in attach/detach scenario, it won't disallow dynamic PV by in-tree storage class:

if csiMigratedPluginManager.IsMigrationCompleteForPlugin(pluginName) {
// All nodes are expected to have migrated CSI plugin installed and
// configured when CSI Migration Complete flag is enabled for a plugin.
// CSI migration is supported even if there is version skew between
// managers and node.
return true, nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet 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. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Development

Successfully merging this pull request may close these issues.

Disabling a volume plugin without enabling csi migration
10 participants