Skip to content

Commit

Permalink
Merge pull request #110615 from dobsonj/automated-cherry-pick-of-#109…
Browse files Browse the repository at this point in the history
…580-upstream-release-1.24

Automated cherry pick of #109580: e2e: add storage capability for offline volume expansion
  • Loading branch information
k8s-ci-robot committed Jul 1, 2022
2 parents 880de96 + b781cf3 commit 2a550bc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
2 changes: 2 additions & 0 deletions test/e2e/storage/drivers/csi.go
Expand Up @@ -147,6 +147,7 @@ func InitHostPathCSIDriver() storageframework.TestDriver {
storageframework.CapBlock: true,
storageframework.CapPVCDataSource: true,
storageframework.CapControllerExpansion: true,
storageframework.CapOfflineExpansion: true,
storageframework.CapOnlineExpansion: true,
storageframework.CapSingleNodeVolume: true,

Expand Down Expand Up @@ -810,6 +811,7 @@ func InitGcePDCSIDriver() storageframework.TestDriver {
storageframework.CapVolumeLimits: false,
storageframework.CapTopology: true,
storageframework.CapControllerExpansion: true,
storageframework.CapOfflineExpansion: true,
storageframework.CapOnlineExpansion: true,
storageframework.CapNodeExpansion: true,
storageframework.CapSnapshotDataSource: true,
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/storage/drivers/in_tree.go
Expand Up @@ -1251,6 +1251,7 @@ func InitGcePdDriver() storageframework.TestDriver {
storageframework.CapExec: true,
storageframework.CapMultiPODs: true,
storageframework.CapControllerExpansion: true,
storageframework.CapOfflineExpansion: true,
storageframework.CapOnlineExpansion: true,
storageframework.CapNodeExpansion: true,
// GCE supports volume limits, but the test creates large
Expand Down Expand Up @@ -1702,6 +1703,7 @@ func InitAwsDriver() storageframework.TestDriver {
storageframework.CapMultiPODs: true,
storageframework.CapControllerExpansion: true,
storageframework.CapNodeExpansion: true,
storageframework.CapOfflineExpansion: true,
storageframework.CapOnlineExpansion: true,
// AWS supports volume limits, but the test creates large
// number of volumes and times out test suites.
Expand Down
9 changes: 8 additions & 1 deletion test/e2e/storage/external/external.go
Expand Up @@ -203,13 +203,20 @@ func loadDriverDefinition(filename string) (*driverDefinition, error) {
return nil, fmt.Errorf("%s: %w", filename, err)
}

// to ensure backward compatibility if controller expansion is enabled then set online expansion to true
// To ensure backward compatibility: if controller expansion is enabled,
// then set both online and offline expansion to true
if _, ok := driver.GetDriverInfo().Capabilities[storageframework.CapOnlineExpansion]; !ok &&
driver.GetDriverInfo().Capabilities[storageframework.CapControllerExpansion] {
caps := driver.DriverInfo.Capabilities
caps[storageframework.CapOnlineExpansion] = true
driver.DriverInfo.Capabilities = caps
}
if _, ok := driver.GetDriverInfo().Capabilities[storageframework.CapOfflineExpansion]; !ok &&
driver.GetDriverInfo().Capabilities[storageframework.CapControllerExpansion] {
caps := driver.DriverInfo.Capabilities
caps[storageframework.CapOfflineExpansion] = true
driver.DriverInfo.Capabilities = caps
}
return driver, nil
}

Expand Down
16 changes: 12 additions & 4 deletions test/e2e/storage/framework/testdriver.go
Expand Up @@ -166,10 +166,18 @@ const (
CapRWX Capability = "RWX" // support ReadWriteMany access modes
CapControllerExpansion Capability = "controllerExpansion" // support volume expansion for controller
CapNodeExpansion Capability = "nodeExpansion" // support volume expansion for node
CapOnlineExpansion Capability = "onlineExpansion" // supports online volume expansion
CapVolumeLimits Capability = "volumeLimits" // support volume limits (can be *very* slow)
CapSingleNodeVolume Capability = "singleNodeVolume" // support volume that can run on single node (like hostpath)
CapTopology Capability = "topology" // support topology

// offlineExpansion and onlineExpansion both default to true when
// controllerExpansion is true. The only reason to set offlineExpansion
// to false is when a CSI driver can only expand a volume while it's
// attached to a pod. Conversely, onlineExpansion can be set to false
// if the driver can only expand a volume while it is detached.
CapOfflineExpansion Capability = "offlineExpansion" // supports offline volume expansion (default: true)
CapOnlineExpansion Capability = "onlineExpansion" // supports online volume expansion (default: true)

CapVolumeLimits Capability = "volumeLimits" // support volume limits (can be *very* slow)
CapSingleNodeVolume Capability = "singleNodeVolume" // support volume that can run on single node (like hostpath)
CapTopology Capability = "topology" // support topology

// The driver publishes storage capacity information: when the storage class
// for dynamic provisioning exists, the driver is expected to provide
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/storage/testsuites/volume_expand.go
Expand Up @@ -177,6 +177,10 @@ func (v *volumeExpandTestSuite) DefineTests(driver storageframework.TestDriver,
init()
defer cleanup()

if !driver.GetDriverInfo().Capabilities[storageframework.CapOfflineExpansion] {
e2eskipper.Skipf("Driver %q does not support offline volume expansion - skipping", driver.GetDriverInfo().Name)
}

var err error
ginkgo.By("Creating a pod with dynamically provisioned volume")
podConfig := e2epod.Config{
Expand Down

0 comments on commit 2a550bc

Please sign in to comment.