diff --git a/tests/e2e/policy_driven_vol_allocation.go b/tests/e2e/policy_driven_vol_allocation.go index bc0a803b52..7e6a9aa797 100644 --- a/tests/e2e/policy_driven_vol_allocation.go +++ b/tests/e2e/policy_driven_vol_allocation.go @@ -79,10 +79,10 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation client = f.ClientSet namespace = getNamespaceToRunTests(f) bootstrap() - if guestCluster { + /*if guestCluster { svcClient, svNamespace := getSvcClientAndNamespace() setResourceQuota(svcClient, svNamespace, rqLimitScaleTest) - } + }*/ nodeList, err := fnodes.GetReadySchedulableNodes(ctx, f.ClientSet) framework.ExpectNoError(err, "Unable to find ready and schedulable Node") if !(len(nodeList.Items) > 0) { @@ -268,9 +268,17 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation if supervisorCluster { assignPolicyToWcpNamespace(client, ctx, namespace, policyNames, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + for _, policyName := range policyNames { + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } } else if guestCluster { _, svNamespace := getSvcClientAndNamespace() assignPolicyToWcpNamespace(client, ctx, svNamespace, policyNames, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + for _, policyName := range policyNames { + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } } for i, policyName := range policyNames { @@ -285,7 +293,7 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } else if supervisorCluster { ginkgo.By("CNS_TEST: Running for WCP setup") // create resource quota - createResourceQuota(client, namespace, rqLimit, policyName) + //createResourceQuota(client, namespace, rqLimit, policyName) if wcpVsanDirectCluster { storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) @@ -302,7 +310,7 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } } else { ginkgo.By("CNS_TEST: Running for GC setup") - createResourceQuota(client, namespace, rqLimit, policyName) + //createResourceQuota(client, namespace, rqLimit, policyName) storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) pvclaim, err = createPVC(ctx, client, namespace, nil, "", storageclass, "") @@ -509,9 +517,17 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation if supervisorCluster { assignPolicyToWcpNamespace(client, ctx, namespace, policyNames, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + for _, policyName := range policyNames { + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } } else if guestCluster { _, svNamespace := getSvcClientAndNamespace() assignPolicyToWcpNamespace(client, ctx, svNamespace, policyNames, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + for _, policyName := range policyNames { + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } } for i, policyName := range policyNames { @@ -526,7 +542,6 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } else if supervisorCluster { ginkgo.By("CNS_TEST: Running for WCP setup") // create resource quota - createResourceQuota(client, namespace, rqLimit, policyName) if wcpVsanDirectCluster { storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) @@ -543,7 +558,6 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } } else { ginkgo.By("CNS_TEST: Running for GC setup") - createResourceQuota(client, namespace, rqLimit, policyName) storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) pvclaim, err = createPVC(ctx, client, namespace, nil, largeSize, storageclass, "") @@ -730,9 +744,13 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation if supervisorCluster { assignPolicyToWcpNamespace(client, ctx, namespace, []string{policyName}, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) } else if guestCluster { _, svNamespace := getSvcClientAndNamespace() assignPolicyToWcpNamespace(client, ctx, svNamespace, []string{policyName}, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) } setVpxdTaskTimeout(ctx, vpxdReducedTaskTimeoutSecsInt) @@ -751,7 +769,6 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } else if supervisorCluster { ginkgo.By("CNS_TEST: Running for WCP setup") // create resource quota - createResourceQuota(client, namespace, rqLimit, policyName) if wcpVsanDirectCluster { storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) @@ -766,7 +783,6 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } } else { ginkgo.By("CNS_TEST: Running for GC setup") - createResourceQuota(client, namespace, rqLimit, policyName) storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) pvclaim, err = createPVC(ctx, client, namespace, nil, largeSize, storageclass, "") @@ -934,9 +950,15 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation if supervisorCluster { assignPolicyToWcpNamespace(client, ctx, namespace, []string{policyName}, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } else if guestCluster { _, svNamespace := getSvcClientAndNamespace() assignPolicyToWcpNamespace(client, ctx, svNamespace, []string{policyName}, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } setVpxdTaskTimeout(ctx, vpxdReducedTaskTimeoutSecsInt) @@ -955,7 +977,6 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } else if supervisorCluster { ginkgo.By("CNS_TEST: Running for WCP setup") // create resource quota - createResourceQuota(client, namespace, rqLimit, policyName) if wcpVsanDirectCluster { storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) @@ -970,7 +991,6 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } } else { ginkgo.By("CNS_TEST: Running for GC setup") - createResourceQuota(client, namespace, rqLimit, policyName) storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) pvclaim, err = createPVC(ctx, client, namespace, nil, "", storageclass, "") @@ -1222,9 +1242,17 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation if supervisorCluster { assignPolicyToWcpNamespace(client, ctx, namespace, policyNames, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + for _, policyName := range policyNames { + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } } else if guestCluster { _, svNamespace := getSvcClientAndNamespace() assignPolicyToWcpNamespace(client, ctx, svNamespace, policyNames, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + for _, policyName := range policyNames { + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } } for i, policyName := range policyNames { @@ -1239,7 +1267,6 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } else if supervisorCluster { ginkgo.By("CNS_TEST: Running for WCP setup") // create resource quota - createResourceQuota(client, namespace, rqLimit, policyName) if wcpVsanDirectCluster { storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) @@ -1256,7 +1283,6 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } } else { ginkgo.By("CNS_TEST: Running for GC setup") - createResourceQuota(client, namespace, rqLimit, policyName) storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) pvclaim, err = createPVC(ctx, client, namespace, nil, "", storageclass, "") @@ -1541,9 +1567,17 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation if supervisorCluster { assignPolicyToWcpNamespace(client, ctx, namespace, policyNames, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + for _, policyName := range policyNames { + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } } else if guestCluster { _, svNamespace := getSvcClientAndNamespace() assignPolicyToWcpNamespace(client, ctx, svNamespace, policyNames, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + for _, policyName := range policyNames { + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } } if vanillaCluster { @@ -1554,12 +1588,10 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation gomega.Expect(err).NotTo(gomega.HaveOccurred()) } else if supervisorCluster { ginkgo.By("CNS_TEST: Running for WCP setup") - createResourceQuota(client, namespace, rqLimit, policyName) storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) } else { ginkgo.By("CNS_TEST: Running for GC setup") - createResourceQuota(client, namespace, rqLimit, policyName) storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) } @@ -1821,9 +1853,15 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation if supervisorCluster { assignPolicyToWcpNamespace(client, ctx, namespace, []string{policyName}, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } else if guestCluster { _, svNamespace := getSvcClientAndNamespace() assignPolicyToWcpNamespace(client, ctx, svNamespace, []string{policyName}, resourceQuotaLimit) + restClientConfig := getRestConfigClient() + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + } ginkgo.By("Create SC using policy created in step 1") @@ -1838,7 +1876,6 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } else if supervisorCluster { ginkgo.By("CNS_TEST: Running for WCP setup") // create resource quota - createResourceQuota(client, namespace, rqLimit, policyName) if wcpVsanDirectCluster { storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) @@ -1853,7 +1890,6 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } } else { ginkgo.By("CNS_TEST: Running for GC setup") - createResourceQuota(client, namespace, rqLimit, policyName) storageclass, err = client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) pvclaim, err = createPVC(ctx, client, namespace, nil, "", storageclass, "") @@ -2405,7 +2441,8 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation } else if supervisorCluster { assignPolicyToWcpNamespace(client, ctx, namespace, policyNames, resourceQuotaLimit) for _, policyName := range policyNames { - createResourceQuota(client, namespace, rqLimit, policyName) + restClientConfig := getRestConfigClient() + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) storageclass, err := client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) scs = append(scs, storageclass) @@ -2414,7 +2451,9 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation svcClient, svNamespace := getSvcClientAndNamespace() assignPolicyToWcpNamespace(svcClient, ctx, svNamespace, policyNames, resourceQuotaLimit) for _, policyName := range policyNames { - createResourceQuota(svcClient, svNamespace, rqLimit, policyName) + restClientConfig := getRestConfigClient() + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + storageclass, err := svcClient.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) scs = append(scs, storageclass) @@ -2622,7 +2661,9 @@ var _ = ginkgo.Describe("[vol-allocation] Policy driven volume space allocation policyNames = append(policyNames, policyName) assignPolicyToWcpNamespace(client, ctx, namespace, policyNames, resourceQuotaLimit) - createResourceQuota(client, namespace, rqLimit, policyName) + restClientConfig := getRestConfigClient() + setStoragePolicyQuota(ctx, restClientConfig, policyName, namespace, resourceQuotaLimit) + storageclass, err := client.StorageV1().StorageClasses().Get(ctx, policyName, metav1.GetOptions{}) gomega.Expect(err).NotTo(gomega.HaveOccurred()) err = createVsanDPvcAndPod(sshWcpConfig, svcMasterIp, svcNamespace, diff --git a/tests/e2e/util.go b/tests/e2e/util.go index 4a16536ca0..b528cdd2b5 100644 --- a/tests/e2e/util.go +++ b/tests/e2e/util.go @@ -6989,6 +6989,7 @@ func setStoragePolicyQuota(ctx context.Context, restClientConfig *rest.Config, cnsOperatorClient, err := k8s.NewClientForGroup(ctx, restClientConfig, cnsoperatorv1alpha1.GroupName) gomega.Expect(err).NotTo(gomega.HaveOccurred()) + time.Sleep(7 * time.Minute) spq := &storagepolicyv1alpha2.StoragePolicyQuota{} err = cnsOperatorClient.Get(ctx, pkgtypes.NamespacedName{Name: scName + storagePolicyQuota, Namespace: namespace}, spq) @@ -7009,6 +7010,7 @@ func removeStoragePolicyQuota(ctx context.Context, restClientConfig *rest.Config gomega.Expect(err).NotTo(gomega.HaveOccurred()) spq := &storagepolicyv1alpha2.StoragePolicyQuota{} + time.Sleep(7 * time.Minute) err = cnsOperatorClient.Get(ctx, pkgtypes.NamespacedName{Name: scName + storagePolicyQuota, Namespace: namespace}, spq) gomega.Expect(err).NotTo(gomega.HaveOccurred())