Skip to content

Commit bda42b6

Browse files
committed
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.
1 parent 83415e5 commit bda42b6

File tree

4 files changed

+88
-57
lines changed

4 files changed

+88
-57
lines changed

test/e2e/storage/drivers/csi.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ func InitHostPathCSIDriver() storageframework.TestDriver {
149149
storageframework.CapOnlineExpansion: true,
150150
storageframework.CapSingleNodeVolume: true,
151151
storageframework.CapReadWriteOncePod: true,
152+
storageframework.CapMultiplePVsSameID: true,
152153

153154
// This is needed for the
154155
// testsuites/volumelimits.go `should support volume limits`
@@ -487,10 +488,11 @@ func InitMockCSIDriver(driverOpts CSIMockDriverOpts) MockCSITestDriver {
487488
"", // Default fsType
488489
),
489490
Capabilities: map[storageframework.Capability]bool{
490-
storageframework.CapPersistence: false,
491-
storageframework.CapFsGroup: false,
492-
storageframework.CapExec: false,
493-
storageframework.CapVolumeLimits: true,
491+
storageframework.CapPersistence: false,
492+
storageframework.CapFsGroup: false,
493+
storageframework.CapExec: false,
494+
storageframework.CapVolumeLimits: true,
495+
storageframework.CapMultiplePVsSameID: true,
494496
},
495497
},
496498
manifests: driverManifests,
@@ -807,6 +809,7 @@ func InitGcePDCSIDriver() storageframework.TestDriver {
807809
storageframework.CapNodeExpansion: true,
808810
storageframework.CapSnapshotDataSource: true,
809811
storageframework.CapReadWriteOncePod: true,
812+
storageframework.CapMultiplePVsSameID: true,
810813
},
811814
RequiredAccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce},
812815
TopologyKeys: []string{GCEPDCSIZoneTopologyKey},

test/e2e/storage/drivers/in_tree.go

