Skip to content

Commit

Permalink
Don't process PVCs for in-tree volumes
Browse files Browse the repository at this point in the history
Request for provisioning of in-tree volume plugins that were migrated to
CSI will always have CSI driver name in annStorageProvisioner.
  • Loading branch information
jsafrane committed Sep 30, 2019
1 parent e17cc20 commit 624e1d3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 624e1d3

Please sign in to comment.