mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #105910 from deads2k/retry-pv-create
retry PV create in e2e-test on API quota failure
This commit is contained in:
commit
00aab6312f
@ -491,7 +491,7 @@ var _ = SIGDescribe("Cluster size autoscaling [Slow]", func() {
|
|||||||
StorageClassName: &emptyStorageClass,
|
StorageClassName: &emptyStorageClass,
|
||||||
}
|
}
|
||||||
|
|
||||||
pv, pvc, err := e2epv.CreatePVPVC(c, pvConfig, pvcConfig, f.Namespace.Name, false)
|
pv, pvc, err := e2epv.CreatePVPVC(c, f.Timeouts, pvConfig, pvcConfig, f.Namespace.Name, false)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
framework.ExpectNoError(e2epv.WaitOnPVandPVC(c, f.Timeouts, f.Namespace.Name, pv, pvc))
|
framework.ExpectNoError(e2epv.WaitOnPVandPVC(c, f.Timeouts, f.Namespace.Name, pv, pvc))
|
||||||
|
|
||||||
|
@ -19,8 +19,11 @@ package framework
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
|
|
||||||
"k8s.io/kubernetes/test/e2e/storage/utils"
|
"k8s.io/kubernetes/test/e2e/storage/utils"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
@ -295,17 +298,40 @@ func DeletePVCandValidatePVGroup(c clientset.Interface, timeouts *framework.Time
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create the PV resource. Fails test on error.
|
// create the PV resource. Fails test on error.
|
||||||
func createPV(c clientset.Interface, pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
func createPV(c clientset.Interface, timeouts *framework.TimeoutContext, pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||||
pv, err := c.CoreV1().PersistentVolumes().Create(context.TODO(), pv, metav1.CreateOptions{})
|
var resultPV *v1.PersistentVolume
|
||||||
|
var lastCreateErr error
|
||||||
|
err := wait.PollImmediate(29*time.Second, timeouts.PVCreate, func() (done bool, err error) {
|
||||||
|
resultPV, lastCreateErr = c.CoreV1().PersistentVolumes().Create(context.TODO(), pv, metav1.CreateOptions{})
|
||||||
|
if lastCreateErr != nil {
|
||||||
|
// If we hit a quota problem, we are not done and should retry again. This happens to be the quota failure string for GCP.
|
||||||
|
// If quota failure strings are found for other platforms, they can be added to improve reliability when running
|
||||||
|
// many parallel test jobs in a single cloud account. This corresponds to controller-like behavior and
|
||||||
|
// to what we would recommend for general clients.
|
||||||
|
if strings.Contains(lastCreateErr.Error(), `googleapi: Error 403: Quota exceeded for quota group`) {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// if it was not a quota failure, fail immediately
|
||||||
|
return false, lastCreateErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
})
|
||||||
|
// if we have an error from creating the PV, use that instead of a timeout error
|
||||||
|
if lastCreateErr != nil {
|
||||||
|
return nil, fmt.Errorf("PV Create API error: %v", err)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("PV Create API error: %v", err)
|
return nil, fmt.Errorf("PV Create API error: %v", err)
|
||||||
}
|
}
|
||||||
return pv, nil
|
|
||||||
|
return resultPV, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreatePV creates the PV resource. Fails test on error.
|
// CreatePV creates the PV resource. Fails test on error.
|
||||||
func CreatePV(c clientset.Interface, pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
func CreatePV(c clientset.Interface, timeouts *framework.TimeoutContext, pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
|
||||||
return createPV(c, pv)
|
return createPV(c, timeouts, pv)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreatePVC creates the PVC resource. Fails test on error.
|
// CreatePVC creates the PVC resource. Fails test on error.
|
||||||
@ -323,7 +349,7 @@ func CreatePVC(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim)
|
|||||||
// Note: in the pre-bind case the real PVC name, which is generated, is not
|
// Note: in the pre-bind case the real PVC name, which is generated, is not
|
||||||
// known until after the PVC is instantiated. This is why the pvc is created
|
// known until after the PVC is instantiated. This is why the pvc is created
|
||||||
// before the pv.
|
// before the pv.
|
||||||
func CreatePVCPV(c clientset.Interface, pvConfig PersistentVolumeConfig, pvcConfig PersistentVolumeClaimConfig, ns string, preBind bool) (*v1.PersistentVolume, *v1.PersistentVolumeClaim, error) {
|
func CreatePVCPV(c clientset.Interface, timeouts *framework.TimeoutContext, pvConfig PersistentVolumeConfig, pvcConfig PersistentVolumeClaimConfig, ns string, preBind bool) (*v1.PersistentVolume, *v1.PersistentVolumeClaim, error) {
|
||||||
// make the pvc spec
|
// make the pvc spec
|
||||||
pvc := MakePersistentVolumeClaim(pvcConfig, ns)
|
pvc := MakePersistentVolumeClaim(pvcConfig, ns)
|
||||||
preBindMsg := ""
|
preBindMsg := ""
|
||||||
@ -344,7 +370,7 @@ func CreatePVCPV(c clientset.Interface, pvConfig PersistentVolumeConfig, pvcConf
|
|||||||
if preBind {
|
if preBind {
|
||||||
pv.Spec.ClaimRef.Name = pvc.Name
|
pv.Spec.ClaimRef.Name = pvc.Name
|
||||||
}
|
}
|
||||||
pv, err = createPV(c, pv)
|
pv, err = createPV(c, timeouts, pv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, pvc, err
|
return nil, pvc, err
|
||||||
}
|
}
|
||||||
@ -358,7 +384,7 @@ func CreatePVCPV(c clientset.Interface, pvConfig PersistentVolumeConfig, pvcConf
|
|||||||
// Note: in the pre-bind case the real PV name, which is generated, is not
|
// Note: in the pre-bind case the real PV name, which is generated, is not
|
||||||
// known until after the PV is instantiated. This is why the pv is created
|
// known until after the PV is instantiated. This is why the pv is created
|
||||||
// before the pvc.
|
// before the pvc.
|
||||||
func CreatePVPVC(c clientset.Interface, pvConfig PersistentVolumeConfig, pvcConfig PersistentVolumeClaimConfig, ns string, preBind bool) (*v1.PersistentVolume, *v1.PersistentVolumeClaim, error) {
|
func CreatePVPVC(c clientset.Interface, timeouts *framework.TimeoutContext, pvConfig PersistentVolumeConfig, pvcConfig PersistentVolumeClaimConfig, ns string, preBind bool) (*v1.PersistentVolume, *v1.PersistentVolumeClaim, error) {
|
||||||
preBindMsg := ""
|
preBindMsg := ""
|
||||||
if preBind {
|
if preBind {
|
||||||
preBindMsg = " pre-bound"
|
preBindMsg = " pre-bound"
|
||||||
@ -370,7 +396,7 @@ func CreatePVPVC(c clientset.Interface, pvConfig PersistentVolumeConfig, pvcConf
|
|||||||
pvc := MakePersistentVolumeClaim(pvcConfig, ns)
|
pvc := MakePersistentVolumeClaim(pvcConfig, ns)
|
||||||
|
|
||||||
// instantiate the pv
|
// instantiate the pv
|
||||||
pv, err := createPV(c, pv)
|
pv, err := createPV(c, timeouts, pv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
@ -392,7 +418,7 @@ func CreatePVPVC(c clientset.Interface, pvConfig PersistentVolumeConfig, pvcConf
|
|||||||
// sees an error returned, it needs to decide what to do about entries in the maps.
|
// sees an error returned, it needs to decide what to do about entries in the maps.
|
||||||
// Note: when the test suite deletes the namespace orphaned pvcs and pods are deleted. However,
|
// Note: when the test suite deletes the namespace orphaned pvcs and pods are deleted. However,
|
||||||
// orphaned pvs are not deleted and will remain after the suite completes.
|
// orphaned pvs are not deleted and will remain after the suite completes.
|
||||||
func CreatePVsPVCs(numpvs, numpvcs int, c clientset.Interface, ns string, pvConfig PersistentVolumeConfig, pvcConfig PersistentVolumeClaimConfig) (PVMap, PVCMap, error) {
|
func CreatePVsPVCs(numpvs, numpvcs int, c clientset.Interface, timeouts *framework.TimeoutContext, ns string, pvConfig PersistentVolumeConfig, pvcConfig PersistentVolumeClaimConfig) (PVMap, PVCMap, error) {
|
||||||
pvMap := make(PVMap, numpvs)
|
pvMap := make(PVMap, numpvs)
|
||||||
pvcMap := make(PVCMap, numpvcs)
|
pvcMap := make(PVCMap, numpvcs)
|
||||||
extraPVCs := 0
|
extraPVCs := 0
|
||||||
@ -405,7 +431,7 @@ func CreatePVsPVCs(numpvs, numpvcs int, c clientset.Interface, ns string, pvConf
|
|||||||
|
|
||||||
// create pvs and pvcs
|
// create pvs and pvcs
|
||||||
for i := 0; i < pvsToCreate; i++ {
|
for i := 0; i < pvsToCreate; i++ {
|
||||||
pv, pvc, err := CreatePVPVC(c, pvConfig, pvcConfig, ns, false)
|
pv, pvc, err := CreatePVPVC(c, timeouts, pvConfig, pvcConfig, ns, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pvMap, pvcMap, err
|
return pvMap, pvcMap, err
|
||||||
}
|
}
|
||||||
@ -416,7 +442,7 @@ func CreatePVsPVCs(numpvs, numpvcs int, c clientset.Interface, ns string, pvConf
|
|||||||
// create extra pvs or pvcs as needed
|
// create extra pvs or pvcs as needed
|
||||||
for i := 0; i < extraPVs; i++ {
|
for i := 0; i < extraPVs; i++ {
|
||||||
pv := MakePersistentVolume(pvConfig)
|
pv := MakePersistentVolume(pvConfig)
|
||||||
pv, err := createPV(c, pv)
|
pv, err := createPV(c, timeouts, pv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return pvMap, pvcMap, err
|
return pvMap, pvcMap, err
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ const (
|
|||||||
claimBoundTimeout = 3 * time.Minute
|
claimBoundTimeout = 3 * time.Minute
|
||||||
pvReclaimTimeout = 3 * time.Minute
|
pvReclaimTimeout = 3 * time.Minute
|
||||||
pvBoundTimeout = 3 * time.Minute
|
pvBoundTimeout = 3 * time.Minute
|
||||||
|
pvCreateTimeout = 3 * time.Minute
|
||||||
pvDeleteTimeout = 3 * time.Minute
|
pvDeleteTimeout = 3 * time.Minute
|
||||||
pvDeleteSlowTimeout = 20 * time.Minute
|
pvDeleteSlowTimeout = 20 * time.Minute
|
||||||
snapshotCreateTimeout = 5 * time.Minute
|
snapshotCreateTimeout = 5 * time.Minute
|
||||||
@ -67,6 +68,9 @@ type TimeoutContext struct {
|
|||||||
// PVBound is how long PVs have to become bound.
|
// PVBound is how long PVs have to become bound.
|
||||||
PVBound time.Duration
|
PVBound time.Duration
|
||||||
|
|
||||||
|
// PVCreate is how long PVs have to be created.
|
||||||
|
PVCreate time.Duration
|
||||||
|
|
||||||
// PVDelete is how long PVs have to become deleted.
|
// PVDelete is how long PVs have to become deleted.
|
||||||
PVDelete time.Duration
|
PVDelete time.Duration
|
||||||
|
|
||||||
@ -95,6 +99,7 @@ func NewTimeoutContextWithDefaults() *TimeoutContext {
|
|||||||
ClaimBound: claimBoundTimeout,
|
ClaimBound: claimBoundTimeout,
|
||||||
PVReclaim: pvReclaimTimeout,
|
PVReclaim: pvReclaimTimeout,
|
||||||
PVBound: pvBoundTimeout,
|
PVBound: pvBoundTimeout,
|
||||||
|
PVCreate: pvCreateTimeout,
|
||||||
PVDelete: pvDeleteTimeout,
|
PVDelete: pvDeleteTimeout,
|
||||||
PVDeleteSlow: pvDeleteSlowTimeout,
|
PVDeleteSlow: pvDeleteSlowTimeout,
|
||||||
SnapshotCreate: snapshotCreateTimeout,
|
SnapshotCreate: snapshotCreateTimeout,
|
||||||
|
@ -142,7 +142,7 @@ var _ = utils.SIGDescribe("[Feature:Flexvolumes] Mounted flexvolume expand[Slow]
|
|||||||
VolumeMode: pvc.Spec.VolumeMode,
|
VolumeMode: pvc.Spec.VolumeMode,
|
||||||
})
|
})
|
||||||
|
|
||||||
_, err = e2epv.CreatePV(c, pv)
|
_, err = e2epv.CreatePV(c, f.Timeouts, pv)
|
||||||
framework.ExpectNoError(err, "Error creating pv %v", err)
|
framework.ExpectNoError(err, "Error creating pv %v", err)
|
||||||
|
|
||||||
ginkgo.By("Waiting for PVC to be in bound phase")
|
ginkgo.By("Waiting for PVC to be in bound phase")
|
||||||
|
@ -140,7 +140,7 @@ var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow] [Feature:Expa
|
|||||||
VolumeMode: pvc.Spec.VolumeMode,
|
VolumeMode: pvc.Spec.VolumeMode,
|
||||||
})
|
})
|
||||||
|
|
||||||
_, err = e2epv.CreatePV(c, pv)
|
_, err = e2epv.CreatePV(c, f.Timeouts, pv)
|
||||||
framework.ExpectNoError(err, "Error creating pv %v", err)
|
framework.ExpectNoError(err, "Error creating pv %v", err)
|
||||||
|
|
||||||
ginkgo.By("Waiting for PVC to be in bound phase")
|
ginkgo.By("Waiting for PVC to be in bound phase")
|
||||||
|
@ -259,7 +259,7 @@ func createPVCPV(
|
|||||||
}
|
}
|
||||||
|
|
||||||
framework.Logf("Creating PVC and PV")
|
framework.Logf("Creating PVC and PV")
|
||||||
pv, pvc, err := e2epv.CreatePVCPV(f.ClientSet, pvConfig, pvcConfig, f.Namespace.Name, false)
|
pv, pvc, err := e2epv.CreatePVCPV(f.ClientSet, f.Timeouts, pvConfig, pvcConfig, f.Namespace.Name, false)
|
||||||
framework.ExpectNoError(err, "PVC, PV creation failed")
|
framework.ExpectNoError(err, "PVC, PV creation failed")
|
||||||
|
|
||||||
err = e2epv.WaitOnPVandPVC(f.ClientSet, f.Timeouts, f.Namespace.Name, pv, pvc)
|
err = e2epv.WaitOnPVandPVC(f.ClientSet, f.Timeouts, f.Namespace.Name, pv, pvc)
|
||||||
|
@ -161,7 +161,7 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
|
|||||||
PVSource: *pvSource1,
|
PVSource: *pvSource1,
|
||||||
Prebind: nil,
|
Prebind: nil,
|
||||||
}
|
}
|
||||||
pv1, pvc1, err = e2epv.CreatePVPVC(c, pvConfig1, pvcConfig, ns, false)
|
pv1, pvc1, err = e2epv.CreatePVPVC(c, f.Timeouts, pvConfig1, pvcConfig, ns, false)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
framework.ExpectNoError(e2epv.WaitOnPVandPVC(c, f.Timeouts, ns, pv1, pvc1))
|
framework.ExpectNoError(e2epv.WaitOnPVandPVC(c, f.Timeouts, ns, pv1, pvc1))
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
|
|||||||
PVSource: *pvSource2,
|
PVSource: *pvSource2,
|
||||||
Prebind: nil,
|
Prebind: nil,
|
||||||
}
|
}
|
||||||
pv2, pvc2, err = e2epv.CreatePVPVC(c, pvConfig2, pvcConfig, ns, false)
|
pv2, pvc2, err = e2epv.CreatePVPVC(c, f.Timeouts, pvConfig2, pvcConfig, ns, false)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
framework.ExpectNoError(e2epv.WaitOnPVandPVC(c, f.Timeouts, ns, pv2, pvc2))
|
framework.ExpectNoError(e2epv.WaitOnPVandPVC(c, f.Timeouts, ns, pv2, pvc2))
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ func createGCEVolume() (*v1.PersistentVolumeSource, string) {
|
|||||||
// initTestCase initializes spec resources (pv, pvc, and pod) and returns pointers to be consumed
|
// initTestCase initializes spec resources (pv, pvc, and pod) and returns pointers to be consumed
|
||||||
// by the test.
|
// by the test.
|
||||||
func initTestCase(f *framework.Framework, c clientset.Interface, pvConfig e2epv.PersistentVolumeConfig, pvcConfig e2epv.PersistentVolumeClaimConfig, ns, nodeName string) (*v1.Pod, *v1.PersistentVolume, *v1.PersistentVolumeClaim) {
|
func initTestCase(f *framework.Framework, c clientset.Interface, pvConfig e2epv.PersistentVolumeConfig, pvcConfig e2epv.PersistentVolumeClaimConfig, ns, nodeName string) (*v1.Pod, *v1.PersistentVolume, *v1.PersistentVolumeClaim) {
|
||||||
pv, pvc, err := e2epv.CreatePVPVC(c, pvConfig, pvcConfig, ns, false)
|
pv, pvc, err := e2epv.CreatePVPVC(c, f.Timeouts, pvConfig, pvcConfig, ns, false)
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e2epv.DeletePersistentVolumeClaim(c, pvc.Name, ns)
|
e2epv.DeletePersistentVolumeClaim(c, pvc.Name, ns)
|
||||||
|
@ -46,7 +46,7 @@ func verifyGCEDiskAttached(diskName string, nodeName types.NodeName) bool {
|
|||||||
// initializeGCETestSpec creates a PV, PVC, and ClientPod that will run until killed by test or clean up.
|
// initializeGCETestSpec creates a PV, PVC, and ClientPod that will run until killed by test or clean up.
|
||||||
func initializeGCETestSpec(c clientset.Interface, t *framework.TimeoutContext, ns string, pvConfig e2epv.PersistentVolumeConfig, pvcConfig e2epv.PersistentVolumeClaimConfig, isPrebound bool) (*v1.Pod, *v1.PersistentVolume, *v1.PersistentVolumeClaim) {
|
func initializeGCETestSpec(c clientset.Interface, t *framework.TimeoutContext, ns string, pvConfig e2epv.PersistentVolumeConfig, pvcConfig e2epv.PersistentVolumeClaimConfig, isPrebound bool) (*v1.Pod, *v1.PersistentVolume, *v1.PersistentVolumeClaim) {
|
||||||
ginkgo.By("Creating the PV and PVC")
|
ginkgo.By("Creating the PV and PVC")
|
||||||
pv, pvc, err := e2epv.CreatePVPVC(c, pvConfig, pvcConfig, ns, isPrebound)
|
pv, pvc, err := e2epv.CreatePVPVC(c, t, pvConfig, pvcConfig, ns, isPrebound)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
framework.ExpectNoError(e2epv.WaitOnPVandPVC(c, t, ns, pv, pvc))
|
framework.ExpectNoError(e2epv.WaitOnPVandPVC(c, t, ns, pv, pvc))
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() {
|
|||||||
for _, localVolumes := range allLocalVolumes {
|
for _, localVolumes := range allLocalVolumes {
|
||||||
for _, localVolume := range localVolumes {
|
for _, localVolume := range localVolumes {
|
||||||
pvConfig := makeLocalPVConfig(config, localVolume)
|
pvConfig := makeLocalPVConfig(config, localVolume)
|
||||||
localVolume.pv, err = e2epv.CreatePV(config.client, e2epv.MakePersistentVolume(pvConfig))
|
localVolume.pv, err = e2epv.CreatePV(config.client, f.Timeouts, e2epv.MakePersistentVolume(pvConfig))
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -505,7 +505,7 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() {
|
|||||||
err = config.client.CoreV1().PersistentVolumes().Delete(context.TODO(), pv.Name, metav1.DeleteOptions{})
|
err = config.client.CoreV1().PersistentVolumes().Delete(context.TODO(), pv.Name, metav1.DeleteOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
pvConfig := makeLocalPVConfig(config, localVolume)
|
pvConfig := makeLocalPVConfig(config, localVolume)
|
||||||
localVolume.pv, err = e2epv.CreatePV(config.client, e2epv.MakePersistentVolume(pvConfig))
|
localVolume.pv, err = e2epv.CreatePV(config.client, f.Timeouts, e2epv.MakePersistentVolume(pvConfig))
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -637,7 +637,7 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() {
|
|||||||
}
|
}
|
||||||
pvConfig := makeLocalPVConfig(config, localVolume)
|
pvConfig := makeLocalPVConfig(config, localVolume)
|
||||||
var err error
|
var err error
|
||||||
pv, err = e2epv.CreatePV(config.client, e2epv.MakePersistentVolume(pvConfig))
|
pv, err = e2epv.CreatePV(config.client, f.Timeouts, e2epv.MakePersistentVolume(pvConfig))
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -936,7 +936,7 @@ func createLocalPVCsPVs(config *localTestConfig, volumes []*localTestVolume, mod
|
|||||||
pvcConfig := makeLocalPVCConfig(config, volume.localVolumeType)
|
pvcConfig := makeLocalPVCConfig(config, volume.localVolumeType)
|
||||||
pvConfig := makeLocalPVConfig(config, volume)
|
pvConfig := makeLocalPVConfig(config, volume)
|
||||||
|
|
||||||
volume.pv, volume.pvc, err = e2epv.CreatePVPVC(config.client, pvConfig, pvcConfig, config.ns, false)
|
volume.pv, volume.pvc, err = e2epv.CreatePVPVC(config.client, config.timeouts, pvConfig, pvcConfig, config.ns, false)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() {
|
|||||||
// contains the claim. Verify that the PV and PVC bind correctly, and
|
// contains the claim. Verify that the PV and PVC bind correctly, and
|
||||||
// that the pod can write to the nfs volume.
|
// that the pod can write to the nfs volume.
|
||||||
ginkgo.It("should create a non-pre-bound PV and PVC: test write access ", func() {
|
ginkgo.It("should create a non-pre-bound PV and PVC: test write access ", func() {
|
||||||
pv, pvc, err = e2epv.CreatePVPVC(c, pvConfig, pvcConfig, ns, false)
|
pv, pvc, err = e2epv.CreatePVPVC(c, f.Timeouts, pvConfig, pvcConfig, ns, false)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
completeTest(f, c, ns, pv, pvc)
|
completeTest(f, c, ns, pv, pvc)
|
||||||
})
|
})
|
||||||
@ -175,7 +175,7 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() {
|
|||||||
// pod that contains the claim. Verify that the PV and PVC bind
|
// pod that contains the claim. Verify that the PV and PVC bind
|
||||||
// correctly, and that the pod can write to the nfs volume.
|
// correctly, and that the pod can write to the nfs volume.
|
||||||
ginkgo.It("create a PVC and non-pre-bound PV: test write access", func() {
|
ginkgo.It("create a PVC and non-pre-bound PV: test write access", func() {
|
||||||
pv, pvc, err = e2epv.CreatePVCPV(c, pvConfig, pvcConfig, ns, false)
|
pv, pvc, err = e2epv.CreatePVCPV(c, f.Timeouts, pvConfig, pvcConfig, ns, false)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
completeTest(f, c, ns, pv, pvc)
|
completeTest(f, c, ns, pv, pvc)
|
||||||
})
|
})
|
||||||
@ -184,7 +184,7 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() {
|
|||||||
// and a pod that contains the claim. Verify that the PV and PVC bind
|
// and a pod that contains the claim. Verify that the PV and PVC bind
|
||||||
// correctly, and that the pod can write to the nfs volume.
|
// correctly, and that the pod can write to the nfs volume.
|
||||||
ginkgo.It("create a PVC and a pre-bound PV: test write access", func() {
|
ginkgo.It("create a PVC and a pre-bound PV: test write access", func() {
|
||||||
pv, pvc, err = e2epv.CreatePVCPV(c, pvConfig, pvcConfig, ns, true)
|
pv, pvc, err = e2epv.CreatePVCPV(c, f.Timeouts, pvConfig, pvcConfig, ns, true)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
completeTest(f, c, ns, pv, pvc)
|
completeTest(f, c, ns, pv, pvc)
|
||||||
})
|
})
|
||||||
@ -193,7 +193,7 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() {
|
|||||||
// and a pod that contains the claim. Verify that the PV and PVC bind
|
// and a pod that contains the claim. Verify that the PV and PVC bind
|
||||||
// correctly, and that the pod can write to the nfs volume.
|
// correctly, and that the pod can write to the nfs volume.
|
||||||
ginkgo.It("create a PV and a pre-bound PVC: test write access", func() {
|
ginkgo.It("create a PV and a pre-bound PVC: test write access", func() {
|
||||||
pv, pvc, err = e2epv.CreatePVPVC(c, pvConfig, pvcConfig, ns, true)
|
pv, pvc, err = e2epv.CreatePVPVC(c, f.Timeouts, pvConfig, pvcConfig, ns, true)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
completeTest(f, c, ns, pv, pvc)
|
completeTest(f, c, ns, pv, pvc)
|
||||||
})
|
})
|
||||||
@ -231,7 +231,7 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() {
|
|||||||
// Note: PVs are created before claims and no pre-binding
|
// Note: PVs are created before claims and no pre-binding
|
||||||
ginkgo.It("should create 2 PVs and 4 PVCs: test write access", func() {
|
ginkgo.It("should create 2 PVs and 4 PVCs: test write access", func() {
|
||||||
numPVs, numPVCs := 2, 4
|
numPVs, numPVCs := 2, 4
|
||||||
pvols, claims, err = e2epv.CreatePVsPVCs(numPVs, numPVCs, c, ns, pvConfig, pvcConfig)
|
pvols, claims, err = e2epv.CreatePVsPVCs(numPVs, numPVCs, c, f.Timeouts, ns, pvConfig, pvcConfig)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
framework.ExpectNoError(e2epv.WaitAndVerifyBinds(c, f.Timeouts, ns, pvols, claims, true))
|
framework.ExpectNoError(e2epv.WaitAndVerifyBinds(c, f.Timeouts, ns, pvols, claims, true))
|
||||||
framework.ExpectNoError(completeMultiTest(f, c, ns, pvols, claims, v1.VolumeReleased))
|
framework.ExpectNoError(completeMultiTest(f, c, ns, pvols, claims, v1.VolumeReleased))
|
||||||
@ -241,7 +241,7 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() {
|
|||||||
// Note: PVs are created before claims and no pre-binding
|
// Note: PVs are created before claims and no pre-binding
|
||||||
ginkgo.It("should create 3 PVs and 3 PVCs: test write access", func() {
|
ginkgo.It("should create 3 PVs and 3 PVCs: test write access", func() {
|
||||||
numPVs, numPVCs := 3, 3
|
numPVs, numPVCs := 3, 3
|
||||||
pvols, claims, err = e2epv.CreatePVsPVCs(numPVs, numPVCs, c, ns, pvConfig, pvcConfig)
|
pvols, claims, err = e2epv.CreatePVsPVCs(numPVs, numPVCs, c, f.Timeouts, ns, pvConfig, pvcConfig)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
framework.ExpectNoError(e2epv.WaitAndVerifyBinds(c, f.Timeouts, ns, pvols, claims, true))
|
framework.ExpectNoError(e2epv.WaitAndVerifyBinds(c, f.Timeouts, ns, pvols, claims, true))
|
||||||
framework.ExpectNoError(completeMultiTest(f, c, ns, pvols, claims, v1.VolumeReleased))
|
framework.ExpectNoError(completeMultiTest(f, c, ns, pvols, claims, v1.VolumeReleased))
|
||||||
@ -251,7 +251,7 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() {
|
|||||||
// Note: PVs are created before claims and no pre-binding.
|
// Note: PVs are created before claims and no pre-binding.
|
||||||
ginkgo.It("should create 4 PVs and 2 PVCs: test write access [Slow]", func() {
|
ginkgo.It("should create 4 PVs and 2 PVCs: test write access [Slow]", func() {
|
||||||
numPVs, numPVCs := 4, 2
|
numPVs, numPVCs := 4, 2
|
||||||
pvols, claims, err = e2epv.CreatePVsPVCs(numPVs, numPVCs, c, ns, pvConfig, pvcConfig)
|
pvols, claims, err = e2epv.CreatePVsPVCs(numPVs, numPVCs, c, f.Timeouts, ns, pvConfig, pvcConfig)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
framework.ExpectNoError(e2epv.WaitAndVerifyBinds(c, f.Timeouts, ns, pvols, claims, true))
|
framework.ExpectNoError(e2epv.WaitAndVerifyBinds(c, f.Timeouts, ns, pvols, claims, true))
|
||||||
framework.ExpectNoError(completeMultiTest(f, c, ns, pvols, claims, v1.VolumeReleased))
|
framework.ExpectNoError(completeMultiTest(f, c, ns, pvols, claims, v1.VolumeReleased))
|
||||||
@ -264,7 +264,7 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() {
|
|||||||
ginkgo.Context("when invoking the Recycle reclaim policy", func() {
|
ginkgo.Context("when invoking the Recycle reclaim policy", func() {
|
||||||
ginkgo.BeforeEach(func() {
|
ginkgo.BeforeEach(func() {
|
||||||
pvConfig.ReclaimPolicy = v1.PersistentVolumeReclaimRecycle
|
pvConfig.ReclaimPolicy = v1.PersistentVolumeReclaimRecycle
|
||||||
pv, pvc, err = e2epv.CreatePVPVC(c, pvConfig, pvcConfig, ns, false)
|
pv, pvc, err = e2epv.CreatePVPVC(c, f.Timeouts, pvConfig, pvcConfig, ns, false)
|
||||||
framework.ExpectNoError(err, "BeforeEach: Failed to create PV/PVC")
|
framework.ExpectNoError(err, "BeforeEach: Failed to create PV/PVC")
|
||||||
framework.ExpectNoError(e2epv.WaitOnPVandPVC(c, f.Timeouts, ns, pv, pvc), "BeforeEach: WaitOnPVandPVC failed")
|
framework.ExpectNoError(e2epv.WaitOnPVandPVC(c, f.Timeouts, ns, pv, pvc), "BeforeEach: WaitOnPVandPVC failed")
|
||||||
})
|
})
|
||||||
|
@ -19,6 +19,7 @@ package storage
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -110,7 +111,7 @@ func PodsUseStaticPVsOrFail(f *framework.Framework, podCount int, image string)
|
|||||||
className := ""
|
className := ""
|
||||||
pvcConfig := e2epv.PersistentVolumeClaimConfig{StorageClassName: &className}
|
pvcConfig := e2epv.PersistentVolumeClaimConfig{StorageClassName: &className}
|
||||||
|
|
||||||
config.pv, config.pvc, err = e2epv.CreatePVPVC(c, pvConfig, pvcConfig, ns, true)
|
config.pv, config.pvc, err = e2epv.CreatePVPVC(c, f.Timeouts, pvConfig, pvcConfig, ns, true)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,7 +598,7 @@ var _ = utils.SIGDescribe("[Serial] Volume metrics", func() {
|
|||||||
ginkgo.It("should create unbound pv count metrics for pvc controller after creating pv only",
|
ginkgo.It("should create unbound pv count metrics for pvc controller after creating pv only",
|
||||||
func() {
|
func() {
|
||||||
var err error
|
var err error
|
||||||
pv, err = e2epv.CreatePV(c, pv)
|
pv, err = e2epv.CreatePV(c, f.Timeouts, pv)
|
||||||
framework.ExpectNoError(err, "Error creating pv: %v", err)
|
framework.ExpectNoError(err, "Error creating pv: %v", err)
|
||||||
waitForPVControllerSync(metricsGrabber, unboundPVKey, classKey)
|
waitForPVControllerSync(metricsGrabber, unboundPVKey, classKey)
|
||||||
validator([]map[string]int64{nil, {className: 1}, nil, nil})
|
validator([]map[string]int64{nil, {className: 1}, nil, nil})
|
||||||
@ -616,7 +616,7 @@ var _ = utils.SIGDescribe("[Serial] Volume metrics", func() {
|
|||||||
ginkgo.It("should create bound pv/pvc count metrics for pvc controller after creating both pv and pvc",
|
ginkgo.It("should create bound pv/pvc count metrics for pvc controller after creating both pv and pvc",
|
||||||
func() {
|
func() {
|
||||||
var err error
|
var err error
|
||||||
pv, pvc, err = e2epv.CreatePVPVC(c, pvConfig, pvcConfig, ns, true)
|
pv, pvc, err = e2epv.CreatePVPVC(c, f.Timeouts, pvConfig, pvcConfig, ns, true)
|
||||||
framework.ExpectNoError(err, "Error creating pv pvc: %v", err)
|
framework.ExpectNoError(err, "Error creating pv pvc: %v", err)
|
||||||
waitForPVControllerSync(metricsGrabber, boundPVKey, classKey)
|
waitForPVControllerSync(metricsGrabber, boundPVKey, classKey)
|
||||||
waitForPVControllerSync(metricsGrabber, boundPVCKey, namespaceKey)
|
waitForPVControllerSync(metricsGrabber, boundPVCKey, namespaceKey)
|
||||||
@ -627,7 +627,7 @@ var _ = utils.SIGDescribe("[Serial] Volume metrics", func() {
|
|||||||
func() {
|
func() {
|
||||||
var err error
|
var err error
|
||||||
dimensions := []string{pluginNameKey, volumeModeKey}
|
dimensions := []string{pluginNameKey, volumeModeKey}
|
||||||
pv, err = e2epv.CreatePV(c, pv)
|
pv, err = e2epv.CreatePV(c, f.Timeouts, pv)
|
||||||
framework.ExpectNoError(err, "Error creating pv: %v", err)
|
framework.ExpectNoError(err, "Error creating pv: %v", err)
|
||||||
waitForPVControllerSync(metricsGrabber, totalPVKey, pluginNameKey)
|
waitForPVControllerSync(metricsGrabber, totalPVKey, pluginNameKey)
|
||||||
controllerMetrics, err := metricsGrabber.GrabFromControllerManager()
|
controllerMetrics, err := metricsGrabber.GrabFromControllerManager()
|
||||||
|
@ -94,7 +94,7 @@ var _ = utils.SIGDescribe("PersistentVolumes:vsphere [Feature:vsphere]", func()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ginkgo.By("Creating the PV and PVC")
|
ginkgo.By("Creating the PV and PVC")
|
||||||
pv, pvc, err = e2epv.CreatePVPVC(c, pvConfig, pvcConfig, ns, false)
|
pv, pvc, err = e2epv.CreatePVPVC(c, f.Timeouts, pvConfig, pvcConfig, ns, false)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
framework.ExpectNoError(e2epv.WaitOnPVandPVC(c, f.Timeouts, ns, pv, pvc))
|
framework.ExpectNoError(e2epv.WaitOnPVandPVC(c, f.Timeouts, ns, pv, pvc))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user