+67-53
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,11 @@ func InitNFSDriver() storageframework.TestDriver {
105105
SupportedMountOption: sets.NewString("relatime"),
106106
RequiredMountOption: sets.NewString("vers=4.1"),
107107
Capabilities: map[storageframework.Capability]bool{
108-
storageframework.CapPersistence: true,
109-
storageframework.CapExec: true,
110-
storageframework.CapRWX: true,
111-
storageframework.CapMultiPODs: true,
108+
storageframework.CapPersistence: true,
109+
storageframework.CapExec: true,
110+
storageframework.CapRWX: true,
111+
storageframework.CapMultiPODs: true,
112+
storageframework.CapMultiplePVsSameID: true,
112113
},
113114
},
114115
}
@@ -249,12 +250,13 @@ func InitISCSIDriver() storageframework.TestDriver {
249250
),
250251
TopologyKeys: []string{v1.LabelHostname},
251252
Capabilities: map[storageframework.Capability]bool{
252-
storageframework.CapPersistence: true,
253-
storageframework.CapFsGroup: true,
254-
storageframework.CapBlock: true,
255-
storageframework.CapExec: true,
256-
storageframework.CapMultiPODs: true,
257-
storageframework.CapTopology: true,
253+
storageframework.CapPersistence: true,
254+
storageframework.CapFsGroup: true,
255+
storageframework.CapBlock: true,
256+
storageframework.CapExec: true,
257+
storageframework.CapMultiPODs: true,
258+
storageframework.CapTopology: true,
259+
storageframework.CapMultiplePVsSameID: true,
258260
},
259261
},
260262
}
@@ -431,11 +433,12 @@ func InitRbdDriver() storageframework.TestDriver {
431433
"ext4",
432434
),
433435
Capabilities: map[storageframework.Capability]bool{
434-
storageframework.CapPersistence: true,
435-
storageframework.CapFsGroup: true,
436-
storageframework.CapBlock: true,
437-
storageframework.CapExec: true,
438-
storageframework.CapMultiPODs: true,
436+
storageframework.CapPersistence: true,
437+
storageframework.CapFsGroup: true,
438+
storageframework.CapBlock: true,
439+
storageframework.CapExec: true,
440+
storageframework.CapMultiPODs: true,
441+
storageframework.CapMultiplePVsSameID: true,
439442
},
440443
},
441444
}
@@ -559,10 +562,11 @@ func InitCephFSDriver() storageframework.TestDriver {
559562
"", // Default fsType
560563
),
561564
Capabilities: map[storageframework.Capability]bool{
562-
storageframework.CapPersistence: true,
563-
storageframework.CapExec: true,
564-
storageframework.CapRWX: true,
565-
storageframework.CapMultiPODs: true,
565+
storageframework.CapPersistence: true,
566+
storageframework.CapExec: true,
567+
storageframework.CapRWX: true,
568+
storageframework.CapMultiPODs: true,
569+
storageframework.CapMultiplePVsSameID: true,
566570
},
567571
},
568572
}
@@ -662,10 +666,11 @@ func InitHostPathDriver() storageframework.TestDriver {
662666
),
663667
TopologyKeys: []string{v1.LabelHostname},
664668
Capabilities: map[storageframework.Capability]bool{
665-
storageframework.CapPersistence: true,
666-
storageframework.CapMultiPODs: true,
667-
storageframework.CapSingleNodeVolume: true,
668-
storageframework.CapTopology: true,
669+
storageframework.CapPersistence: true,
670+
storageframework.CapMultiPODs: true,
671+
storageframework.CapSingleNodeVolume: true,
672+
storageframework.CapTopology: true,
673+
storageframework.CapMultiplePVsSameID: true,
669674
},
670675
},
671676
}
@@ -737,10 +742,11 @@ func InitHostPathSymlinkDriver() storageframework.TestDriver {
737742
),
738743
TopologyKeys: []string{v1.LabelHostname},
739744
Capabilities: map[storageframework.Capability]bool{
740-
storageframework.CapPersistence: true,
741-
storageframework.CapMultiPODs: true,
742-
storageframework.CapSingleNodeVolume: true,
743-
storageframework.CapTopology: true,
745+
storageframework.CapPersistence: true,
746+
storageframework.CapMultiPODs: true,
747+
storageframework.CapSingleNodeVolume: true,
748+
storageframework.CapTopology: true,
749+
storageframework.CapMultiplePVsSameID: true,
744750
},
745751
},
746752
}
@@ -966,8 +972,9 @@ func InitGcePdDriver() storageframework.TestDriver {
966972
storageframework.CapNodeExpansion: true,
967973
// GCE supports volume limits, but the test creates large
968974
// number of volumes and times out test suites.
969-
storageframework.CapVolumeLimits: false,
970-
storageframework.CapTopology: true,
975+
storageframework.CapVolumeLimits: false,
976+
storageframework.CapTopology: true,
977+
storageframework.CapMultiplePVsSameID: true,
971978
},
972979
},
973980
}
@@ -998,8 +1005,9 @@ func InitWindowsGcePdDriver() storageframework.TestDriver {
9981005
storageframework.CapMultiPODs: true,
9991006
// GCE supports volume limits, but the test creates large
10001007
// number of volumes and times out test suites.
1001-
storageframework.CapVolumeLimits: false,
1002-
storageframework.CapTopology: true,
1008+
storageframework.CapVolumeLimits: false,
1009+
storageframework.CapTopology: true,
1010+
storageframework.CapMultiplePVsSameID: true,
10031011
},
10041012
},
10051013
}
@@ -1136,12 +1144,13 @@ func InitVSphereDriver() storageframework.TestDriver {
11361144
),
11371145
TopologyKeys: []string{v1.LabelFailureDomainBetaZone},
11381146
Capabilities: map[storageframework.Capability]bool{
1139-
storageframework.CapPersistence: true,
1140-
storageframework.CapFsGroup: true,
1141-
storageframework.CapExec: true,
1142-
storageframework.CapMultiPODs: true,
1143-
storageframework.CapTopology: true,
1144-
storageframework.CapBlock: true,
1147+
storageframework.CapPersistence: true,
1148+
storageframework.CapFsGroup: true,
1149+
storageframework.CapExec: true,
1150+
storageframework.CapMultiPODs: true,
1151+
storageframework.CapTopology: true,
1152+
storageframework.CapBlock: true,
1153+
storageframework.CapMultiplePVsSameID: true,
11451154
},
11461155
},
11471156
}
@@ -1282,8 +1291,9 @@ func InitAzureDiskDriver() storageframework.TestDriver {
12821291
storageframework.CapMultiPODs: true,
12831292
// Azure supports volume limits, but the test creates large
12841293
// number of volumes and times out test suites.
1285-
storageframework.CapVolumeLimits: false,
1286-
storageframework.CapTopology: true,
1294+
storageframework.CapVolumeLimits: false,
1295+
storageframework.CapTopology: true,
1296+
storageframework.CapMultiplePVsSameID: true,
12871297
},
12881298
},
12891299
}
@@ -1431,8 +1441,9 @@ func InitAwsDriver() storageframework.TestDriver {
14311441
storageframework.CapOnlineExpansion: true,
14321442
// AWS supports volume limits, but the test creates large
14331443
// number of volumes and times out test suites.
1434-
storageframework.CapVolumeLimits: false,
1435-
storageframework.CapTopology: true,
1444+
storageframework.CapVolumeLimits: false,
1445+
storageframework.CapTopology: true,
1446+
storageframework.CapMultiplePVsSameID: true,
14361447
},
14371448
},
14381449
}
@@ -1551,21 +1562,23 @@ type localVolume struct {
15511562
var (
15521563
// capabilities
15531564
defaultLocalVolumeCapabilities = map[storageframework.Capability]bool{
1554-
storageframework.CapPersistence: true,
1555-
storageframework.CapFsGroup: true,
1556-
storageframework.CapBlock: false,
1557-
storageframework.CapExec: true,
1558-
storageframework.CapMultiPODs: true,
1559-
storageframework.CapSingleNodeVolume: true,
1565+
storageframework.CapPersistence: true,
1566+
storageframework.CapFsGroup: true,
1567+
storageframework.CapBlock: false,
1568+
storageframework.CapExec: true,
1569+
storageframework.CapMultiPODs: true,
1570+
storageframework.CapSingleNodeVolume: true,
1571+
storageframework.CapMultiplePVsSameID: true,
15601572
}
15611573
localVolumeCapabitilies = map[utils.LocalVolumeType]map[storageframework.Capability]bool{
15621574
utils.LocalVolumeBlock: {
1563-
storageframework.CapPersistence: true,
1564-
storageframework.CapFsGroup: true,
1565-
storageframework.CapBlock: true,
1566-
storageframework.CapExec: true,
1567-
storageframework.CapMultiPODs: true,
1568-
storageframework.CapSingleNodeVolume: true,
1575+
storageframework.CapPersistence: true,
1576+
storageframework.CapFsGroup: true,
1577+
storageframework.CapBlock: true,
1578+
storageframework.CapExec: true,
1579+
storageframework.CapMultiPODs: true,
1580+
storageframework.CapSingleNodeVolume: true,
1581+
storageframework.CapMultiplePVsSameID: true,
15691582
},
15701583
}
15711584
// fstype
@@ -1796,6 +1809,7 @@ func InitAzureFileDriver() storageframework.TestDriver {
17961809
storageframework.CapMultiPODs: true,
17971810
storageframework.CapControllerExpansion: true,
17981811
storageframework.CapNodeExpansion: true,
1812+
storageframework.CapMultiplePVsSameID: true,
17991813
},
18001814
},
18011815
}

