This is an automated email from the ASF dual-hosted git repository.
wilfred-s 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 062994ee [YUNIKORN-3294] fix InPlaceVerticalScaling tests (#1037)
062994ee is described below
commit 062994ee3f01fc5df20e6f80eeea73827878806d
Author: Aditya Maheshwari <[email protected]>
AuthorDate: Fri Jun 5 09:46:02 2026 +1000
[YUNIKORN-3294] fix InPlaceVerticalScaling tests (#1037)
In k8s 1.36 admission controller rejects pod modifications where its
resources exceeds node resources. Older versions use status fields
inside the pod. Fixing tests to pick up on the change in behaviour.
Updated kind version to fix containerd schema issue
Closes: #1037
Signed-off-by: Wilfred Spiegelenburg <[email protected]>
---
scripts/run-e2e-tests.sh | 2 +-
.../pod_resource_scaling_suite_test.go | 1 +
.../pod_resource_scaling_test.go | 58 +++++++++++++---------
3 files changed, 36 insertions(+), 25 deletions(-)
diff --git a/scripts/run-e2e-tests.sh b/scripts/run-e2e-tests.sh
index 5b903aea..3adfdce8 100755
--- a/scripts/run-e2e-tests.sh
+++ b/scripts/run-e2e-tests.sh
@@ -31,7 +31,7 @@ export GO
function verlte() {
if [ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]; then
return 0
- else
+ else
return 1
fi
}
diff --git a/test/e2e/pod_resource_scaling/pod_resource_scaling_suite_test.go
b/test/e2e/pod_resource_scaling/pod_resource_scaling_suite_test.go
index 2fcae50b..4ff6fdc6 100644
--- a/test/e2e/pod_resource_scaling/pod_resource_scaling_suite_test.go
+++ b/test/e2e/pod_resource_scaling/pod_resource_scaling_suite_test.go
@@ -74,6 +74,7 @@ var _ = ginkgo.AfterSuite(func() {
var Ω = gomega.Ω
var HaveOccurred = gomega.HaveOccurred
var Equal = gomega.Equal
+var Satisfy = gomega.Satisfy
var By = ginkgo.By
var BeforeEach = ginkgo.BeforeEach
var AfterEach = ginkgo.AfterEach
diff --git a/test/e2e/pod_resource_scaling/pod_resource_scaling_test.go
b/test/e2e/pod_resource_scaling/pod_resource_scaling_test.go
index b447e8d8..89e8b56b 100644
--- a/test/e2e/pod_resource_scaling/pod_resource_scaling_test.go
+++ b/test/e2e/pod_resource_scaling/pod_resource_scaling_test.go
@@ -24,6 +24,7 @@ import (
"github.com/onsi/ginkgo/v2"
v1 "k8s.io/api/core/v1"
+ k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/version"
"github.com/apache/yunikorn-k8shim/pkg/common/utils"
@@ -197,38 +198,47 @@ var _ = ginkgo.Describe("InPlacePodVerticalScaling",
func() {
Ω(err).NotTo(HaveOccurred())
initialStartTime := pod.Status.StartTime
initialRestartCount :=
pod.Status.ContainerStatuses[0].RestartCount
+ appID := pod.Labels["applicationId"]
// Patch CPU/Memory to an excessive value
pod, err = kClient.ModifyResourceUsage(pod, ns, 100000, 100000)
- Ω(err).NotTo(HaveOccurred())
- // Wait for resource update to be reflected
- err = utils.WaitForCondition(func() bool {
- var currentPod *v1.Pod
- currentPod, err = kClient.GetPod(pod.Name, ns)
- if err != nil {
- return false
- }
-
- // only used in 1.32, it became deprecated in later
versions
- if k8sVer.Major == "1" && k8sVer.Minor == "32" {
- return currentPod.Status.Resize ==
v1.PodResizeStatusInfeasible
- }
+ // In K8s 1.36+, excessive resize requests are rejected at
admission (403 Forbidden
+ // with NodeCapacity reason) rather than being accepted and
later marked Infeasible.
+ if k8sVer.Minor < "36" {
+ Ω(err).NotTo(HaveOccurred())
+
+ // Wait for resource update to be reflected
+ err = utils.WaitForCondition(func() bool {
+ var currentPod *v1.Pod
+ currentPod, err = kClient.GetPod(pod.Name, ns)
+ if err != nil {
+ return false
+ }
- // for 1.33+
- for _, condition := range currentPod.Status.Conditions {
- if condition.Type == v1.PodResizePending &&
condition.Reason == v1.PodReasonInfeasible {
- return true
+ // only used in 1.32, it became deprecated in
later versions
+ if k8sVer.Major == "1" && k8sVer.Minor == "32" {
+ return currentPod.Status.Resize ==
v1.PodResizeStatusInfeasible
}
- }
- return false
- }, time.Second, 120*time.Second)
- Ω(err).NotTo(HaveOccurred())
- Ω(pod.Status.StartTime).To(Equal(initialStartTime), "Pod should
not have restarted")
-
Ω(pod.Status.ContainerStatuses[0].RestartCount).To(Equal(initialRestartCount),
"Container should not have restarted")
+ // for 1.33+
+ for _, condition := range
currentPod.Status.Conditions {
+ if condition.Type ==
v1.PodResizePending && condition.Reason == v1.PodReasonInfeasible {
+ return true
+ }
+ }
+ return false
+ }, time.Second, 120*time.Second)
+ Ω(err).NotTo(HaveOccurred())
+
+ Ω(pod.Status.StartTime).To(Equal(initialStartTime),
"Pod should not have restarted")
+
Ω(pod.Status.ContainerStatuses[0].RestartCount).To(Equal(initialRestartCount),
"Container should not have restarted")
+ } else {
+ // In K8s 1.36+, admission rejects excessive resize
requests with 403 Forbidden
+ Ω(err).To(Satisfy(k8serrors.IsForbidden), "Expected
admission-level 403 Forbidden for excessive resize in K8s 1.36+")
+ }
// Verify pod resource usage is unchanged after set an
excessive value
- verifyYunikornResourceUsage(pod.Labels["applicationId"],
"vcore", 100)
+ verifyYunikornResourceUsage(appID, "vcore", 100)
})
})
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]