Merge pull request #102665 from gnufied/add-online-expansion-cap

Add explicit capability for online volume expansion
This commit is contained in:
Kubernetes Prow Robot 2021-06-08 08:33:36 -07:00 committed by GitHub
commit cc7721362c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 2 deletions

View File

@ -143,6 +143,7 @@ func InitHostPathCSIDriver() storageframework.TestDriver {
storageframework.CapBlock: true, storageframework.CapBlock: true,
storageframework.CapPVCDataSource: true, storageframework.CapPVCDataSource: true,
storageframework.CapControllerExpansion: true, storageframework.CapControllerExpansion: true,
storageframework.CapOnlineExpansion: true,
storageframework.CapSingleNodeVolume: true, storageframework.CapSingleNodeVolume: true,
// This is needed for the // This is needed for the
@ -786,6 +787,7 @@ func InitGcePDCSIDriver() storageframework.TestDriver {
storageframework.CapVolumeLimits: false, storageframework.CapVolumeLimits: false,
storageframework.CapTopology: true, storageframework.CapTopology: true,
storageframework.CapControllerExpansion: true, storageframework.CapControllerExpansion: true,
storageframework.CapOnlineExpansion: true,
storageframework.CapNodeExpansion: true, storageframework.CapNodeExpansion: true,
storageframework.CapSnapshotDataSource: true, storageframework.CapSnapshotDataSource: true,
}, },

View File

@ -1251,6 +1251,7 @@ func InitGcePdDriver() storageframework.TestDriver {
storageframework.CapExec: true, storageframework.CapExec: true,
storageframework.CapMultiPODs: true, storageframework.CapMultiPODs: true,
storageframework.CapControllerExpansion: true, storageframework.CapControllerExpansion: true,
storageframework.CapOnlineExpansion: true,
storageframework.CapNodeExpansion: true, storageframework.CapNodeExpansion: true,
// GCE supports volume limits, but the test creates large // GCE supports volume limits, but the test creates large
// number of volumes and times out test suites. // number of volumes and times out test suites.
@ -1692,6 +1693,7 @@ func InitAwsDriver() storageframework.TestDriver {
storageframework.CapMultiPODs: true, storageframework.CapMultiPODs: true,
storageframework.CapControllerExpansion: true, storageframework.CapControllerExpansion: true,
storageframework.CapNodeExpansion: true, storageframework.CapNodeExpansion: true,
storageframework.CapOnlineExpansion: true,
// AWS supports volume limits, but the test creates large // AWS supports volume limits, but the test creates large
// number of volumes and times out test suites. // number of volumes and times out test suites.
storageframework.CapVolumeLimits: false, storageframework.CapVolumeLimits: false,

View File

@ -203,6 +203,14 @@ func loadDriverDefinition(filename string) (*driverDefinition, error) {
if err := runtime.DecodeInto(scheme.Codecs.UniversalDecoder(), data, driver); err != nil { if err := runtime.DecodeInto(scheme.Codecs.UniversalDecoder(), data, driver); err != nil {
return nil, errors.Wrap(err, filename) 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 return driver, nil
} }

View File

@ -17,13 +17,14 @@ limitations under the License.
package framework package framework
import ( import (
"k8s.io/api/core/v1" "time"
v1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1" storagev1 "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2evolume "k8s.io/kubernetes/test/e2e/framework/volume" e2evolume "k8s.io/kubernetes/test/e2e/framework/volume"
"time"
) )
// TestDriver represents an interface for a driver to be tested in TestSuite. // TestDriver represents an interface for a driver to be tested in TestSuite.
@ -164,6 +165,7 @@ const (
CapRWX Capability = "RWX" // support ReadWriteMany access modes CapRWX Capability = "RWX" // support ReadWriteMany access modes
CapControllerExpansion Capability = "controllerExpansion" // support volume expansion for controller CapControllerExpansion Capability = "controllerExpansion" // support volume expansion for controller
CapNodeExpansion Capability = "nodeExpansion" // support volume expansion for node 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) CapVolumeLimits Capability = "volumeLimits" // support volume limits (can be *very* slow)
CapSingleNodeVolume Capability = "singleNodeVolume" // support volume that can run on single node (like hostpath) CapSingleNodeVolume Capability = "singleNodeVolume" // support volume that can run on single node (like hostpath)
CapTopology Capability = "topology" // support topology CapTopology Capability = "topology" // support topology

View File

@ -247,6 +247,10 @@ func (v *volumeExpandTestSuite) DefineTests(driver storageframework.TestDriver,
init() init()
defer cleanup() 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 var err error
ginkgo.By("Creating a pod with dynamically provisioned volume") ginkgo.By("Creating a pod with dynamically provisioned volume")
podConfig := e2epod.Config{ podConfig := e2epod.Config{