Skip to content

Commit 0db96a0

Browse files
committed
Add scheduler_perf test case for AssignedPodAdd event handling
1 parent c5abe61 commit 0db96a0

File tree

7 files changed

+169
-0
lines changed

7 files changed

+169
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Node
3+
metadata:
4+
generateName: scheduler-perf-
5+
spec: {}
6+
status:
7+
capacity:
8+
pods: "3000"
9+
cpu: "4"
10+
memory: 32Gi
11+
conditions:
12+
- status: "True"
13+
type: Ready
14+
phase: Running
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
generateName: pod-interpodaffinity-
5+
labels:
6+
type: unsched
7+
spec:
8+
affinity:
9+
podAffinity:
10+
requiredDuringSchedulingIgnoredDuringExecution:
11+
- labelSelector:
12+
matchLabels:
13+
color: yellow-{{ .Index }}
14+
topologyKey: kubernetes.io/hostname
15+
namespaces: ["interpodaffinity"]
16+
containers:
17+
- image: registry.k8s.io/pause:3.10
18+
name: pause
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
generateName: pod-podtopologyspread-
5+
labels:
6+
type: unsched
7+
topology: blue
8+
spec:
9+
affinity:
10+
podAntiAffinity:
11+
requiredDuringSchedulingIgnoredDuringExecution:
12+
- labelSelector:
13+
matchLabels:
14+
color: green
15+
topologyKey: kubernetes.io/hostname
16+
namespaces: ["podtopologyspread"]
17+
topologySpreadConstraints:
18+
- maxSkew: 1
19+
topologyKey: kubernetes.io/hostname
20+
whenUnsatisfiable: DoNotSchedule
21+
labelSelector:
22+
matchLabels:
23+
topology: blue
24+
containers:
25+
- image: registry.k8s.io/pause:3.10
26+
name: pause
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
generateName: pod-unblocker-affinity-
5+
labels:
6+
color: yellow-{{ .Index }}
7+
spec:
8+
containers:
9+
- image: registry.k8s.io/pause:3.10
10+
name: pause
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
generateName: pod-unblocker-topology-
5+
labels:
6+
topology: blue
7+
color: green
8+
spec:
9+
affinity:
10+
podAffinity:
11+
requiredDuringSchedulingIgnoredDuringExecution:
12+
- labelSelector:
13+
matchLabels:
14+
color: green
15+
topologyKey: kubernetes.io/hostname
16+
namespaces: ["podtopologyspread"]
17+
containers:
18+
- image: registry.k8s.io/pause:3.10
19+
name: pause
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
generateName: pod-with-label-
5+
labels:
6+
color: green
7+
spec:
8+
containers:
9+
- image: registry.k8s.io/pause:3.10
10+
name: pause

test/integration/scheduler_perf/config/performance-config.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,3 +1881,75 @@
18811881
params:
18821882
nodes: 100
18831883
measurePods: 1000 # Must be initNodes * 10
1884+
1885+
# This test case is used to measure the performance of queuing hints when handling the AssignedPodAdd events.
1886+
# First, two nodes are created. Then, one pod is created and scheduled on one of the nodes.
1887+
# Next, group of topology spreading pods tries to be scheduled, but they can only fill one node,
1888+
# because of the anti affinity to the pod on the second node.
1889+
# Then, group of interpodaffinity pods is created and wait for pods with matching labels to be scheduled first.
1890+
# Next, new pods are scheduled that unblock the previously unschedulable pods, by balancing the topology
1891+
# and scheduling pods with matching labels to the intepodaffinity pods.
1892+
# Plugins covered: InterPodAffinity and PodTopologySpread.
1893+
- name: EventHandlingPodAdd
1894+
featureGates:
1895+
SchedulerQueueingHints: true
1896+
workloadTemplate:
1897+
# Create two nodes with enough capacity.
1898+
- opcode: createNodes
1899+
count: 2
1900+
nodeTemplatePath: config/event_handling/podadd-node.yaml
1901+
# Create one pod with label that will block topology spreading pods
1902+
# from being scheduled on one node using pod anti affinity.
1903+
- opcode: createPods
1904+
count: 1
1905+
podTemplatePath: config/event_handling/podadd-pod-with-label.yaml
1906+
namespace: podtopologyspread
1907+
# Collect metrics for unsched pods created below.
1908+
- opcode: startCollectingMetrics
1909+
name: unschedPods
1910+
namespaces: [podtopologyspread, interpodaffinity]
1911+
labelSelector:
1912+
type: unsched
1913+
# Create pods blocked using PodTopologySpread plugin.
1914+
# Max skew is configured to 1, so more pods need to be created on the first node
1915+
# (with the pod created above), to fill up the second node with these pods.
1916+
- opcode: createPods
1917+
countParam: $measurePods
1918+
podTemplatePath: config/event_handling/podadd-pod-podtopologyspread.yaml
1919+
skipWaitToCompletion: true
1920+
namespace: podtopologyspread
1921+
# Create pods blocked using InterPodAffinity plugin.
1922+
# They don't have the affinity to themselves,
1923+
# so have to wait for another pods with matching labels to be created at first.
1924+
- opcode: createPods
1925+
countParam: $measurePods
1926+
podTemplatePath: config/event_handling/podadd-pod-interpodaffinity.yaml
1927+
skipWaitToCompletion: true
1928+
namespace: interpodaffinity
1929+
# Wait for unschedulable pods to be processed by the scheduler.
1930+
- opcode: barrier
1931+
stageRequirement: Attempted
1932+
labelSelector:
1933+
type: unsched
1934+
# Create pods that will get scheduled on the node with the first pod created with matching label.
1935+
# Their creation will gradually unblock topology spreading pods and make them schedulable on the second node.
1936+
- opcode: createPods
1937+
countParam: $measurePods
1938+
podTemplatePath: config/event_handling/podadd-pod-unblocker-topology.yaml
1939+
namespace: podtopologyspread
1940+
# Create pods with matching labels to the affinity of previously created interpodaffinity pods.
1941+
# Each of them will unblock one pod and make it schedulable.
1942+
- opcode: createPods
1943+
countParam: $measurePods
1944+
podTemplatePath: config/event_handling/podadd-pod-unblocker-affinity.yaml
1945+
namespace: interpodaffinity
1946+
# Wait for previously unschedulable pods to be scheduled.
1947+
- opcode: barrier
1948+
labelSelector:
1949+
type: unsched
1950+
- opcode: stopCollectingMetrics
1951+
workloads:
1952+
- name: 1000Pods
1953+
labels: [performance, short]
1954+
params:
1955+
measurePods: 1000

0 commit comments

Comments
 (0)