Skip to content

Commit

Permalink
Add explicit capability for online volume expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
gnufied committed Jun 9, 2021
1 parent dab8df8 commit 985b4ce
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions test/e2e/storage/drivers/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func InitHostPathCSIDriver() storageframework.TestDriver {
storageframework.CapBlock: true,
storageframework.CapPVCDataSource: true,
storageframework.CapControllerExpansion: true,
storageframework.CapOnlineExpansion: true,
storageframework.CapSingleNodeVolume: true,
storageframework.CapVolumeLimits: true,
}
Expand Down Expand Up @@ -739,6 +740,7 @@ func InitGcePDCSIDriver() storageframework.TestDriver {
storageframework.CapVolumeLimits: false,
storageframework.CapTopology: true,
storageframework.CapControllerExpansion: 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
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,7 @@ func InitGcePdDriver() storageframework.TestDriver {
storageframework.CapExec: true,
storageframework.CapMultiPODs: true,
storageframework.CapControllerExpansion: true,
storageframework.CapOnlineExpansion: true,
storageframework.CapNodeExpansion: true,
// GCE supports volume limits, but the test creates large
// number of volumes and times out test suites.
Expand Down Expand Up @@ -1692,6 +1693,7 @@ func InitAwsDriver() storageframework.TestDriver {
storageframework.CapMultiPODs: true,
storageframework.CapControllerExpansion: true,
storageframework.CapNodeExpansion: true,
storageframework.CapOnlineExpansion: true,
// AWS supports volume limits, but the test creates large
// number of volumes and times out test suites.
storageframework.CapVolumeLimits: false,
Expand Down
8 changes: 8 additions & 0 deletions test/e2e/storage/external/external.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ func loadDriverDefinition(filename string) (*driverDefinition, error) {
if err := runtime.DecodeInto(scheme.Codecs.UniversalDecoder(), data, driver); err != nil {
return nil, errors.Wrap(err, filename)
}

// to ensure backward compatibility if controller expansion is enabled then set online 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
}
return driver, nil
}

Expand Down
6 changes: 4 additions & 2 deletions test/e2e/storage/framework/testdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ limitations under the License.
package framework

import (
"k8s.io/api/core/v1"
"time"

v1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/test/e2e/framework"
e2evolume "k8s.io/kubernetes/test/e2e/framework/volume"
"time"
)

// TestDriver represents an interface for a driver to be tested in TestSuite.
Expand Down Expand Up @@ -164,6 +165,7 @@ 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
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/storage/testsuites/volume_expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ func (v *volumeExpandTestSuite) DefineTests(driver storageframework.TestDriver,
init()
defer cleanup()

if !driver.GetDriverInfo().Capabilities[storageframework.CapOnlineExpansion] {
e2eskipper.Skipf("Driver %q does not support online 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 985b4ce

Please sign in to comment.