From a91eeb722d51e0137f9080220dd922bbb3edda6d Mon Sep 17 00:00:00 2001 From: Jason Deal Date: Wed, 26 Feb 2025 14:31:19 -0500 Subject: [PATCH] test: select OS in ODCR scheduling tests (#7802) --- test/suites/scheduling/suite_test.go | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/test/suites/scheduling/suite_test.go b/test/suites/scheduling/suite_test.go index 89603c88c798..8ca777df9a7c 100644 --- a/test/suites/scheduling/suite_test.go +++ b/test/suites/scheduling/suite_test.go @@ -741,13 +741,27 @@ var _ = Describe("Scheduling", Ordered, ContinueOnFailure, func() { ID: xlargeCapacityReservationID, }, } - nodePool.Spec.Template.Spec.Requirements = []karpv1.NodeSelectorRequirementWithMinValues{{NodeSelectorRequirement: corev1.NodeSelectorRequirement{ - Key: karpv1.CapacityTypeLabelKey, - Operator: corev1.NodeSelectorOpIn, - Values: []string{karpv1.CapacityTypeOnDemand, karpv1.CapacityTypeReserved}, - }}} + nodePool.Spec.Template.Spec.Requirements = []karpv1.NodeSelectorRequirementWithMinValues{ + { + NodeSelectorRequirement: corev1.NodeSelectorRequirement{ + Key: karpv1.CapacityTypeLabelKey, + Operator: corev1.NodeSelectorOpIn, + Values: []string{karpv1.CapacityTypeOnDemand, karpv1.CapacityTypeReserved}, + }, + }, + // We need to specify the OS label to prevent a daemonset with a Windows specific resource from scheduling against + // the node. Omitting this requirement will result in scheduling failures. + { + NodeSelectorRequirement: corev1.NodeSelectorRequirement{ + Key: corev1.LabelOSStable, + Operator: corev1.NodeSelectorOpIn, + Values: []string{string(corev1.Linux)}, + }, + }, + } }) It("should schedule against a specific reservation ID", func() { + selectors.Insert(v1.LabelCapacityReservationID) pod := test.Pod(test.PodOptions{ NodeRequirements: []corev1.NodeSelectorRequirement{{ Key: v1.LabelCapacityReservationID,