From 6d6b6b0bf6310da6f9c9c2e3fc21c515ef08a318 Mon Sep 17 00:00:00 2001 From: Yu-Lin Chen Date: Thu, 28 Sep 2023 03:49:50 +0000 Subject: [PATCH] [YUNIKORN-1998] Stale AdmissionControllerConf was used in e2e test --- test/e2e/framework/helpers/yunikorn/wrappers.go | 2 ++ test/e2e/framework/helpers/yunikorn/yk_utils.go | 8 ++++++++ test/e2e/user_group_limit/user_group_limit_test.go | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/test/e2e/framework/helpers/yunikorn/wrappers.go b/test/e2e/framework/helpers/yunikorn/wrappers.go index d7296f546..42db2b769 100644 --- a/test/e2e/framework/helpers/yunikorn/wrappers.go +++ b/test/e2e/framework/helpers/yunikorn/wrappers.go @@ -116,6 +116,8 @@ func UpdateCustomConfigMapWrapperWithMap(oldConfigMap *v1.ConfigMap, schedPolicy Ω(err3).NotTo(HaveOccurred()) Ω(d).NotTo(BeNil()) + // Only wait until the yunikorn scheduler updates its configurations + // Validation for admission controller config was not supported. Please refer to YUNIKORN-1998 err = WaitForQueueTS("root", ts, 2*time.Minute) Ω(err).NotTo(HaveOccurred()) } diff --git a/test/e2e/framework/helpers/yunikorn/yk_utils.go b/test/e2e/framework/helpers/yunikorn/yk_utils.go index 799567387..33e0c31a6 100644 --- a/test/e2e/framework/helpers/yunikorn/yk_utils.go +++ b/test/e2e/framework/helpers/yunikorn/yk_utils.go @@ -149,3 +149,11 @@ func RestartYunikornAndAddTolerations(kClient *k8s.KubeCtl, addTolerations bool, err = kClient.WaitForPodBySelectorRunning(configmanager.YuniKornTestConfig.YkNamespace, fmt.Sprintf("component=%s", configmanager.YKScheduler), 30) Ω(err).NotTo(gomega.HaveOccurred()) } + +func DelayForAdmissionControllerRefreshConf() { + // Delay for 5 seconds to allow the admission controller to update its configurations. + // There is no guarantee it will update within 5 seconds. + // This is a quick solution for YUNIKORN-1998 + // It's better to have a configurations freshness checker for the admission controller. + time.Sleep(5 * time.Second) +} diff --git a/test/e2e/user_group_limit/user_group_limit_test.go b/test/e2e/user_group_limit/user_group_limit_test.go index 4651f70ff..f6b6e7e14 100644 --- a/test/e2e/user_group_limit/user_group_limit_test.go +++ b/test/e2e/user_group_limit/user_group_limit_test.go @@ -131,6 +131,7 @@ var _ = ginkgo.Describe("UserGroupLimit", func() { } return common.AddQueue(sc, "default", "root", configs.QueueConfig{Name: "sandbox2"}) }) + yunikorn.DelayForAdmissionControllerRefreshConf() // usergroup1 can deploy the first sleep pod to root.sandbox1 usergroup1 := &si.UserGroupInformation{User: user1, Groups: []string{group1}} @@ -176,6 +177,7 @@ var _ = ginkgo.Describe("UserGroupLimit", func() { } return common.AddQueue(sc, "default", "root", configs.QueueConfig{Name: "sandbox2"}) }) + yunikorn.DelayForAdmissionControllerRefreshConf() // usergroup1 can deploy the first sleep pod to root.sandbox1 usergroup1 := &si.UserGroupInformation{User: user1, Groups: []string{group1}} @@ -221,6 +223,7 @@ var _ = ginkgo.Describe("UserGroupLimit", func() { } return common.AddQueue(sc, "default", "root", configs.QueueConfig{Name: "sandbox2"}) }) + yunikorn.DelayForAdmissionControllerRefreshConf() // usergroup1 can deploy the first sleep pod to root.sandbox1 usergroup1 := &si.UserGroupInformation{User: user1, Groups: []string{group1}} @@ -264,6 +267,7 @@ var _ = ginkgo.Describe("UserGroupLimit", func() { } return common.AddQueue(sc, "default", "root", configs.QueueConfig{Name: "sandbox2"}) }) + yunikorn.DelayForAdmissionControllerRefreshConf() // usergroup1 can deploy the first sleep pod to root.sandbox1 usergroup1 := &si.UserGroupInformation{User: user1, Groups: []string{group1}} @@ -315,6 +319,7 @@ var _ = ginkgo.Describe("UserGroupLimit", func() { } return common.AddQueue(sc, "default", "root", configs.QueueConfig{Name: "sandbox2"}) }) + yunikorn.DelayForAdmissionControllerRefreshConf() // usergroup1 can deploy the first sleep pod to root.sandbox1 usergroup1 := &si.UserGroupInformation{User: user1, Groups: []string{group1}} @@ -357,6 +362,7 @@ var _ = ginkgo.Describe("UserGroupLimit", func() { } return common.AddQueue(sc, "default", "root", configs.QueueConfig{Name: "sandbox2"}) }) + yunikorn.DelayForAdmissionControllerRefreshConf() // usergroup1 can deploy the first sleep pod to root.sandbox1 usergroup1 := &si.UserGroupInformation{User: user1, Groups: []string{group1}}