mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Update in-tree vSphere tests
Don't implement interfaces that trigger tests with in-line and pre-provisioned vSphere volumes. With cloud provider removal, the in-tree vSphere tests won't be able to create a volume in vSphere and thus test in-line volumes in Pods and pre-provisioned PVs. Only dynamically provisioned volumes can be used for testing, because they're provisioned by the vSphere CSI driver.
This commit is contained in:
parent
fedb5842e5
commit
67926c3777
@ -1182,14 +1182,7 @@ type vSphereDriver struct {
|
||||
driverInfo storageframework.DriverInfo
|
||||
}
|
||||
|
||||
type vSphereVolume struct {
|
||||
volumePath string
|
||||
}
|
||||
|
||||
var _ storageframework.TestDriver = &vSphereDriver{}
|
||||
var _ storageframework.PreprovisionedVolumeTestDriver = &vSphereDriver{}
|
||||
var _ storageframework.InlineVolumeTestDriver = &vSphereDriver{}
|
||||
var _ storageframework.PreprovisionedPVTestDriver = &vSphereDriver{}
|
||||
var _ storageframework.DynamicPVTestDriver = &vSphereDriver{}
|
||||
|
||||
// InitVSphereDriver returns vSphereDriver that implements TestDriver interface
|
||||
@ -1220,6 +1213,7 @@ func InitVSphereDriver() storageframework.TestDriver {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (v *vSphereDriver) GetDriverInfo() *storageframework.DriverInfo {
|
||||
return &v.driverInfo
|
||||
}
|
||||
@ -1228,50 +1222,6 @@ func (v *vSphereDriver) SkipUnsupportedTest(pattern storageframework.TestPattern
|
||||
e2eskipper.SkipUnlessProviderIs("vsphere")
|
||||
}
|
||||
|
||||
func (v *vSphereDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) *v1.VolumeSource {
|
||||
vsv, ok := e2evolume.(*vSphereVolume)
|
||||
if !ok {
|
||||
framework.Failf("Failed to cast test volume of type %T to the cSphere test volume", e2evolume)
|
||||
}
|
||||
|
||||
// vSphere driver doesn't seem to support readOnly volume
|
||||
// TODO: check if it is correct
|
||||
if readOnly {
|
||||
return nil
|
||||
}
|
||||
volSource := v1.VolumeSource{
|
||||
VsphereVolume: &v1.VsphereVirtualDiskVolumeSource{
|
||||
VolumePath: vsv.volumePath,
|
||||
},
|
||||
}
|
||||
if fsType != "" {
|
||||
volSource.VsphereVolume.FSType = fsType
|
||||
}
|
||||
return &volSource
|
||||
}
|
||||
|
||||
func (v *vSphereDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2evolume storageframework.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
|
||||
vsv, ok := e2evolume.(*vSphereVolume)
|
||||
if !ok {
|
||||
framework.Failf("Failed to cast test volume of type %T to the vSphere test volume", e2evolume)
|
||||
}
|
||||
|
||||
// vSphere driver doesn't seem to support readOnly volume
|
||||
// TODO: check if it is correct
|
||||
if readOnly {
|
||||
return nil, nil
|
||||
}
|
||||
pvSource := v1.PersistentVolumeSource{
|
||||
VsphereVolume: &v1.VsphereVirtualDiskVolumeSource{
|
||||
VolumePath: vsv.volumePath,
|
||||
},
|
||||
}
|
||||
if fsType != "" {
|
||||
pvSource.VsphereVolume.FSType = fsType
|
||||
}
|
||||
return &pvSource, nil
|
||||
}
|
||||
|
||||
func (v *vSphereDriver) GetDynamicProvisionStorageClass(ctx context.Context, config *storageframework.PerTestConfig, fsType string) *storagev1.StorageClass {
|
||||
provisioner := "kubernetes.io/vsphere-volume"
|
||||
parameters := map[string]string{}
|
||||
@ -1291,13 +1241,6 @@ func (v *vSphereDriver) PrepareTest(ctx context.Context, f *framework.Framework)
|
||||
}
|
||||
}
|
||||
|
||||
func (v *vSphereDriver) CreateVolume(ctx context.Context, config *storageframework.PerTestConfig, volType storageframework.TestVolType) storageframework.TestVolume {
|
||||
return &vSphereVolume{}
|
||||
}
|
||||
|
||||
func (v *vSphereVolume) DeleteVolume(ctx context.Context) {
|
||||
}
|
||||
|
||||
// Azure Disk
|
||||
type azureDiskDriver struct {
|
||||
driverInfo storageframework.DriverInfo
|
||||
|
Loading…
Reference in New Issue
Block a user