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