This is an automated email from the ASF dual-hosted git repository.
mani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git
The following commit(s) were added to refs/heads/master by this push:
new 09ba0186 [YUNIKORN-2484] Shim: Remove stateaware logic (#802)
09ba0186 is described below
commit 09ba0186893c16ec45cc4bc4d446c7f21e1b5ba9
Author: Craig Condit <[email protected]>
AuthorDate: Fri Mar 15 16:36:49 2024 +0530
[YUNIKORN-2484] Shim: Remove stateaware logic (#802)
Closes: #802
Signed-off-by: Manikandan R <[email protected]>
---
pkg/admission/admission_controller_test.go | 17 +--
pkg/admission/util.go | 5 -
pkg/admission/util_test.go | 27 ++--
pkg/cache/metadata.go | 22 ---
pkg/cache/metadata_test.go | 2 -
pkg/common/constants/constants.go | 1 -
.../spark_jobs_scheduling_suite_test.go | 2 +-
.../drip_feed_schedule_test.go | 153 ---------------------
.../state_aware_app_scheduling/fallback_test.go | 118 ----------------
.../state_aware_app_scheduling_suite_test.go | 96 -------------
10 files changed, 15 insertions(+), 428 deletions(-)
diff --git a/pkg/admission/admission_controller_test.go
b/pkg/admission/admission_controller_test.go
index 56f9b0b3..2c985a6a 100644
--- a/pkg/admission/admission_controller_test.go
+++ b/pkg/admission/admission_controller_test.go
@@ -81,10 +81,9 @@ func TestUpdateLabels(t *testing.T) {
assert.Equal(t, patch[0].Op, "add")
assert.Equal(t, patch[0].Path, "/metadata/labels")
if updatedMap, ok := patch[0].Value.(map[string]string); ok {
- assert.Equal(t, len(updatedMap), 4)
+ assert.Equal(t, len(updatedMap), 3)
assert.Equal(t, updatedMap["random"], "random")
assert.Equal(t, updatedMap["queue"], "root.default")
- assert.Equal(t, updatedMap["disableStateAware"], "true")
assert.Equal(t, strings.HasPrefix(updatedMap["applicationId"],
constants.AutoGenAppPrefix), true)
} else {
t.Fatal("patch info content is not as expected")
@@ -155,10 +154,9 @@ func TestUpdateLabels(t *testing.T) {
assert.Equal(t, patch[0].Op, "add")
assert.Equal(t, patch[0].Path, "/metadata/labels")
if updatedMap, ok := patch[0].Value.(map[string]string); ok {
- assert.Equal(t, len(updatedMap), 4)
+ assert.Equal(t, len(updatedMap), 3)
assert.Equal(t, updatedMap["random"], "random")
assert.Equal(t, updatedMap["queue"], "root.abc")
- assert.Equal(t, updatedMap["disableStateAware"], "true")
assert.Equal(t, strings.HasPrefix(updatedMap["applicationId"],
constants.AutoGenAppPrefix), true)
} else {
t.Fatal("patch info content is not as expected")
@@ -188,9 +186,8 @@ func TestUpdateLabels(t *testing.T) {
assert.Equal(t, patch[0].Op, "add")
assert.Equal(t, patch[0].Path, "/metadata/labels")
if updatedMap, ok := patch[0].Value.(map[string]string); ok {
- assert.Equal(t, len(updatedMap), 3)
+ assert.Equal(t, len(updatedMap), 2)
assert.Equal(t, updatedMap["queue"], "root.default")
- assert.Equal(t, updatedMap["disableStateAware"], "true")
assert.Equal(t, strings.HasPrefix(updatedMap["applicationId"],
constants.AutoGenAppPrefix), true)
} else {
t.Fatal("patch info content is not as expected")
@@ -217,9 +214,8 @@ func TestUpdateLabels(t *testing.T) {
assert.Equal(t, patch[0].Op, "add")
assert.Equal(t, patch[0].Path, "/metadata/labels")
if updatedMap, ok := patch[0].Value.(map[string]string); ok {
- assert.Equal(t, len(updatedMap), 3)
+ assert.Equal(t, len(updatedMap), 2)
assert.Equal(t, updatedMap["queue"], "root.default")
- assert.Equal(t, updatedMap["disableStateAware"], "true")
assert.Equal(t, strings.HasPrefix(updatedMap["applicationId"],
constants.AutoGenAppPrefix), true)
} else {
t.Fatal("patch info content is not as expected")
@@ -244,9 +240,8 @@ func TestUpdateLabels(t *testing.T) {
assert.Equal(t, patch[0].Op, "add")
assert.Equal(t, patch[0].Path, "/metadata/labels")
if updatedMap, ok := patch[0].Value.(map[string]string); ok {
- assert.Equal(t, len(updatedMap), 3)
+ assert.Equal(t, len(updatedMap), 2)
assert.Equal(t, updatedMap["queue"], "root.default")
- assert.Equal(t, updatedMap["disableStateAware"], "true")
assert.Equal(t, strings.HasPrefix(updatedMap["applicationId"],
constants.AutoGenAppPrefix), true)
} else {
t.Fatal("patch info content is not as expected")
@@ -455,7 +450,6 @@ func TestMutate(t *testing.T) {
assert.Check(t, resp.Allowed, "response not allowed for pod")
assert.Equal(t, schedulerName(t, resp.Patch), "yunikorn", "yunikorn not
set as scheduler for pod")
assert.Equal(t, labels(t, resp.Patch)["applicationId"],
"yunikorn-default-autogen", "wrong applicationId label")
- assert.Equal(t, labels(t, resp.Patch)["disableStateAware"], "true",
"missing disableStateAware label")
assert.Equal(t, labels(t, resp.Patch)["queue"], "root.default",
"incorrect queue name")
// pod without applicationID
@@ -474,7 +468,6 @@ func TestMutate(t *testing.T) {
assert.Check(t, resp.Allowed, "response not allowed for pod")
assert.Equal(t, schedulerName(t, resp.Patch), "yunikorn", "yunikorn not
set as scheduler for pod")
assert.Equal(t, labels(t, resp.Patch)["applicationId"],
"yunikorn-test-ns-autogen", "wrong applicationId label")
- assert.Equal(t, labels(t, resp.Patch)["disableStateAware"], "true",
"missing disableStateAware label")
// pod with applicationId
pod.ObjectMeta.Labels = map[string]string{"applicationId": "test-app"}
diff --git a/pkg/admission/util.go b/pkg/admission/util.go
index 5c957648..94cbb9c8 100644
--- a/pkg/admission/util.go
+++ b/pkg/admission/util.go
@@ -47,11 +47,6 @@ func updatePodLabel(pod *v1.Pod, namespace string,
generateUniqueAppIds bool, de
// application ID convention:
${AUTO_GEN_PREFIX}-${NAMESPACE}-${AUTO_GEN_SUFFIX}
generatedID := utils.GenerateApplicationID(namespace,
generateUniqueAppIds, string(pod.UID))
result[constants.LabelApplicationID] = generatedID
-
- // if we generate an app ID, disable state-aware scheduling for
this app
- if _, ok := existingLabels[constants.LabelDisableStateAware];
!ok {
- result[constants.LabelDisableStateAware] = "true"
- }
}
// if existing label exist, it takes priority over everything else
diff --git a/pkg/admission/util_test.go b/pkg/admission/util_test.go
index 1b768631..8dd6d2e3 100644
--- a/pkg/admission/util_test.go
+++ b/pkg/admission/util_test.go
@@ -104,10 +104,9 @@ func TestUpdatePodLabelForAdmissionController(t
*testing.T) {
pod := createTestingPodWithMeta()
if result := updatePodLabel(pod, "default", false, "root.default");
result != nil {
- assert.Equal(t, len(result), 4)
+ assert.Equal(t, len(result), 3)
assert.Equal(t, result["random"], "random")
assert.Equal(t, result["queue"], "root.default")
- assert.Equal(t, result["disableStateAware"], "true")
assert.Equal(t, strings.HasPrefix(result["applicationId"],
constants.AutoGenAppPrefix), true)
} else {
t.Fatal("UpdatePodLabelForAdmissionController is not as
expected")
@@ -130,10 +129,9 @@ func TestUpdatePodLabelForAdmissionController(t
*testing.T) {
// we won't modify it
pod = createTestingPodWithQueue()
if result := updatePodLabel(pod, "default", false, "root.default");
result != nil {
- assert.Equal(t, len(result), 4)
+ assert.Equal(t, len(result), 3)
assert.Equal(t, result["random"], "random")
assert.Equal(t, result["queue"], "root.abc")
- assert.Equal(t, result["disableStateAware"], "true")
assert.Equal(t, strings.HasPrefix(result["applicationId"],
constants.AutoGenAppPrefix), true)
} else {
t.Fatal("UpdatePodLabelForAdmissionControllert is not as
expected")
@@ -144,9 +142,8 @@ func TestUpdatePodLabelForAdmissionController(t *testing.T)
{
pod = createTestingPodNoNamespaceAndLabels()
if result := updatePodLabel(pod, "default", false, "root.default");
result != nil {
- assert.Equal(t, len(result), 3)
+ assert.Equal(t, len(result), 2)
assert.Equal(t, result["queue"], "root.default")
- assert.Equal(t, result["disableStateAware"], "true")
assert.Equal(t, strings.HasPrefix(result["applicationId"],
constants.AutoGenAppPrefix), true)
} else {
t.Fatal("UpdatePodLabelForAdmissionController is not as
expected")
@@ -155,9 +152,8 @@ func TestUpdatePodLabelForAdmissionController(t *testing.T)
{
// pod name might be empty, it can comes from generatedName
pod = createTestingPodWithGenerateName()
if result := updatePodLabel(pod, "default", false, "root.default");
result != nil {
- assert.Equal(t, len(result), 3)
+ assert.Equal(t, len(result), 2)
assert.Equal(t, result["queue"], "root.default")
- assert.Equal(t, result["disableStateAware"], "true")
assert.Equal(t, strings.HasPrefix(result["applicationId"],
constants.AutoGenAppPrefix), true)
} else {
t.Fatal("UpdatePodLabelForAdmissionController is not as
expected")
@@ -165,9 +161,8 @@ func TestUpdatePodLabelForAdmissionController(t *testing.T)
{
pod = createMinimalTestingPod()
if result := updatePodLabel(pod, "default", false, "root.default");
result != nil {
- assert.Equal(t, len(result), 3)
+ assert.Equal(t, len(result), 2)
assert.Equal(t, result["queue"], "root.default")
- assert.Equal(t, result["disableStateAware"], "true")
assert.Equal(t, strings.HasPrefix(result["applicationId"],
constants.AutoGenAppPrefix), true)
} else {
t.Fatal("UpdatePodLabelForAdmissionController is not as
expected")
@@ -178,10 +173,9 @@ func TestDefaultQueueName(t *testing.T) {
defaultConf := createConfig()
pod := createTestingPodWithMeta()
if result := updatePodLabel(pod, defaultConf.GetNamespace(),
defaultConf.GetGenerateUniqueAppIds(), defaultConf.GetDefaultQueueName());
result != nil {
- assert.Equal(t, len(result), 4)
+ assert.Equal(t, len(result), 3)
assert.Equal(t, result["random"], "random")
assert.Equal(t, result["applicationId"],
"yunikorn-default-autogen")
- assert.Equal(t, result["disableStateAware"], "true")
assert.Equal(t, result["queue"], "root.default")
} else {
t.Fatal("UpdatePodLabelForAdmissionController is not as
expected")
@@ -191,10 +185,9 @@ func TestDefaultQueueName(t *testing.T) {
conf.AMFilteringDefaultQueueName: "",
})
if result := updatePodLabel(pod, queueNameEmptyConf.GetNamespace(),
queueNameEmptyConf.GetGenerateUniqueAppIds(),
queueNameEmptyConf.GetDefaultQueueName()); result != nil {
- assert.Equal(t, len(result), 3)
+ assert.Equal(t, len(result), 2)
assert.Equal(t, result["random"], "random")
assert.Equal(t, result["applicationId"],
"yunikorn-default-autogen")
- assert.Equal(t, result["disableStateAware"], "true")
assert.Equal(t, result["queue"], "")
} else {
t.Fatal("UpdatePodLabelForAdmissionController is not as
expected")
@@ -204,10 +197,9 @@ func TestDefaultQueueName(t *testing.T) {
conf.AMFilteringDefaultQueueName: "yunikorn",
})
if result := updatePodLabel(pod, customQueueNameConf.GetNamespace(),
customQueueNameConf.GetGenerateUniqueAppIds(),
customQueueNameConf.GetDefaultQueueName()); result != nil {
- assert.Equal(t, len(result), 4)
+ assert.Equal(t, len(result), 3)
assert.Equal(t, result["random"], "random")
assert.Equal(t, result["applicationId"],
"yunikorn-default-autogen")
- assert.Equal(t, result["disableStateAware"], "true")
assert.Assert(t, result["queue"] != "yunikorn")
} else {
t.Fatal("UpdatePodLabelForAdmissionController is not as
expected")
@@ -218,10 +210,9 @@ func TestDefaultQueueName(t *testing.T) {
})
if result := updatePodLabel(pod,
customValidQueueNameConf.GetNamespace(),
customValidQueueNameConf.GetGenerateUniqueAppIds(),
customValidQueueNameConf.GetDefaultQueueName()); result != nil {
- assert.Equal(t, len(result), 4)
+ assert.Equal(t, len(result), 3)
assert.Equal(t, result["random"], "random")
assert.Equal(t, result["applicationId"],
"yunikorn-default-autogen")
- assert.Equal(t, result["disableStateAware"], "true")
assert.Equal(t, result["queue"], "root.yunikorn")
} else {
t.Fatal("UpdatePodLabelForAdmissionController is not as
expected")
diff --git a/pkg/cache/metadata.go b/pkg/cache/metadata.go
index b3b03873..b11a42d6 100644
--- a/pkg/cache/metadata.go
+++ b/pkg/cache/metadata.go
@@ -19,7 +19,6 @@
package cache
import (
- "strconv"
"strings"
v1 "k8s.io/api/core/v1"
@@ -32,7 +31,6 @@ import (
"github.com/apache/yunikorn-k8shim/pkg/common/utils"
"github.com/apache/yunikorn-k8shim/pkg/conf"
"github.com/apache/yunikorn-k8shim/pkg/log"
- siCommon "github.com/apache/yunikorn-scheduler-interface/lib/go/common"
)
func getTaskMetadata(pod *v1.Pod) (TaskMetadata, bool) {
@@ -78,9 +76,6 @@ func getAppMetadata(pod *v1.Pod) (ApplicationMetadata, bool) {
} else {
tags[constants.AppTagNamespace] = pod.Namespace
}
- if isStateAwareDisabled(pod) {
- tags[siCommon.AppTagStateAwareDisable] = "true"
- }
// attach imagePullSecrets if present
secrets := pod.Spec.ImagePullSecrets
@@ -142,20 +137,3 @@ func getOwnerReference(pod *v1.Pod)
[]metav1.OwnerReference {
}
return []metav1.OwnerReference{ref}
}
-
-func isStateAwareDisabled(pod *v1.Pod) bool {
- value := utils.GetPodLabelValue(pod, constants.LabelDisableStateAware)
- if value == "" {
- return false
- }
- result, err := strconv.ParseBool(value)
- if err != nil {
- log.Log(log.ShimCacheApplication).Debug("unable to parse label
for pod",
- zap.String("namespace", pod.Namespace),
- zap.String("name", pod.Name),
- zap.String("label", constants.LabelDisableStateAware),
- zap.Error(err))
- return false
- }
- return result
-}
diff --git a/pkg/cache/metadata_test.go b/pkg/cache/metadata_test.go
index f727cfaa..d26138b5 100644
--- a/pkg/cache/metadata_test.go
+++ b/pkg/cache/metadata_test.go
@@ -161,7 +161,6 @@ func TestGetAppMetadata(t *testing.T) { //nolint:funlen
"applicationId": "app00002",
"queue": "root.b",
constants.DomainYuniKorn + "user": "testuser",
- "disableStateAware": "true",
},
Annotations: map[string]string{
constants.AnnotationSchedulingPolicyParam:
"gangSchedulingStyle=Hard",
@@ -180,7 +179,6 @@ func TestGetAppMetadata(t *testing.T) { //nolint:funlen
assert.Equal(t, app.ApplicationID, "app00002")
assert.Equal(t, app.QueueName, "root.b")
assert.Equal(t, app.User, constants.DefaultUser)
- assert.Equal(t, app.Tags["application.stateaware.disable"], "true")
assert.Equal(t, app.Tags["namespace"], "app-namespace-01")
assert.Equal(t, len(app.TaskGroups), 0)
assert.Equal(t,
app.SchedulingPolicyParameters.GetGangSchedulingStyle(), "Hard")
diff --git a/pkg/common/constants/constants.go
b/pkg/common/constants/constants.go
index ab4dbd1c..aa70db5f 100644
--- a/pkg/common/constants/constants.go
+++ b/pkg/common/constants/constants.go
@@ -41,7 +41,6 @@ const LabelQueueName = "queue"
const RootQueue = "root"
const AnnotationQueueName = DomainYuniKorn + "queue"
const AnnotationParentQueue = DomainYuniKorn + "parentqueue"
-const LabelDisableStateAware = "disableStateAware"
const ApplicationDefaultQueue = "root.default"
const DefaultPartition = "default"
const AppTagNamespace = "namespace"
diff --git a/test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_suite_test.go
b/test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_suite_test.go
index a1968ffb..cfe7042b 100644
--- a/test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_suite_test.go
+++ b/test/e2e/spark_jobs_scheduling/spark_jobs_scheduling_suite_test.go
@@ -45,7 +45,7 @@ var _ = BeforeSuite(func() {
suiteName = common.GetSuiteName(filename)
annotation = "ann-" + common.RandSeq(10)
yunikorn.EnsureYuniKornConfigsPresent()
- yunikorn.UpdateConfigMapWrapper(oldConfigMap, "stateaware", annotation)
+ yunikorn.UpdateConfigMapWrapper(oldConfigMap, "fifo", annotation)
})
var _ = AfterSuite(func() {
diff --git a/test/e2e/state_aware_app_scheduling/drip_feed_schedule_test.go
b/test/e2e/state_aware_app_scheduling/drip_feed_schedule_test.go
deleted file mode 100644
index 4016b0eb..00000000
--- a/test/e2e/state_aware_app_scheduling/drip_feed_schedule_test.go
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package stateawareappscheduling_test
-
-import (
- "context"
- "fmt"
- "time"
-
- v1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/util/wait"
-
- "github.com/apache/yunikorn-core/pkg/webservice/dao"
- tests "github.com/apache/yunikorn-k8shim/test/e2e"
- "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/common"
- "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/k8s"
- "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/yunikorn"
-)
-
-var _ = Describe("DripFeedSchedule:", func() {
-
- var kClient k8s.KubeCtl
- var restClient yunikorn.RClient
- var err error
- var app1 = "app01-" + common.RandSeq(5)
- var app2 = "app02-" + common.RandSeq(5)
- var app3 = "app03-" + common.RandSeq(5)
- var ns = "sleep-" + common.RandSeq(10)
- var testTimeout float64 = 360
- var running = yunikorn.States().Application.Running
- var accepted = yunikorn.States().Application.Accepted
- var starting = yunikorn.States().Application.Starting
-
- BeforeEach(func() {
- kClient = k8s.KubeCtl{}
- Ω(kClient.SetClient()).To(BeNil())
- By(fmt.Sprintf("Creating namespace: %s for sleep jobs", ns))
- var ns1, err1 = kClient.CreateNamespace(ns, nil)
- Ω(err1).NotTo(HaveOccurred())
- Ω(ns1.Status.Phase).To(Equal(v1.NamespaceActive))
- })
-
- It("Test_State_Aware_App_Sorting", func() {
- By("Submit 3 apps(app01, app02, app03) with one pod each")
- for _, appID := range []string{app1, app2, app3} {
- podName := "pod1-" + common.RandSeq(5)
- sleepPodConf := k8s.SleepPodConfig{Name: podName, NS:
ns, AppID: appID}
- initPod, podErr := k8s.InitSleepPod(sleepPodConf)
- Ω(podErr).NotTo(HaveOccurred())
- Ω(err).NotTo(HaveOccurred())
- _, err = kClient.CreatePod(initPod, ns)
- Ω(err).NotTo(HaveOccurred())
- time.Sleep(3 * time.Second) // Buffer time between pod
submission
- }
-
- By(fmt.Sprintf("Get apps from specific queue: %s", ns))
- var appsFromQueue []*dao.ApplicationDAOInfo
- // Poll for apps to appear in the queue
- err = wait.PollUntilContextTimeout(context.TODO(), time.Second,
time.Duration(60)*time.Second, false, func(context.Context) (done bool, err
error) {
- appsFromQueue, err = restClient.GetApps("default",
"root."+ns)
- if len(appsFromQueue) == 3 {
- return true, nil
- }
- return false, err
- })
- Ω(err).NotTo(HaveOccurred())
- Ω(appsFromQueue).NotTo(BeEmpty())
-
- /*
- At this point, the apps state will be
- app01 - Starting
- app02 - Accepted
- app03 - Accepted
- */
- By(fmt.Sprintf("Verify the app %s are in Starting state", app1))
- err = restClient.WaitForAppStateTransition("default",
"root."+ns, app1, starting, 60)
- Ω(err).NotTo(HaveOccurred())
- By(fmt.Sprintf("Verify the app %s are in Accepted state", app2))
- err = restClient.WaitForAppStateTransition("default",
"root."+ns, app2, accepted, 60)
- Ω(err).NotTo(HaveOccurred())
- By(fmt.Sprintf("Verify the app %s are in Accepted state", app3))
- err = restClient.WaitForAppStateTransition("default",
"root."+ns, app3, accepted, 60)
- Ω(err).NotTo(HaveOccurred())
-
- /*
- Add another pod for app01, and once this pod is
allocated, verify app states:
- app01 - Running => pod1, pod2
- app02 - Starting => pod1
- app03 - Accepted => pod1
-
- Add another pod for app02, and once this pod is
allocated, verify app states:
- app01 - Running => pod1, pod2
- app02 - Running => pod1, pod2
- app03 - starting => pod1
-
- Add another pod for app03, and once this pod is
allocated, verify app states:
- app01 - Running => pod1, pod2
- app02 - Running => pod1, pod2
- app03 - Running => pod1, pod2
- */
- var appStates = map[string][]string{
- app1: {running, starting, accepted},
- app2: {running, running, starting},
- app3: {running, running, running},
- }
- for _, appID := range []string{app1, app2, app3} {
- By(fmt.Sprintf("Add one more pod to the app: %s",
appID))
- podName := "pod2-" + common.RandSeq(5)
- sleepPodConf := k8s.SleepPodConfig{Name: podName, NS:
ns, AppID: appID}
- initPod, podErr := k8s.InitSleepPod(sleepPodConf)
- Ω(podErr).NotTo(HaveOccurred())
- _, err = kClient.CreatePod(initPod, ns)
- Ω(err).NotTo(HaveOccurred())
- By(fmt.Sprintf("Verify that the app: %s is in running
state", appID))
- err = restClient.WaitForAppStateTransition("default",
"root."+ns, app1, appStates[appID][0], 60)
- Ω(err).NotTo(HaveOccurred())
- err = restClient.WaitForAppStateTransition("default",
"root."+ns, app2, appStates[appID][1], 60)
- Ω(err).NotTo(HaveOccurred())
- err = restClient.WaitForAppStateTransition("default",
"root."+ns, app3, appStates[appID][2], 60)
- Ω(err).NotTo(HaveOccurred())
- }
-
- }, testTimeout)
-
- AfterEach(func() {
- tests.DumpClusterInfoIfSpecFailed(suiteName, []string{ns})
-
- By("Check Yunikorn's health")
- checks, err := yunikorn.GetFailedHealthChecks()
- Ω(err).NotTo(HaveOccurred())
- Ω(checks).To(Equal(""), checks)
-
- By("Tearing down namespace: " + ns)
- err = kClient.TearDownNamespace(ns)
- Ω(err).NotTo(HaveOccurred())
- })
-})
diff --git a/test/e2e/state_aware_app_scheduling/fallback_test.go
b/test/e2e/state_aware_app_scheduling/fallback_test.go
deleted file mode 100644
index bfa9a8f2..00000000
--- a/test/e2e/state_aware_app_scheduling/fallback_test.go
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package stateawareappscheduling_test
-
-import (
- "fmt"
-
- "github.com/onsi/gomega"
- v1 "k8s.io/api/core/v1"
-
- "github.com/apache/yunikorn-core/pkg/webservice/dao"
- tests "github.com/apache/yunikorn-k8shim/test/e2e"
- "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/common"
- "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/k8s"
- "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/yunikorn"
-)
-
-var _ = Describe("FallbackTest:", func() {
- var kClient k8s.KubeCtl
- var restClient yunikorn.RClient
- var err error
- var sleepRespPod *v1.Pod
- var ns string
- var appsInfo *dao.ApplicationDAOInfo
-
- BeforeEach(func() {
- // Initializing kubectl client
- kClient = k8s.KubeCtl{}
- Ω(kClient.SetClient()).To(BeNil())
- // Initializing rest client
- restClient = yunikorn.RClient{}
- ns = "test-" + common.RandSeq(10)
- By(fmt.Sprintf("create %s namespace", ns))
- ns1, err1 := kClient.CreateNamespace(ns, nil)
- Ω(err1).NotTo(HaveOccurred())
- Ω(ns1.Status.Phase).To(Equal(v1.NamespaceActive))
-
- By(fmt.Sprintf("Deploy the sleep pod to %s namespace", ns))
- sleepPodConf := k8s.SleepPodConfig{Name: "sleepjob", NS: ns,
Time: 600}
- initPod, podErr := k8s.InitSleepPod(sleepPodConf)
- Ω(podErr).NotTo(HaveOccurred())
- sleepRespPod, err = kClient.CreatePod(initPod, ns)
- Ω(err).NotTo(HaveOccurred())
- // Wait for pod to move to running state
- })
-
- It("Verify_App_In_Starting_State", func() {
- err = kClient.WaitForPodBySelectorRunning(ns,
- fmt.Sprintf("app=%s",
sleepRespPod.ObjectMeta.Labels["app"]),
- 10)
- Ω(err).NotTo(HaveOccurred())
-
- appsInfo, err = restClient.GetAppInfo("default", "root."+ns,
sleepRespPod.ObjectMeta.Labels["applicationId"])
- Ω(err).NotTo(HaveOccurred())
- Ω(appsInfo).NotTo(BeNil())
- By(fmt.Sprintf("Verify that the sleep pod is mapped to %s
queue", ns))
-
Ω(appsInfo.ApplicationID).To(Equal(sleepRespPod.ObjectMeta.Labels["applicationId"]))
-
Ω(appsInfo.QueueName).To(ContainSubstring(sleepRespPod.ObjectMeta.Namespace))
- By("Verify that the job is scheduled by YuniKorn & is in
starting state")
- Ω(appsInfo.State).To(Equal("Starting"))
- Ω("yunikorn").To(Equal(sleepRespPod.Spec.SchedulerName))
- })
-
- It("Verify_App_State_Transition_To_Running_Post_Timeout", func() {
- By("Wait for fallback timeout of 5mins")
- err = restClient.WaitForAppStateTransition("default",
"root."+ns, sleepRespPod.ObjectMeta.Labels["applicationId"],
- yunikorn.States().Application.Running,
- 360)
- Ω(err).NotTo(HaveOccurred())
-
- // Get AppInfo again to check the allocations post running
state.
- appsInfo, err = restClient.GetAppInfo("default", "root."+ns,
sleepRespPod.ObjectMeta.Labels["applicationId"])
- Ω(appsInfo.Allocations).NotTo(BeNil())
- Ω(len(appsInfo.Allocations)).NotTo(gomega.BeZero())
- allocation := appsInfo.Allocations[0]
- Ω(allocation).NotTo(gomega.BeNil())
- Ω(allocation.AllocationKey).NotTo(BeNil())
- Ω(allocation.NodeID).NotTo(BeNil())
- Ω(allocation.Partition).NotTo(BeNil())
- Ω(allocation.AllocationID).NotTo(BeNil())
-
Ω(allocation.ApplicationID).To(Equal(sleepRespPod.ObjectMeta.Labels["applicationId"]))
- core :=
sleepRespPod.Spec.Containers[0].Resources.Requests.Cpu().MilliValue()
- mem :=
sleepRespPod.Spec.Containers[0].Resources.Requests.Memory().Value()
- resMap := allocation.ResourcePerAlloc
- Ω(len(resMap)).NotTo(gomega.BeZero())
- Ω(resMap["memory"]).To(gomega.Equal(mem))
- Ω(resMap["vcore"]).To(gomega.Equal(core))
- })
-
- AfterEach(func() {
- tests.DumpClusterInfoIfSpecFailed(suiteName, []string{ns})
-
- By("Check Yunikorn's health")
- checks, err := yunikorn.GetFailedHealthChecks()
- Ω(err).NotTo(HaveOccurred())
- Ω(checks).To(Equal(""), checks)
-
- By("Tearing down namespace: " + ns)
- err = kClient.TearDownNamespace(ns)
- Ω(err).NotTo(HaveOccurred())
- })
-})
diff --git
a/test/e2e/state_aware_app_scheduling/state_aware_app_scheduling_suite_test.go
b/test/e2e/state_aware_app_scheduling/state_aware_app_scheduling_suite_test.go
deleted file mode 100644
index c6d12a58..00000000
---
a/test/e2e/state_aware_app_scheduling/state_aware_app_scheduling_suite_test.go
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-package stateawareappscheduling_test
-
-import (
- "path/filepath"
- "runtime"
- "testing"
-
- "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/common"
-
- v1 "k8s.io/api/core/v1"
-
- "github.com/onsi/ginkgo/v2/reporters"
-
- "github.com/onsi/ginkgo/v2"
- "github.com/onsi/gomega"
-
- "github.com/apache/yunikorn-k8shim/test/e2e/framework/configmanager"
- "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/yunikorn"
-)
-
-func init() {
- configmanager.YuniKornTestConfig.ParseFlags()
-}
-
-var suiteName string
-var oldConfigMap = new(v1.ConfigMap)
-var annotation string
-
-var _ = BeforeSuite(func() {
- _, filename, _, _ := runtime.Caller(0)
- suiteName = common.GetSuiteName(filename)
- annotation = "ann-" + common.RandSeq(10)
- yunikorn.EnsureYuniKornConfigsPresent()
- yunikorn.UpdateConfigMapWrapper(oldConfigMap, "stateaware", annotation)
-})
-
-var _ = AfterSuite(func() {
- yunikorn.RestoreConfigMapWrapper(oldConfigMap, annotation)
-})
-
-func TestStateAwareAppScheduling(t *testing.T) {
- ginkgo.ReportAfterSuite("TestStateAwareAppScheduling", func(report
ginkgo.Report) {
- err := common.CreateJUnitReportDir()
- Ω(err).NotTo(gomega.HaveOccurred())
- err = reporters.GenerateJUnitReportWithConfig(
- report,
- filepath.Join(configmanager.YuniKornTestConfig.LogDir,
"TEST-stateaware_app_scheduling_junit.xml"),
- reporters.JunitReportConfig{OmitSpecLabels: true},
- )
- Ω(err).NotTo(HaveOccurred())
- })
- gomega.RegisterFailHandler(ginkgo.Fail)
- ginkgo.RunSpecs(t, "TestStateAwareAppScheduling",
ginkgo.Label("TestStateAwareAppScheduling"))
-}
-
-// Declarations for Ginkgo DSL
-var Fail = ginkgo.Fail
-var Describe = ginkgo.Describe
-var It = ginkgo.It
-var PIt = ginkgo.PIt
-var By = ginkgo.By
-var BeforeEach = ginkgo.BeforeEach
-var AfterEach = ginkgo.AfterEach
-var BeforeSuite = ginkgo.BeforeSuite
-var AfterSuite = ginkgo.AfterSuite
-
-// Declarations for Gomega DSL
-var RegisterFailHandler = gomega.RegisterFailHandler
-
-// Declarations for Gomega Matchers
-var Equal = gomega.Equal
-var Ω = gomega.Expect
-var BeNil = gomega.BeNil
-var HaveOccurred = gomega.HaveOccurred
-var BeEmpty = gomega.BeEmpty
-var BeTrue = gomega.BeTrue
-var ContainSubstring = gomega.ContainSubstring
-var BeEquivalentTo = gomega.BeEquivalentTo
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]