From 58142288a574ccc32bc69feb7073d9e3fafc9ae5 Mon Sep 17 00:00:00 2001 From: Dave Chen Date: Fri, 4 Dec 2020 18:04:26 +0800 Subject: [PATCH] Add constraint selector to pod template PodTopologySpread plugin will only count the existing pod when that pod's label matches with `constraint.Selector`, which means all pods could be scheduled to one topology zone when the constraint does not have any selector defined. Signed-off-by: Dave Chen --- .../config/pod-with-preferred-topology-spreading.yaml | 5 +++++ .../scheduler_perf/config/pod-with-topology-spreading.yaml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/test/integration/scheduler_perf/config/pod-with-preferred-topology-spreading.yaml b/test/integration/scheduler_perf/config/pod-with-preferred-topology-spreading.yaml index 39a171f393a..5fbc23e2697 100644 --- a/test/integration/scheduler_perf/config/pod-with-preferred-topology-spreading.yaml +++ b/test/integration/scheduler_perf/config/pod-with-preferred-topology-spreading.yaml @@ -2,11 +2,16 @@ apiVersion: v1 kind: Pod metadata: generateName: spreading-pod- + labels: + color: blue spec: topologySpreadConstraints: - maxSkew: 5 topologyKey: topology.kubernetes.io/zone whenUnsatisfiable: ScheduleAnyway + labelSelector: + matchLabels: + color: blue containers: - image: k8s.gcr.io/pause:3.2 name: pause diff --git a/test/integration/scheduler_perf/config/pod-with-topology-spreading.yaml b/test/integration/scheduler_perf/config/pod-with-topology-spreading.yaml index cb3769675ed..8175b555521 100644 --- a/test/integration/scheduler_perf/config/pod-with-topology-spreading.yaml +++ b/test/integration/scheduler_perf/config/pod-with-topology-spreading.yaml @@ -2,11 +2,16 @@ apiVersion: v1 kind: Pod metadata: generateName: spreading-pod- + labels: + color: blue spec: topologySpreadConstraints: - maxSkew: 5 topologyKey: topology.kubernetes.io/zone whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + color: blue containers: - image: k8s.gcr.io/pause:3.2 name: pause