mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #103074 from wongma7/volumelimitsmigration
Disable deprecated volume limits test when CSI migration enabled and replace with CSI-specific test
This commit is contained in:
commit
164ce31e7f
@ -49,6 +49,7 @@ var localStorageCapacityIsolation featuregate.Feature = "LocalStorageCapacityIso
|
|||||||
var (
|
var (
|
||||||
downwardAPIHugePages featuregate.Feature = "DownwardAPIHugePages"
|
downwardAPIHugePages featuregate.Feature = "DownwardAPIHugePages"
|
||||||
execProbeTimeout featuregate.Feature = "ExecProbeTimeout"
|
execProbeTimeout featuregate.Feature = "ExecProbeTimeout"
|
||||||
|
csiMigration featuregate.Feature = "CSIMigration"
|
||||||
)
|
)
|
||||||
|
|
||||||
func skipInternalf(caller int, format string, args ...interface{}) {
|
func skipInternalf(caller int, format string, args ...interface{}) {
|
||||||
@ -154,6 +155,12 @@ func SkipUnlessExecProbeTimeoutEnabled() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SkipIfCSIMigrationEnabled() {
|
||||||
|
if utilfeature.DefaultFeatureGate.Enabled(csiMigration) {
|
||||||
|
skipInternalf(1, "Only supported when %v feature is disabled", csiMigration)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SkipIfMissingResource skips if the gvr resource is missing.
|
// SkipIfMissingResource skips if the gvr resource is missing.
|
||||||
func SkipIfMissingResource(dynamicClient dynamic.Interface, gvr schema.GroupVersionResource, namespace string) {
|
func SkipIfMissingResource(dynamicClient dynamic.Interface, gvr schema.GroupVersionResource, namespace string) {
|
||||||
resourceClient := dynamicClient.Resource(gvr).Namespace(namespace)
|
resourceClient := dynamicClient.Resource(gvr).Namespace(namespace)
|
||||||
|
@ -234,6 +234,40 @@ func (t *volumeLimitsTestSuite) DefineTests(driver storageframework.TestDriver,
|
|||||||
})
|
})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ginkgo.It("should verify that all csinodes have volume limits", func() {
|
||||||
|
driverInfo := driver.GetDriverInfo()
|
||||||
|
if !driverInfo.Capabilities[storageframework.CapVolumeLimits] {
|
||||||
|
ginkgo.Skip(fmt.Sprintf("driver %s does not support volume limits", driverInfo.Name))
|
||||||
|
}
|
||||||
|
|
||||||
|
l.ns = f.Namespace
|
||||||
|
l.cs = f.ClientSet
|
||||||
|
|
||||||
|
l.config, l.testCleanup = driver.PrepareTest(f)
|
||||||
|
defer l.testCleanup()
|
||||||
|
|
||||||
|
nodeNames := []string{}
|
||||||
|
if l.config.ClientNodeSelection.Name != "" {
|
||||||
|
// Some CSI drivers are deployed to a single node (e.g csi-hostpath),
|
||||||
|
// so we check that node instead of checking all of them
|
||||||
|
nodeNames = append(nodeNames, l.config.ClientNodeSelection.Name)
|
||||||
|
} else {
|
||||||
|
nodeList, err := e2enode.GetReadySchedulableNodes(f.ClientSet)
|
||||||
|
framework.ExpectNoError(err)
|
||||||
|
for _, node := range nodeList.Items {
|
||||||
|
nodeNames = append(nodeNames, node.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, nodeName := range nodeNames {
|
||||||
|
ginkgo.By("Checking csinode limits")
|
||||||
|
_, err := getNodeLimits(l.cs, l.config, nodeName, driverInfo)
|
||||||
|
if err != nil {
|
||||||
|
framework.Failf("Expected volume limits to be set, error: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanupTest(cs clientset.Interface, ns string, runningPodName, unschedulablePodName string, pvcs []*v1.PersistentVolumeClaim, pvNames sets.String, timeout time.Duration) error {
|
func cleanupTest(cs clientset.Interface, ns string, runningPodName, unschedulablePodName string, pvcs []*v1.PersistentVolumeClaim, pvNames sets.String, timeout time.Duration) error {
|
||||||
|
@ -34,6 +34,8 @@ var _ = utils.SIGDescribe("Volume limits", func() {
|
|||||||
f := framework.NewDefaultFramework("volume-limits-on-node")
|
f := framework.NewDefaultFramework("volume-limits-on-node")
|
||||||
ginkgo.BeforeEach(func() {
|
ginkgo.BeforeEach(func() {
|
||||||
e2eskipper.SkipUnlessProviderIs("aws", "gce", "gke")
|
e2eskipper.SkipUnlessProviderIs("aws", "gce", "gke")
|
||||||
|
// If CSIMigration is enabled, then the limits should be on CSINodes, not Nodes, and another test checks this
|
||||||
|
e2eskipper.SkipIfCSIMigrationEnabled()
|
||||||
c = f.ClientSet
|
c = f.ClientSet
|
||||||
framework.ExpectNoError(framework.WaitForAllNodesSchedulable(c, framework.TestContext.NodeSchedulableTimeout))
|
framework.ExpectNoError(framework.WaitForAllNodesSchedulable(c, framework.TestContext.NodeSchedulableTimeout))
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user