Skip to content

Commit 07c7109

Browse files
committed
Split DRA scheduler_perf tests into multiple packages
1 parent a59ad81 commit 07c7109

File tree

11 files changed

+678
-373
lines changed

11 files changed

+678
-373
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package consumablecapacity
18+
19+
import (
20+
"fmt"
21+
"os"
22+
"testing"
23+
24+
_ "k8s.io/component-base/logs/json/register"
25+
perf "k8s.io/kubernetes/test/integration/scheduler_perf"
26+
)
27+
28+
func TestMain(m *testing.M) {
29+
if err := perf.InitTests(); err != nil {
30+
fmt.Fprintf(os.Stderr, "%v\n", err)
31+
os.Exit(1)
32+
}
33+
34+
m.Run()
35+
}
36+
37+
func TestSchedulerPerf(t *testing.T) {
38+
perf.RunIntegrationPerfScheduling(t, "performance-config.yaml")
39+
}
40+
41+
func BenchmarkPerfScheduling(b *testing.B) {
42+
perf.RunBenchmarkPerfScheduling(b, "performance-config.yaml", "dra_consumablecapacity", nil)
43+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# The following labels are used in this file. (listed in ascending order of the number of covered test cases)
2+
#
3+
# - integration-test: test cases to run as the integration test, usually to spot some issues in the scheduler implementation or scheduler-perf itself.
4+
# - performance: test cases to run in the performance test.
5+
# - short: supplemental label for the above two labels (must not used alone), which literally means short execution time test cases.
6+
#
7+
# Specifically, the CIs use labels like the following:
8+
# - `ci-kubernetes-integration-master` (`integration-test`): Test cases are chosen based on a tradeoff between code coverage and overall runtime.
9+
# It basically covers all test cases but with their smallest workload.
10+
# - `pull-kubernetes-integration` (`integration-test`,`short`): Test cases are chosen so that they should take less than total 5 min to complete.
11+
# - `ci-benchmark-scheduler-perf` (`performance`): Long enough test cases are chosen (ideally, longer than 10 seconds)
12+
# to provide meaningful samples for the pod scheduling rate.
13+
#
14+
# Also, `performance`+`short` isn't used in the CIs, but it's used to test the performance test locally.
15+
# (Sometimes, the test cases with `integration-test` are too small to spot issues.)
16+
#
17+
# Combining `performance` and `short` selects suitable workloads for a local
18+
# before/after comparisons with benchstat.
19+
20+
# SteadyStateClusterResourceClaimTemplateConsumableCapacity is a variant of
21+
# SchedulingWithResourceClaimTemplate. It creates a single ResourceSlice that have two devices,
22+
# one preallocate device slice and one basic device. Both allows multiple allocations and contain consumable capacity.
23+
# And, it creates a resource claim template with two requests.
24+
# Each requests half of this capacity for two count.
25+
# The first request checks distinctAttribute which the other checks matchAttribute.
26+
- name: SteadyStateClusterResourceClaimTemplateConsumableCapacity
27+
featureGates:
28+
DynamicResourceAllocation: true
29+
DRAConsumableCapacity: true
30+
workloadTemplate:
31+
- opcode: createNodes
32+
countParam: $nodesWithoutDRA
33+
- opcode: createNodes
34+
nodeTemplatePath: ../templates/node-with-dra-test-driver.yaml
35+
countParam: $nodesWithDRA
36+
- opcode: createResourceDriver
37+
driverName: test-driver.cdi.k8s.io
38+
nodes: scheduler-perf-dra-*
39+
maxClaimsPerNodeParam: $maxClaimsPerNode
40+
- opcode: createAny
41+
templatePath: ../templates/resourceslice-consumablecapacity.yaml
42+
countParam: $resourceSlices
43+
- opcode: createAny
44+
templatePath: ../templates/deviceclass-consumablecapacity.yaml
45+
- opcode: createAny
46+
templatePath: ../templates/resourceclaimtemplate-consumablecapacity.yaml
47+
namespace: test
48+
- opcode: createPods
49+
namespace: test
50+
countParam: $measurePods
51+
steadyState: true
52+
durationParam: $duration
53+
podTemplatePath: ../templates/pod-with-claim-template.yaml
54+
collectMetrics: true
55+
workloads:
56+
- name: fast
57+
labels: [integration-test, short]
58+
params:
59+
nodesWithDRA: 1
60+
nodesWithoutDRA: 1
61+
resourceSlices: 1
62+
measurePods: 1
63+
duration: 2s
64+
maxClaimsPerNode: 2
65+
- name: fast_with_DRAPartitionableDevices
66+
featureGates:
67+
DRAPartitionableDevices: true
68+
DRAResourceClaimDeviceStatus: true
69+
labels: [integration-test, short]
70+
params:
71+
nodesWithDRA: 1
72+
nodesWithoutDRA: 1
73+
resourceSlices: 1
74+
measurePods: 1
75+
duration: 2s
76+
maxClaimsPerNode: 2
77+
- name: 2000pods_100nodes
78+
params:
79+
nodesWithDRA: 100
80+
nodesWithoutDRA: 0
81+
resourceSlices: 2000
82+
measurePods: 2000
83+
duration: 10s
84+
maxClaimsPerNode: 20
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package devicetaints
18+
19+
import (
20+
"fmt"
21+
"os"
22+
"testing"
23+
24+
_ "k8s.io/component-base/logs/json/register"
25+
perf "k8s.io/kubernetes/test/integration/scheduler_perf"
26+
)
27+
28+
func TestMain(m *testing.M) {
29+
if err := perf.InitTests(); err != nil {
30+
fmt.Fprintf(os.Stderr, "%v\n", err)
31+
os.Exit(1)
32+
}
33+
34+
m.Run()
35+
}
36+
37+
func TestSchedulerPerf(t *testing.T) {
38+
perf.RunIntegrationPerfScheduling(t, "performance-config.yaml")
39+
}
40+
41+
func BenchmarkPerfScheduling(b *testing.B) {
42+
perf.RunBenchmarkPerfScheduling(b, "performance-config.yaml", "dra_devicetaints", nil)
43+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# The following labels are used in this file. (listed in ascending order of the number of covered test cases)
2+
#
3+
# - integration-test: test cases to run as the integration test, usually to spot some issues in the scheduler implementation or scheduler-perf itself.
4+
# - performance: test cases to run in the performance test.
5+
# - short: supplemental label for the above two labels (must not used alone), which literally means short execution time test cases.
6+
#
7+
# Specifically, the CIs use labels like the following:
8+
# - `ci-kubernetes-integration-master` (`integration-test`): Test cases are chosen based on a tradeoff between code coverage and overall runtime.
9+
# It basically covers all test cases but with their smallest workload.
10+
# - `pull-kubernetes-integration` (`integration-test`,`short`): Test cases are chosen so that they should take less than total 5 min to complete.
11+
# - `ci-benchmark-scheduler-perf` (`performance`): Long enough test cases are chosen (ideally, longer than 10 seconds)
12+
# to provide meaningful samples for the pod scheduling rate.
13+
#
14+
# Also, `performance`+`short` isn't used in the CIs, but it's used to test the performance test locally.
15+
# (Sometimes, the test cases with `integration-test` are too small to spot issues.)
16+
#
17+
# Combining `performance` and `short` selects suitable workloads for a local
18+
# before/after comparisons with benchstat.
19+
20+
# SchedulingWithResourceClaimTemplateToleration is a variant of SchedulingWithResourceClaimTemplate
21+
# with a claim template that tolerates the taint defined in a DeviceTaintRule.
22+
- name: SchedulingWithResourceClaimTemplateToleration
23+
featureGates:
24+
DynamicResourceAllocation: true
25+
DRADeviceTaints: true
26+
workloadTemplate:
27+
- opcode: createNodes
28+
countParam: $nodesWithoutDRA
29+
- opcode: createAny
30+
templatePath: ../templates/devicetaintrule.yaml
31+
- opcode: createNodes
32+
nodeTemplatePath: ../templates/node-with-dra-test-driver.yaml
33+
countParam: $nodesWithDRA
34+
- opcode: createResourceDriver
35+
driverName: test-driver.cdi.k8s.io
36+
nodes: scheduler-perf-dra-*
37+
maxClaimsPerNodeParam: $maxClaimsPerNode
38+
- opcode: createAny
39+
templatePath: ../templates/deviceclass.yaml
40+
- opcode: createAny
41+
templatePath: ../templates/resourceclaimtemplate-toleration.yaml
42+
namespace: init
43+
- opcode: createPods
44+
namespace: init
45+
countParam: $initPods
46+
podTemplatePath: ../templates/pod-with-claim-template.yaml
47+
- opcode: createAny
48+
templatePath: ../templates/resourceclaimtemplate-toleration.yaml
49+
namespace: test
50+
- opcode: createPods
51+
namespace: test
52+
countParam: $measurePods
53+
podTemplatePath: ../templates/pod-with-claim-template.yaml
54+
collectMetrics: true
55+
workloads:
56+
- name: fast
57+
featureGates:
58+
SchedulerQueueingHints: false
59+
labels: [integration-test, short]
60+
params:
61+
# This testcase runs through all code paths without
62+
# taking too long overall.
63+
nodesWithDRA: 1
64+
nodesWithoutDRA: 1
65+
initPods: 0
66+
measurePods: 10
67+
maxClaimsPerNode: 10
68+
- name: fast_QueueingHintsEnabled
69+
featureGates:
70+
SchedulerQueueingHints: true
71+
labels: [integration-test, short]
72+
params:
73+
# This testcase runs through all code paths without
74+
# taking too long overall.
75+
nodesWithDRA: 1
76+
nodesWithoutDRA: 1
77+
initPods: 0
78+
measurePods: 10
79+
maxClaimsPerNode: 10
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package extendedresource
18+
19+
import (
20+
"fmt"
21+
"os"
22+
"testing"
23+
24+
_ "k8s.io/component-base/logs/json/register"
25+
perf "k8s.io/kubernetes/test/integration/scheduler_perf"
26+
)
27+
28+
func TestMain(m *testing.M) {
29+
if err := perf.InitTests(); err != nil {
30+
fmt.Fprintf(os.Stderr, "%v\n", err)
31+
os.Exit(1)
32+
}
33+
34+
m.Run()
35+
}
36+
37+
func TestSchedulerPerf(t *testing.T) {
38+
perf.RunIntegrationPerfScheduling(t, "performance-config.yaml")
39+
}
40+
41+
func BenchmarkPerfScheduling(b *testing.B) {
42+
perf.RunBenchmarkPerfScheduling(b, "performance-config.yaml", "dra_extendedresource", nil)
43+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# The following labels are used in this file. (listed in ascending order of the number of covered test cases)
2+
#
3+
# - integration-test: test cases to run as the integration test, usually to spot some issues in the scheduler implementation or scheduler-perf itself.
4+
# - performance: test cases to run in the performance test.
5+
# - short: supplemental label for the above two labels (must not used alone), which literally means short execution time test cases.
6+
#
7+
# Specifically, the CIs use labels like the following:
8+
# - `ci-kubernetes-integration-master` (`integration-test`): Test cases are chosen based on a tradeoff between code coverage and overall runtime.
9+
# It basically covers all test cases but with their smallest workload.
10+
# - `pull-kubernetes-integration` (`integration-test`,`short`): Test cases are chosen so that they should take less than total 5 min to complete.
11+
# - `ci-benchmark-scheduler-perf` (`performance`): Long enough test cases are chosen (ideally, longer than 10 seconds)
12+
# to provide meaningful samples for the pod scheduling rate.
13+
#
14+
# Also, `performance`+`short` isn't used in the CIs, but it's used to test the performance test locally.
15+
# (Sometimes, the test cases with `integration-test` are too small to spot issues.)
16+
#
17+
# Combining `performance` and `short` selects suitable workloads for a local
18+
# before/after comparisons with benchstat.
19+
20+
# SchedulingWithExtendedResource uses pods with extended resources requests.
21+
- name: SchedulingWithExtendedResource
22+
featureGates:
23+
DynamicResourceAllocation: true
24+
DRAExtendedResource: true
25+
workloadTemplate:
26+
- opcode: createNodes
27+
countParam: $nodesWithoutDRA
28+
- opcode: createNodes
29+
nodeTemplatePath: ../templates/node-with-dra-test-driver.yaml
30+
countParam: $nodesWithDRA
31+
- opcode: createResourceDriver
32+
driverName: test-driver.cdi.k8s.io
33+
nodes: scheduler-perf-dra-*
34+
maxClaimsPerNodeParam: $maxClaimsPerNode
35+
- opcode: createAny
36+
templatePath: ../templates/deviceclass-extended-resource.yaml
37+
countParam: $classes
38+
- opcode: createPods
39+
namespace: init
40+
countParam: $initPods
41+
podTemplatePath: ../templates/pod-with-extended-resource.yaml
42+
- opcode: createPods
43+
namespace: test
44+
countParam: $measurePods
45+
podTemplatePath: ../templates/pod-with-extended-resource.yaml
46+
collectMetrics: true
47+
workloads:
48+
- name: fast
49+
featureGates:
50+
DRAExtendedResource: true
51+
labels: [integration-test, short]
52+
params:
53+
# This testcase runs through all code paths without
54+
# taking too long overall.
55+
classes: 10
56+
nodesWithDRA: 1
57+
nodesWithoutDRA: 1
58+
initPods: 0
59+
measurePods: 10
60+
maxClaimsPerNode: 10
61+
- name: 2000pods_100nodes
62+
labels: [integration-test]
63+
params:
64+
classes: 1000
65+
nodesWithDRA: 100
66+
nodesWithoutDRA: 0
67+
initPods: 1000
68+
measurePods: 1000
69+
maxClaimsPerNode: 10
70+
- name: 5000pods_500nodes
71+
labels: [integration-test]
72+
params:
73+
classes: 2500
74+
nodesWithDRA: 500
75+
nodesWithoutDRA: 0
76+
initPods: 2500
77+
measurePods: 2500
78+
maxClaimsPerNode: 10

0 commit comments

Comments
 (0)