test/e2e/storage/framework/testdriver.go

+10
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,16 @@ const (
190190
// - csi-attacher:v3.3.0+
191191
// - csi-resizer:v1.3.0+
192192
CapReadWriteOncePod Capability = "readWriteOncePod"
193+
194+
// The driver can handle two PersistentVolumes with the same VolumeHandle (= volume_id in CSI spec).
195+
// This capability is highly recommended for volumes that support ReadWriteMany access mode,
196+
// because creating multiple PVs for the same VolumeHandle is frequently used to share a single
197+
// volume among multiple namespaces.
198+
// Note that this capability needs to be disabled only for CSI drivers that break CSI boundary and
199+
// inspect Kubernetes PersistentVolume objects. A CSI driver that implements only CSI and does not
200+
// talk to Kubernetes API server in any way should keep this capability enabled, because
201+
// they will see the same NodeStage / NodePublish requests as if only one PV existed.
202+
CapMultiplePVsSameID Capability = "multiplePVsSameID"
193203
)
194204

195205
// DriverInfo represents static information about a TestDriver.

test/e2e/storage/testsuites/provisioning.go

+4
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,10 @@ func (p *provisioningTestSuite) DefineTests(driver storageframework.TestDriver,
530530
e2eskipper.Skipf("skipping multiple PV mount test for block mode")
531531
}
532532

533+
if !dInfo.Capabilities[storageframework.CapMultiplePVsSameID] {
534+
e2eskipper.Skipf("this driver does not support multiple PVs with the same volumeHandle")
535+
}
536+
533537
init()
534538
defer cleanup()
535539

0 commit comments

Comments
 (0)