From 48f2c9ec20570af081cc223910a72a49448b4e5c Mon Sep 17 00:00:00 2001 From: kerthcet Date: Wed, 2 Nov 2022 18:56:28 +0800 Subject: [PATCH] Add benchmark tests for nodeInclusionPolicy Signed-off-by: kerthcet --- .../config/node-with-taint.yaml | 17 ++++++++++ .../config/performance-config.yaml | 32 +++++++++++++++++-- .../pod-with-node-inclusion-policy.yaml | 28 ++++++++++++++++ .../scheduler_perf/scheduler_perf_test.go | 2 +- test/utils/create_resources.go | 2 +- 5 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 test/integration/scheduler_perf/config/node-with-taint.yaml create mode 100644 test/integration/scheduler_perf/config/pod-with-node-inclusion-policy.yaml diff --git a/test/integration/scheduler_perf/config/node-with-taint.yaml b/test/integration/scheduler_perf/config/node-with-taint.yaml new file mode 100644 index 00000000000..39df81b8a55 --- /dev/null +++ b/test/integration/scheduler_perf/config/node-with-taint.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Node +metadata: + generateName: taint-node- +spec: + taints: + - effect: NoSchedule + key: foo +status: + capacity: + pods: "110" + cpu: "4" + memory: 32Gi + conditions: + - status: "True" + type: Ready + phase: Running diff --git a/test/integration/scheduler_perf/config/performance-config.yaml b/test/integration/scheduler_perf/config/performance-config.yaml index 9d57065f695..3f4ad379006 100644 --- a/test/integration/scheduler_perf/config/performance-config.yaml +++ b/test/integration/scheduler_perf/config/performance-config.yaml @@ -399,7 +399,7 @@ measurePods: 500 # This test case always seems to fail. # https://github.com/kubernetes/kubernetes/issues/108308 -# +# # - name: 5000Nodes # params: # initNodes: 5000 @@ -427,7 +427,7 @@ measurePods: 500 # This test case always seems to fail. # https://github.com/kubernetes/kubernetes/issues/108308 -# +# # - name: 5000Nodes # params: # initNodes: 5000 @@ -630,3 +630,31 @@ initNamespaces: 100 measurePods: 1000 +- name: SchedulingWithNodeInclusionPolicy + featureGates: + NodeInclusionPolicyInPodTopologySpread: true + defaultPodTemplatePath: config/pod-with-node-inclusion-policy.yaml + workloadTemplate: + - opcode: createNodes + countParam: $normalNodes + uniqueNodeLabelStrategy: + labelKey: kubernetes.io/hostname + - opcode: createNodes + nodeTemplatePath: config/node-with-taint.yaml + countParam: $taintNodes + uniqueNodeLabelStrategy: + labelKey: kubernetes.io/hostname + - opcode: createPods + countParam: $measurePods + collectMetrics: true + workloads: + - name: 500Nodes + params: + taintNodes: 100 + normalNodes: 400 + measurePods: 400 + - name: 5000Nodes + params: + taintNodes: 1000 + normalNodes: 4000 + measurePods: 4000 diff --git a/test/integration/scheduler_perf/config/pod-with-node-inclusion-policy.yaml b/test/integration/scheduler_perf/config/pod-with-node-inclusion-policy.yaml new file mode 100644 index 00000000000..f304a3306de --- /dev/null +++ b/test/integration/scheduler_perf/config/pod-with-node-inclusion-policy.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Pod +metadata: + generateName: spreading-pod-with-node-inclusion-policy- + labels: + foo: bar +spec: + containers: + - image: registry.k8s.io/pause:3.8 + name: pause + ports: + - containerPort: 80 + resources: + limits: + cpu: 100m + memory: 500Mi + requests: + cpu: 100m + memory: 500Mi + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: kubernetes.io/hostname + whenUnsatisfiable: DoNotSchedule + NodeAffinityPolicy: Honor + NodeTaintsPolicy: Honor + labelSelector: + matchLabels: + foo: bar diff --git a/test/integration/scheduler_perf/scheduler_perf_test.go b/test/integration/scheduler_perf/scheduler_perf_test.go index e141c227366..e4837dd570b 100644 --- a/test/integration/scheduler_perf/scheduler_perf_test.go +++ b/test/integration/scheduler_perf/scheduler_perf_test.go @@ -968,7 +968,7 @@ func waitUntilPodsScheduledInNamespace(ctx context.Context, podInformer coreinfo if len(scheduled) >= wantCount { return true, nil } - klog.Infof("%s: namespace %s: got %d pods, want %d", name, namespace, len(scheduled), wantCount) + klog.Infof("%s: namespace %s, pods: want %d, got %d", name, namespace, wantCount, len(scheduled)) return false, nil }) } diff --git a/test/utils/create_resources.go b/test/utils/create_resources.go index 71a5e1ff79e..07adb17c7d5 100644 --- a/test/utils/create_resources.go +++ b/test/utils/create_resources.go @@ -65,7 +65,7 @@ func CreatePodWithRetries(c clientset.Interface, namespace string, obj *v1.Pod) if err == nil || apierrors.IsAlreadyExists(err) { return true, nil } - return false, fmt.Errorf("Failed to create object with non-retriable error: %v ", err) + return false, fmt.Errorf("failed to create object with non-retriable error: %v ", err) } return RetryWithExponentialBackOff(createFunc) }