Skip to content

Commit 8371a35

Browse files
committed
Split scheduler_perf config into subdirectories
1 parent c19ffb7 commit 8371a35

File tree

113 files changed

+2373
-2164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+2373
-2164
lines changed

build/dependencies.yaml

+9-9
Original file line numberDiff line numberDiff line change
@@ -224,23 +224,23 @@ dependencies:
224224
match: registry.k8s.io\/pause:\d+\.\d+
225225
- path: test/integration/benchmark-controller.json
226226
match: registry.k8s.io\/pause:\d+\.\d+
227-
- path: test/integration/scheduler_perf/config/templates/pod-default.yaml
227+
- path: test/integration/scheduler_perf/templates/pod-default.yaml
228228
match: registry.k8s.io\/pause:\d+\.\d+
229-
- path: test/integration/scheduler_perf/config/templates/pod-with-node-affinity.yaml
229+
- path: test/integration/scheduler_perf/templates/pod-with-node-affinity.yaml
230230
match: registry.k8s.io\/pause:\d+\.\d+
231-
- path: test/integration/scheduler_perf/config/templates/pod-with-pod-affinity.yaml
231+
- path: test/integration/scheduler_perf/templates/pod-with-pod-affinity.yaml
232232
match: registry.k8s.io\/pause:\d+\.\d+
233-
- path: test/integration/scheduler_perf/config/templates/pod-with-pod-anti-affinity.yaml
233+
- path: test/integration/scheduler_perf/templates/pod-with-pod-anti-affinity.yaml
234234
match: registry.k8s.io\/pause:\d+\.\d+
235-
- path: test/integration/scheduler_perf/config/templates/pod-with-preferred-pod-affinity.yaml
235+
- path: test/integration/scheduler_perf/templates/pod-with-preferred-pod-affinity.yaml
236236
match: registry.k8s.io\/pause:\d+\.\d+
237-
- path: test/integration/scheduler_perf/config/templates/pod-with-preferred-pod-anti-affinity.yaml
237+
- path: test/integration/scheduler_perf/templates/pod-with-preferred-pod-anti-affinity.yaml
238238
match: registry.k8s.io\/pause:\d+\.\d+
239-
- path: test/integration/scheduler_perf/config/templates/pod-with-preferred-topology-spreading.yaml
239+
- path: test/integration/scheduler_perf/templates/pod-with-preferred-topology-spreading.yaml
240240
match: registry.k8s.io\/pause:\d+\.\d+
241-
- path: test/integration/scheduler_perf/config/templates/pod-with-secret-volume.yaml
241+
- path: test/integration/scheduler_perf/templates/pod-with-secret-volume.yaml
242242
match: registry.k8s.io\/pause:\d+\.\d+
243-
- path: test/integration/scheduler_perf/config/templates/pod-with-topology-spreading.yaml
243+
- path: test/integration/scheduler_perf/templates/pod-with-topology-spreading.yaml
244244
match: registry.k8s.io\/pause:\d+\.\d+
245245
- path: test/utils/image/manifest.go
246246
match: configs\[Pause\] = Config{list\.GcRegistry, "pause", "\d+\.\d+(.\d+)?"}

test/integration/scheduler_perf/README.md

+16-15
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ Currently the test suite has the following:
3333

3434
```shell
3535
# In Kubernetes root path
36-
make test-integration WHAT=./test/integration/scheduler_perf ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling"
36+
make test-integration WHAT=./test/integration/scheduler_perf/... ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling"
3737
```
3838

39-
The benchmark suite runs all the tests specified under config/performance-config.yaml.
39+
The benchmark suite runs all the tests specified under subdirectories split by topic (`<topic>/performance-config.yaml`).
4040
By default, it runs all workloads that have the "performance" label. In the configuration,
4141
labels can be added to a test case and/or individual workloads. Each workload also has
4242
all labels of its test case. The `perf-scheduling-label-filter` command line flag can
@@ -46,11 +46,12 @@ a comma-separated list of label names. Each label may have a `+` or `-` as prefi
4646
be set. For example, this runs all performance benchmarks except those that are labeled
4747
as "integration-test":
4848
```shell
49-
make test-integration WHAT=./test/integration/scheduler_perf ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling -perf-scheduling-label-filter=performance,-integration-test"
49+
make test-integration WHAT=./test/integration/scheduler_perf/... ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling -perf-scheduling-label-filter=performance,-integration-test"
5050
```
5151

52-
Once the benchmark is finished, JSON file with metrics is available in the current directory (test/integration/scheduler_perf). Look for `BenchmarkPerfScheduling_benchmark_YYYY-MM-DDTHH:MM:SSZ.json`.
53-
You can use `-data-items-dir` to generate the metrics file elsewhere.
52+
Once the benchmark is finished, JSON files with metrics are available in the subdirectories (`test/integration/scheduler_perf/config/<topic>`).
53+
Look for `BenchmarkPerfScheduling_benchmark_YYYY-MM-DDTHH:MM:SSZ.json`.
54+
You can use `-data-items-dir` to generate the metrics files elsewhere.
5455

