mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #80378 from davidz627/fix/gceAM
Add a field 'RequiredAccessModes' to the driver info object that is propagated to pvc creation
This commit is contained in:
commit
e40cfd984d
@ -41,6 +41,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"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"
|
||||
@ -354,6 +355,7 @@ func InitGcePDCSIDriver() testsuites.TestDriver {
|
||||
testsuites.CapExec: true,
|
||||
testsuites.CapMultiPODs: true,
|
||||
},
|
||||
RequiredAccessModes: []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ func createGenericVolumeTestResource(driver TestDriver, config *PerTestConfig, p
|
||||
if pDriver, ok := driver.(PreprovisionedPVTestDriver); ok {
|
||||
pvSource, volumeNodeAffinity := pDriver.GetPersistentVolumeSource(false, pattern.FsType, r.volume)
|
||||
if pvSource != nil {
|
||||
r.pv, r.pvc = createPVCPV(f, dInfo.Name, pvSource, volumeNodeAffinity, pattern.VolMode)
|
||||
r.pv, r.pvc = createPVCPV(f, dInfo.Name, pvSource, volumeNodeAffinity, pattern.VolMode, dInfo.RequiredAccessModes)
|
||||
r.volSource = createVolumeSource(r.pvc.Name, false /* readOnly */)
|
||||
}
|
||||
r.volType = fmt.Sprintf("%s-preprovisionedPV", dInfo.Name)
|
||||
@ -228,7 +228,7 @@ func createGenericVolumeTestResource(driver TestDriver, config *PerTestConfig, p
|
||||
|
||||
if r.sc != nil {
|
||||
r.pv, r.pvc = createPVCPVFromDynamicProvisionSC(
|
||||
f, dInfo.Name, claimSize, r.sc, pattern.VolMode)
|
||||
f, dInfo.Name, claimSize, r.sc, pattern.VolMode, dInfo.RequiredAccessModes)
|
||||
r.volSource = createVolumeSource(r.pvc.Name, false /* readOnly */)
|
||||
}
|
||||
r.volType = fmt.Sprintf("%s-dynamicPV", dInfo.Name)
|
||||
@ -302,16 +302,19 @@ func createPVCPV(
|
||||
pvSource *v1.PersistentVolumeSource,
|
||||
volumeNodeAffinity *v1.VolumeNodeAffinity,
|
||||
volMode v1.PersistentVolumeMode,
|
||||
accessModes []v1.PersistentVolumeAccessMode,
|
||||
) (*v1.PersistentVolume, *v1.PersistentVolumeClaim) {
|
||||
pvConfig := framework.PersistentVolumeConfig{
|
||||
NamePrefix: fmt.Sprintf("%s-", name),
|
||||
StorageClassName: f.Namespace.Name,
|
||||
PVSource: *pvSource,
|
||||
NodeAffinity: volumeNodeAffinity,
|
||||
AccessModes: accessModes,
|
||||
}
|
||||
|
||||
pvcConfig := framework.PersistentVolumeClaimConfig{
|
||||
StorageClassName: &f.Namespace.Name,
|
||||
AccessModes: accessModes,
|
||||
}
|
||||
|
||||
if volMode != "" {
|
||||
@ -335,6 +338,7 @@ func createPVCPVFromDynamicProvisionSC(
|
||||
claimSize string,
|
||||
sc *storagev1.StorageClass,
|
||||
volMode v1.PersistentVolumeMode,
|
||||
accessModes []v1.PersistentVolumeAccessMode,
|
||||
) (*v1.PersistentVolume, *v1.PersistentVolumeClaim) {
|
||||
cs := f.ClientSet
|
||||
ns := f.Namespace.Name
|
||||
@ -344,16 +348,14 @@ func createPVCPVFromDynamicProvisionSC(
|
||||
NamePrefix: name,
|
||||
ClaimSize: claimSize,
|
||||
StorageClassName: &(sc.Name),
|
||||
}
|
||||
|
||||
if len(volMode) != 0 {
|
||||
pvcCfg.VolumeMode = &volMode
|
||||
AccessModes: accessModes,
|
||||
VolumeMode: &volMode,
|
||||
}
|
||||
|
||||
pvc := framework.MakePersistentVolumeClaim(pvcCfg, ns)
|
||||
|
||||
var err error
|
||||
pvc, err = cs.CoreV1().PersistentVolumeClaims(ns).Create(pvc)
|
||||
pvc, err = framework.CreatePVC(cs, ns, pvc)
|
||||
framework.ExpectNoError(err)
|
||||
|
||||
if !isDelayedBinding(sc) {
|
||||
|
@ -160,11 +160,19 @@ type DriverInfo struct {
|
||||
InTreePluginName string
|
||||
FeatureTag string // FeatureTag for the driver
|
||||
|
||||
MaxFileSize int64 // Max file size to be tested for this driver
|
||||
SupportedFsType sets.String // Map of string for supported fs type
|
||||
SupportedMountOption sets.String // Map of string for supported mount option
|
||||
RequiredMountOption sets.String // Map of string for required mount option (Optional)
|
||||
Capabilities map[Capability]bool // Map that represents plugin capabilities
|
||||
// Max file size to be tested for this driver
|
||||
MaxFileSize int64
|
||||
// Map of string for supported fs type
|
||||
SupportedFsType sets.String
|
||||
// Map of string for supported mount option
|
||||
SupportedMountOption sets.String
|
||||
// [Optional] Map of string for required mount option
|
||||
RequiredMountOption sets.String
|
||||
// Map that represents plugin capabilities
|
||||
Capabilities map[Capability]bool
|
||||
// [Optional] List of access modes required for provisioning, defaults to
|
||||
// RWO if unset
|
||||
RequiredAccessModes []v1.PersistentVolumeAccessMode
|
||||
}
|
||||
|
||||
// PerTestConfig represents parameters that control test execution.
|
||||
|
Loading…
Reference in New Issue
Block a user