mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
Merge pull request #81486 from wongma7/aws-testdriver
Re-implement AWS test driver interfaces
This commit is contained in:
commit
4ba225a541
@ -1512,17 +1512,18 @@ func (v *azureVolume) DeleteVolume() {
|
||||
|
||||
// AWS
|
||||
type awsDriver struct {
|
||||
volumeName string
|
||||
|
||||
driverInfo testsuites.DriverInfo
|
||||
}
|
||||
|
||||
type awsVolume struct {
|
||||
volumeName string
|
||||
}
|
||||
|
||||
var _ testsuites.TestDriver = &awsDriver{}
|
||||
|
||||
// TODO: Fix authorization error in attach operation and uncomment below
|
||||
//var _ testsuites.PreprovisionedVolumeTestDriver = &awsDriver{}
|
||||
//var _ testsuites.InlineVolumeTestDriver = &awsDriver{}
|
||||
//var _ testsuites.PreprovisionedPVTestDriver = &awsDriver{}
|
||||
var _ testsuites.PreprovisionedVolumeTestDriver = &awsDriver{}
|
||||
var _ testsuites.InlineVolumeTestDriver = &awsDriver{}
|
||||
var _ testsuites.PreprovisionedPVTestDriver = &awsDriver{}
|
||||
var _ testsuites.DynamicPVTestDriver = &awsDriver{}
|
||||
|
||||
// InitAwsDriver returns awsDriver that implements TestDriver interface
|
||||
@ -1534,7 +1535,10 @@ func InitAwsDriver() testsuites.TestDriver {
|
||||
MaxFileSize: testpatterns.FileSizeMedium,
|
||||
SupportedFsType: sets.NewString(
|
||||
"", // Default fsType
|
||||
"ext2",
|
||||
"ext3",
|
||||
"ext4",
|
||||
"xfs",
|
||||
"ntfs",
|
||||
),
|
||||
SupportedMountOption: sets.NewString("debug", "nouid32"),
|
||||
@ -1562,12 +1566,12 @@ func (a *awsDriver) SkipUnsupportedTest(pattern testpatterns.TestPattern) {
|
||||
framework.SkipUnlessProviderIs("aws")
|
||||
}
|
||||
|
||||
// TODO: Fix authorization error in attach operation and uncomment below
|
||||
/*
|
||||
func (a *awsDriver) GetVolumeSource(readOnly bool, fsType string, volume testsuites.TestVolume) *v1.VolumeSource {
|
||||
av, ok := volume.(*awsVolume)
|
||||
gomega.Expect(ok).To(gomega.BeTrue(), "Failed to cast test volume to AWS test volume")
|
||||
volSource := v1.VolumeSource{
|
||||
AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{
|
||||
VolumeID: a.volumeName,
|
||||
VolumeID: av.volumeName,
|
||||
ReadOnly: readOnly,
|
||||
},
|
||||
}
|
||||
@ -1578,18 +1582,19 @@ func (a *awsDriver) GetVolumeSource(readOnly bool, fsType string, volume testsui
|
||||
}
|
||||
|
||||
func (a *awsDriver) GetPersistentVolumeSource(readOnly bool, fsType string, volume testsuites.TestVolume) (*v1.PersistentVolumeSource, *v1.VolumeNodeAffinity) {
|
||||
av, ok := volume.(*awsVolume)
|
||||
gomega.Expect(ok).To(gomega.BeTrue(), "Failed to cast test volume to AWS test volume")
|
||||
pvSource := v1.PersistentVolumeSource{
|
||||
AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{
|
||||
VolumeID: a.volumeName,
|
||||
VolumeID: av.volumeName,
|
||||
ReadOnly: readOnly,
|
||||
},
|
||||
}
|
||||
if fsType != "" {
|
||||
pvSource.AWSElasticBlockStore.FSType = fsType
|
||||
}
|
||||
return &pvSource
|
||||
return &pvSource, nil
|
||||
}
|
||||
*/
|
||||
|
||||
func (a *awsDriver) GetDynamicProvisionStorageClass(config *testsuites.PerTestConfig, fsType string) *storagev1.StorageClass {
|
||||
provisioner := "kubernetes.io/aws-ebs"
|
||||
@ -1599,8 +1604,9 @@ func (a *awsDriver) GetDynamicProvisionStorageClass(config *testsuites.PerTestCo
|
||||
}
|
||||
ns := config.Framework.Namespace.Name
|
||||
suffix := fmt.Sprintf("%s-sc", a.driverInfo.Name)
|
||||
delayedBinding := storagev1.VolumeBindingWaitForFirstConsumer
|
||||
|
||||
return testsuites.GetStorageClass(provisioner, parameters, nil, ns, suffix)
|
||||
return testsuites.GetStorageClass(provisioner, parameters, &delayedBinding, ns, suffix)
|
||||
}
|
||||
|
||||
func (a *awsDriver) GetClaimSize() string {
|
||||
@ -1621,19 +1627,25 @@ func (a *awsDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTestConf
|
||||
return config, func() {}
|
||||
}
|
||||
|
||||
// TODO: Fix authorization error in attach operation and uncomment below
|
||||
/*
|
||||
func (a *awsDriver) CreateVolume(config *testsuites.PerTestConfig, volType testpatterns.TestVolType) testsuites.TestVolume {
|
||||
if volType == testpatterns.InlineVolume {
|
||||
// PD will be created in framework.TestContext.CloudConfig.Zone zone,
|
||||
// so pods should be also scheduled there.
|
||||
config.ClientNodeSelector = map[string]string{
|
||||
v1.LabelZoneFailureDomain: framework.TestContext.CloudConfig.Zone,
|
||||
}
|
||||
}
|
||||
ginkgo.By("creating a test aws volume")
|
||||
var err error
|
||||
a.volumeName, err = framework.CreatePDWithRetry()
|
||||
framework.ExpectNoError(err))
|
||||
vname, err := framework.CreatePDWithRetry()
|
||||
framework.ExpectNoError(err)
|
||||
return &awsVolume{
|
||||
volumeName: vname,
|
||||
}
|
||||
}
|
||||
|
||||
DeleteVolume() {
|
||||
framework.DeletePDWithRetry(a.volumeName)
|
||||
func (v *awsVolume) DeleteVolume() {
|
||||
framework.DeletePDWithRetry(v.volumeName)
|
||||
}
|
||||
*/
|
||||
|
||||
// local
|
||||
type localDriver struct {
|
||||
|
Loading…
Reference in New Issue
Block a user