From d6d55196ae560b40dc45625becc3ac1971912af8 Mon Sep 17 00:00:00 2001 From: Kensei Nakada Date: Mon, 17 Jun 2024 18:34:08 +0000 Subject: [PATCH] add a test case with PodAffinity gated pods to scheduler_perf --- .../config/performance-config.yaml | 26 +++++++++++++++++++ .../gated-pod-with-pod-affinity.yaml | 19 ++++++++++++++ .../config/templates/node-with-name.yaml | 2 ++ .../config/templates/pod-with-label.yaml | 10 +++++++ 4 files changed, 57 insertions(+) create mode 100644 test/integration/scheduler_perf/config/templates/gated-pod-with-pod-affinity.yaml create mode 100644 test/integration/scheduler_perf/config/templates/pod-with-label.yaml diff --git a/test/integration/scheduler_perf/config/performance-config.yaml b/test/integration/scheduler_perf/config/performance-config.yaml index 5e58256f666..8c256a65fc2 100644 --- a/test/integration/scheduler_perf/config/performance-config.yaml +++ b/test/integration/scheduler_perf/config/performance-config.yaml @@ -1075,3 +1075,29 @@ gatedPods: 10000 deletingPods: 20000 measurePods: 20000 + +- name: SchedulingGatedPodsWithPodAffinityImpactForThroughput + defaultPodTemplatePath: config/templates/pod-with-label.yaml + workloadTemplate: + - opcode: createNodes + count: 1 + nodeTemplatePath: config/templates/node-with-name.yaml + - opcode: createPods + countParam: $gatedPods + podTemplatePath: config/templates/gated-pod-with-pod-affinity.yaml + skipWaitToCompletion: true + - opcode: sleep + # To produce a stable scheduler_perf result, here we make sure all gated Pods are stored in the scheduling queue. + duration: 5s + - opcode: createPods + # The scheduling of those Pods will result in many cluster events (AssignedPodAdded) + # and each of them will be processed by the scheduling queue. + # But, the scheduling throughput should only be minimally impacted by the number of gated Pods. + countParam: $measurePods + collectMetrics: true + workloads: + - name: 1000Node + labels: [performance, fast] + params: + gatedPods: 10000 + measurePods: 20000 \ No newline at end of file diff --git a/test/integration/scheduler_perf/config/templates/gated-pod-with-pod-affinity.yaml b/test/integration/scheduler_perf/config/templates/gated-pod-with-pod-affinity.yaml new file mode 100644 index 00000000000..0c622a4e198 --- /dev/null +++ b/test/integration/scheduler_perf/config/templates/gated-pod-with-pod-affinity.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Pod +metadata: + generateName: pod- + labels: + app: scheduler-perf +spec: + affinity: + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: + app: scheduler-perf + topologyKey: kubernetes.io/hostname + schedulingGates: + - name: "scheduling-gate-1" + containers: + - image: registry.k8s.io/pause:3.10 + name: pause diff --git a/test/integration/scheduler_perf/config/templates/node-with-name.yaml b/test/integration/scheduler_perf/config/templates/node-with-name.yaml index f273e292665..aa7589f993c 100644 --- a/test/integration/scheduler_perf/config/templates/node-with-name.yaml +++ b/test/integration/scheduler_perf/config/templates/node-with-name.yaml @@ -2,6 +2,8 @@ apiVersion: v1 kind: Node metadata: name: scheduler-perf-node + labels: + kubernetes.io/hostname: scheduler-perf-node spec: {} status: capacity: diff --git a/test/integration/scheduler_perf/config/templates/pod-with-label.yaml b/test/integration/scheduler_perf/config/templates/pod-with-label.yaml new file mode 100644 index 00000000000..b2c6b6dc6f4 --- /dev/null +++ b/test/integration/scheduler_perf/config/templates/pod-with-label.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Pod +metadata: + generateName: pod- + labels: + app: scheduler-perf +spec: + containers: + - image: registry.k8s.io/pause:3.10 + name: pause