Skip to content

Commit

Permalink
[YUNIKORN-1998] Stale AdmissionControllerConf was used in e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyulin0719 committed Sep 28, 2023
1 parent 168bfec commit 6d6b6b0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/e2e/framework/helpers/yunikorn/wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
8 changes: 8 additions & 0 deletions test/e2e/framework/helpers/yunikorn/yk_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
6 changes: 6 additions & 0 deletions test/e2e/user_group_limit/user_group_limit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -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}}
Expand Down Expand Up @@ -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}}
Expand Down Expand Up @@ -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}}
Expand Down Expand Up @@ -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}}
Expand Down Expand Up @@ -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}}
Expand Down

0 comments on commit 6d6b6b0

Please sign in to comment.