5556
In case you want to run a specific test in the suite, you can specify the test through `-bench` flag:
5657

@@ -59,19 +60,19 @@ Otherwise, the golang benchmark framework will try to run a test more than once
5960

6061
```shell
6162
# In Kubernetes root path
62-
make test-integration WHAT=./test/integration/scheduler_perf ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling/SchedulingBasic/5000Nodes/5000InitPods/1000PodsToSchedule"
63+
make test-integration WHAT=./test/integration/scheduler_perf/... ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling/SchedulingBasic/5000Nodes/5000InitPods/1000PodsToSchedule"
6364
```
6465

6566
To produce a cpu profile:
6667

6768
```shell
6869
# In Kubernetes root path
69-
make test-integration WHAT=./test/integration/scheduler_perf KUBE_TIMEOUT="-timeout=3600s" ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling -cpuprofile ~/cpu-profile.out"
70+
make test-integration WHAT=./test/integration/scheduler_perf/... KUBE_TIMEOUT="-timeout=3600s" ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling -cpuprofile ~/cpu-profile.out"
7071
```
7172

7273
### How to configure benchmark tests
7374

74-
Configuration file located under `config/performance-config.yaml` contains a list of templates.
75+
Configuration files located under `<topic>/performance-config.yaml` contain a list of templates.
7576
Each template allows to set:
7677
- node manifest
7778
- manifests for initial and testing pod
@@ -85,7 +86,7 @@ for available operations to build `WorkloadTemplate`.
8586
Initial pods create a state of a cluster before the scheduler performance measurement can begin.
8687
Testing pods are then subject to performance measurement.
8788

88-
The configuration file under `config/performance-config.yaml` contains a default list of templates to cover
89+
The configuration files under `<topic>/performance-config.yaml` contain a default list of templates to cover
8990
various scenarios. In case you want to add your own, you can extend the list with new templates.
9091
It's also possible to extend `op` data type, respectively its underlying data types
9192
to extend configuration of possible test cases.
@@ -115,10 +116,10 @@ removes that file only if the test passed.
115116

116117
To run integration tests, use:
117118
```
118-
make test-integration WHAT=./test/integration/scheduler_perf KUBE_TEST_ARGS=-use-testing-log
119+
make test-integration WHAT=./test/integration/scheduler_perf/... KUBE_TEST_ARGS=-use-testing-log
119120
```
120121

121-
Integration testing uses the same `config/performance-config.yaml` as
122+
Integration testing uses the same configs (`<topic>/performance-config.yaml`) as
122123
benchmarking. By default, workloads labeled as `integration-test`
123124
are executed as part of integration testing (in ci-kubernetes-integration-master job).
124125
`-test-scheduling-label-filter` can be used to change that.
@@ -139,7 +140,7 @@ The test cases labeled as `short` are executed in pull-kubernetes-integration jo
139140
| pull-kubernetes-integration | integration-test,short |
140141
| ci-benchmark-scheduler-perf | performance |
141142

142-
See the comment on [./config/performance-config.yaml](./config/performance-config.yaml) for the details.
143+
See the comment on [./misc/performance-config.yaml](./misc/performance-config.yaml) for the details.
143144

144145
## Scheduling throughput thresholds
145146

@@ -182,15 +183,15 @@ Some support for visualizing progress over time is built into the
182183
benchmarks. The measurement operation which creates pods writes .dat files like
183184
this:
184185

185-
test/integration/scheduler_perf/SchedulingBasic_5000Nodes_2023-03-17T14:52:09Z.dat
186+
test/integration/scheduler_perf/misc/SchedulingBasic_5000Nodes_2023-03-17T14:52:09Z.dat
186187

187188
This file is in a text format that [gnuplot](http://www.gnuplot.info/) can
188189
read. A wrapper script selects some suitable parameters:
189190

190-
test/integration/scheduler_perf/gnuplot.sh test/integration/scheduler_perf/*.dat
191+
test/integration/scheduler_perf/gnuplot.sh test/integration/scheduler_perf/*/*.dat
191192

192193
It plots in an interactive window by default. To write into a file, use
193194

194195
test/integration/scheduler_perf/gnuplot.sh \
195196
-e 'set term png; set output "<output>.png"' \
196-
test/integration/scheduler_perf/*.dat
197+
test/integration/scheduler_perf/*/*.dat
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Copyright 2024 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 affinity
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", "affinity", nil)
43+
}

0 commit comments

Comments
 (0)