diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index cb01b8d252..b0a875fc34 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -187,6 +187,7 @@ type csiProvisioner struct { var _ controller.Provisioner = &csiProvisioner{} var _ controller.BlockProvisioner = &csiProvisioner{} var _ controller.ProvisionerExt = &csiProvisioner{} +var _ controller.Qualifier = &csiProvisioner{} var ( // Each provisioner have a identify string to distinguish with others. This @@ -882,6 +883,17 @@ func (p *csiProvisioner) SupportsBlock() bool { return true } +func (p *csiProvisioner) ShouldProvision(claim *v1.PersistentVolumeClaim) bool { + provisioner := claim.Annotations[annStorageProvisioner] + if provisioner == p.driverName { + // Either CSI volume is requested or in-tree volume is migrated to CSI in PV controller + // and therefore PVC has CSI annotation. + return true + } + // Non-migrated in-tree volume is requested. + return false +} + //TODO use a unique volume handle from and to Id func (p *csiProvisioner) volumeIdToHandle(id string) string { return id