|
|
|
|
@@ -62,11 +62,12 @@ const (
|
|
|
|
|
|
|
|
|
|
// hostpathCSI
|
|
|
|
|
type hostpathCSIDriver struct {
|
|
|
|
|
driverInfo testsuites.DriverInfo
|
|
|
|
|
manifests []string
|
|
|
|
|
driverInfo testsuites.DriverInfo
|
|
|
|
|
manifests []string
|
|
|
|
|
volumeAttributes []map[string]string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func initHostPathCSIDriver(name string, capabilities map[testsuites.Capability]bool, manifests ...string) testsuites.TestDriver {
|
|
|
|
|
func initHostPathCSIDriver(name string, capabilities map[testsuites.Capability]bool, volumeAttributes []map[string]string, manifests ...string) testsuites.TestDriver {
|
|
|
|
|
return &hostpathCSIDriver{
|
|
|
|
|
driverInfo: testsuites.DriverInfo{
|
|
|
|
|
Name: name,
|
|
|
|
|
@@ -77,13 +78,15 @@ func initHostPathCSIDriver(name string, capabilities map[testsuites.Capability]b
|
|
|
|
|
),
|
|
|
|
|
Capabilities: capabilities,
|
|
|
|
|
},
|
|
|
|
|
manifests: manifests,
|
|
|
|
|
manifests: manifests,
|
|
|
|
|
volumeAttributes: volumeAttributes,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _ testsuites.TestDriver = &hostpathCSIDriver{}
|
|
|
|
|
var _ testsuites.DynamicPVTestDriver = &hostpathCSIDriver{}
|
|
|
|
|
var _ testsuites.SnapshottableTestDriver = &hostpathCSIDriver{}
|
|
|
|
|
var _ testsuites.EphemeralTestDriver = &hostpathCSIDriver{}
|
|
|
|
|
|
|
|
|
|
// InitHostPathCSIDriver returns hostpathCSIDriver that implements TestDriver interface
|
|
|
|
|
func InitHostPathCSIDriver() testsuites.TestDriver {
|
|
|
|
|
@@ -97,15 +100,20 @@ func InitHostPathCSIDriver() testsuites.TestDriver {
|
|
|
|
|
}
|
|
|
|
|
return initHostPathCSIDriver("csi-hostpath",
|
|
|
|
|
capabilities,
|
|
|
|
|
// Volume attributes don't matter, but we have to provide at least one map.
|
|
|
|
|
[]map[string]string{
|
|
|
|
|
{"foo": "bar"},
|
|
|
|
|
},
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/external-attacher/rbac.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/external-provisioner/rbac.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/external-snapshotter/rbac.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/external-resizer/rbac.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-attacher.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-provisioner.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-snapshotter.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-resizer.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-driverinfo.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-plugin.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-provisioner.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-resizer.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-snapshotter.yaml",
|
|
|
|
|
"test/e2e/testing-manifests/storage-csi/hostpath/hostpath/e2e-test-rbac.yaml",
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
@@ -115,6 +123,9 @@ func (h *hostpathCSIDriver) GetDriverInfo() *testsuites.DriverInfo {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (h *hostpathCSIDriver) SkipUnsupportedTest(pattern testpatterns.TestPattern) {
|
|
|
|
|
if pattern.VolType == testpatterns.CSIInlineVolume && len(h.volumeAttributes) == 0 {
|
|
|
|
|
framework.Skipf("%s has no volume attributes defined, doesn't support ephemeral inline volumes", h.driverInfo.Name)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (h *hostpathCSIDriver) GetDynamicProvisionStorageClass(config *testsuites.PerTestConfig, fsType string) *storagev1.StorageClass {
|
|
|
|
|
@@ -126,6 +137,14 @@ func (h *hostpathCSIDriver) GetDynamicProvisionStorageClass(config *testsuites.P
|
|
|
|
|
return testsuites.GetStorageClass(provisioner, parameters, nil, ns, suffix)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (h *hostpathCSIDriver) GetVolumeAttributes(config *testsuites.PerTestConfig, volumeNumber int) map[string]string {
|
|
|
|
|
return h.volumeAttributes[volumeNumber%len(h.volumeAttributes)]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (h *hostpathCSIDriver) GetCSIDriverName(config *testsuites.PerTestConfig) string {
|
|
|
|
|
return config.GetUniqueDriverName()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (h *hostpathCSIDriver) GetSnapshotClass(config *testsuites.PerTestConfig) *unstructured.Unstructured {
|
|
|
|
|
snapshotter := config.GetUniqueDriverName()
|
|
|
|
|
parameters := map[string]string{}
|
|
|
|
|
@@ -303,7 +322,7 @@ func (m *mockCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTest
|
|
|
|
|
NodeName: config.ClientNodeName,
|
|
|
|
|
PodInfo: m.podInfo,
|
|
|
|
|
CanAttach: &m.attachable,
|
|
|
|
|
VolumeLifecycleModes: []storagev1beta1.VolumeLifecycleMode{
|
|
|
|
|
VolumeLifecycleModes: &[]storagev1beta1.VolumeLifecycleMode{
|
|
|
|
|
storagev1beta1.VolumeLifecyclePersistent,
|
|
|
|
|
storagev1beta1.VolumeLifecycleEphemeral,
|
|
|
|
|
},
|
|
|
|
|
@@ -327,6 +346,7 @@ func (m *mockCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTest
|
|
|
|
|
func InitHostPathV0CSIDriver() testsuites.TestDriver {
|
|
|
|
|
return initHostPathCSIDriver("csi-hostpath-v0",
|
|
|
|
|
map[testsuites.Capability]bool{testsuites.CapPersistence: true, testsuites.CapMultiPODs: true},
|
|
|
|
|
nil, /* no volume attributes -> no ephemeral volume testing */
|
|
|
|
|
// Using the current set of rbac.yaml files is problematic here because they don't
|
|
|
|
|
// match the version of the rules that were written for the releases of external-attacher
|
|
|
|
|
// and external-provisioner that we are using here. It happens to work in practice...
|
|
|
|
|
|