Add capability for tests with multiple PVs with the same VolumeHandle

Some CSI drivers do not like multiple PVs with the same VolumeHandle,
therefore make that tests optional.
This commit is contained in:
Jan Safranek 2022-10-13 14:51:47 +02:00
parent 83415e5c9e
commit bda42b6b53
4 changed files with 88 additions and 57 deletions

View File

@ -149,6 +149,7 @@ func InitHostPathCSIDriver() storageframework.TestDriver {
storageframework.CapOnlineExpansion: true,
storageframework.CapSingleNodeVolume: true,
storageframework.CapReadWriteOncePod: true,
storageframework.CapMultiplePVsSameID: true,
// This is needed for the
// testsuites/volumelimits.go `should support volume limits`
@ -491,6 +492,7 @@ func InitMockCSIDriver(driverOpts CSIMockDriverOpts) MockCSITestDriver {
storageframework.CapFsGroup: false,
storageframework.CapExec: false,
storageframework.CapVolumeLimits: true,
storageframework.CapMultiplePVsSameID: true,
},
},
manifests: driverManifests,
@ -807,6 +809,7 @@ func InitGcePDCSIDriver() storageframework.TestDriver {
storageframework.CapNodeExpansion: true,
storageframework.CapSnapshotDataSource: true,
storageframework.CapReadWriteOncePod: true,
storageframework.CapMultiplePVsSameID: true,
},
RequiredAccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce},
TopologyKeys: []string{GCEPDCSIZoneTopologyKey},

View File

@ -109,6 +109,7 @@ func InitNFSDriver() storageframework.TestDriver {
storageframework.CapExec: true,
storageframework.CapRWX: true,
storageframework.CapMultiPODs: true,
storageframework.CapMultiplePVsSameID: true,
},
},
}
@ -255,6 +256,7 @@ func InitISCSIDriver() storageframework.TestDriver {
storageframework.CapExec: true,
storageframework.CapMultiPODs: true,
storageframework.CapTopology: true,
storageframework.CapMultiplePVsSameID: true,
},
},
}
@ -436,6 +438,7 @@ func InitRbdDriver() storageframework.TestDriver {
storageframework.CapBlock: true,
storageframework.CapExec: true,
storageframework.CapMultiPODs: true,
storageframework.CapMultiplePVsSameID: true,
},
},
}
@ -563,6 +566,7 @@ func InitCephFSDriver() storageframework.TestDriver {
storageframework.CapExec: true,
storageframework.CapRWX: true,
storageframework.CapMultiPODs: true,
storageframework.CapMultiplePVsSameID: true,
},
},
}
@ -666,6 +670,7 @@ func InitHostPathDriver() storageframework.TestDriver {
storageframework.CapMultiPODs: true,
storageframework.CapSingleNodeVolume: true,
storageframework.CapTopology: true,
storageframework.CapMultiplePVsSameID: true,
},
},
}
@ -741,6 +746,7 @@ func InitHostPathSymlinkDriver() storageframework.TestDriver {
storageframework.CapMultiPODs: true,
storageframework.CapSingleNodeVolume: true,
storageframework.CapTopology: true,
storageframework.CapMultiplePVsSameID: true,
},
},
}
@ -968,6 +974,7 @@ func InitGcePdDriver() storageframework.TestDriver {
// number of volumes and times out test suites.
storageframework.CapVolumeLimits: false,
storageframework.CapTopology: true,
storageframework.CapMultiplePVsSameID: true,
},
},
}
@ -1000,6 +1007,7 @@ func InitWindowsGcePdDriver() storageframework.TestDriver {
// number of volumes and times out test suites.
storageframework.CapVolumeLimits: false,
storageframework.CapTopology: true,
storageframework.CapMultiplePVsSameID: true,
},
},
}
@ -1142,6 +1150,7 @@ func InitVSphereDriver() storageframework.TestDriver {
storageframework.CapMultiPODs: true,
storageframework.CapTopology: true,
storageframework.CapBlock: true,
storageframework.CapMultiplePVsSameID: true,
},
},
}
@ -1284,6 +1293,7 @@ func InitAzureDiskDriver() storageframework.TestDriver {
// number of volumes and times out test suites.
storageframework.CapVolumeLimits: false,
storageframework.CapTopology: true,
storageframework.CapMultiplePVsSameID: true,
},
},
}
@ -1433,6 +1443,7 @@ func InitAwsDriver() storageframework.TestDriver {
// number of volumes and times out test suites.
storageframework.CapVolumeLimits: false,
storageframework.CapTopology: true,
storageframework.CapMultiplePVsSameID: true,
},
},
}
@ -1557,6 +1568,7 @@ var (
storageframework.CapExec: true,
storageframework.CapMultiPODs: true,
storageframework.CapSingleNodeVolume: true,
storageframework.CapMultiplePVsSameID: true,
}
localVolumeCapabitilies = map[utils.LocalVolumeType]map[storageframework.Capability]bool{
utils.LocalVolumeBlock: {
@ -1566,6 +1578,7 @@ var (
storageframework.CapExec: true,
storageframework.CapMultiPODs: true,
storageframework.CapSingleNodeVolume: true,
storageframework.CapMultiplePVsSameID: true,
},
}
// fstype
@ -1796,6 +1809,7 @@ func InitAzureFileDriver() storageframework.TestDriver {
storageframework.CapMultiPODs: true,
storageframework.CapControllerExpansion: true,
storageframework.CapNodeExpansion: true,
storageframework.CapMultiplePVsSameID: true,
},
},
}

View File

@ -190,6 +190,16 @@ const (
// - csi-attacher:v3.3.0+
// - csi-resizer:v1.3.0+
CapReadWriteOncePod Capability = "readWriteOncePod"
// The driver can handle two PersistentVolumes with the same VolumeHandle (= volume_id in CSI spec).
// This capability is highly recommended for volumes that support ReadWriteMany access mode,
// because creating multiple PVs for the same VolumeHandle is frequently used to share a single
// volume among multiple namespaces.
// Note that this capability needs to be disabled only for CSI drivers that break CSI boundary and
// inspect Kubernetes PersistentVolume objects. A CSI driver that implements only CSI and does not
// talk to Kubernetes API server in any way should keep this capability enabled, because
// they will see the same NodeStage / NodePublish requests as if only one PV existed.
CapMultiplePVsSameID Capability = "multiplePVsSameID"
)
// DriverInfo represents static information about a TestDriver.

View File

@ -530,6 +530,10 @@ func (p *provisioningTestSuite) DefineTests(driver storageframework.TestDriver,
e2eskipper.Skipf("skipping multiple PV mount test for block mode")
}
if !dInfo.Capabilities[storageframework.CapMultiplePVsSameID] {
e2eskipper.Skipf("this driver does not support multiple PVs with the same volumeHandle")
}
init()
defer cleanup()