From 4e82bc49704518f140c6a96b0d14a92bc092d4ed Mon Sep 17 00:00:00 2001 From: "sammy.huang" Date: Mon, 29 Apr 2024 14:25:36 +0800 Subject: [PATCH] enhance: use soft node affinity instead of hard nodeSelector (#32676) pr: #32677 Signed-off-by: Liang Huang --- tests/scripts/values/ci/pr-4am.yaml | 81 ++++++++++++++++++++++------ tests/scripts/values/ci/pr.yaml | 82 ++++++++++++++++++++++------- 2 files changed, 128 insertions(+), 35 deletions(-) diff --git a/tests/scripts/values/ci/pr-4am.yaml b/tests/scripts/values/ci/pr-4am.yaml index a2514869f1eba..8518b7080aa9f 100644 --- a/tests/scripts/values/ci/pr-4am.yaml +++ b/tests/scripts/values/ci/pr-4am.yaml @@ -4,8 +4,14 @@ metrics: log: level: debug -nodeSelector: - node-role.kubernetes.io/e2e: "" +affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" @@ -73,8 +79,14 @@ pulsar: components: autorecovery: false proxy: - nodeSelector: - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" @@ -96,8 +108,14 @@ pulsar: memory: "100Mi" cpu: "0.1" broker: - nodeSelector: - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" @@ -131,8 +149,14 @@ pulsar: backlogQuotaDefaultRetentionPolicy: producer_exception bookkeeper: - nodeSelector: - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" @@ -165,8 +189,14 @@ pulsar: memory: "4Gi" zookeeper: - nodeSelector: - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" @@ -191,8 +221,14 @@ pulsar: cpu: "0.3" memory: "512Mi" kafka: - nodeSelector: - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" operator: "Exists" @@ -209,9 +245,14 @@ kafka: cpu: "0.3" memory: "512Mi" etcd: - nodeSelector: - node-role/nvme: "true" - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" @@ -225,8 +266,14 @@ etcd: cpu: "0.3" memory: "100Mi" minio: - nodeSelector: - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" diff --git a/tests/scripts/values/ci/pr.yaml b/tests/scripts/values/ci/pr.yaml index 9bf2beca6e8de..a93300c2831bf 100644 --- a/tests/scripts/values/ci/pr.yaml +++ b/tests/scripts/values/ci/pr.yaml @@ -2,8 +2,14 @@ metrics: serviceMonitor: enabled: true -nodeSelector: - node-role.kubernetes.io/e2e: "" +affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" @@ -73,8 +79,14 @@ pulsar: components: autorecovery: false proxy: - nodeSelector: - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" @@ -96,8 +108,14 @@ pulsar: memory: "100Mi" cpu: "0.1" broker: - nodeSelector: - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" @@ -131,8 +149,14 @@ pulsar: backlogQuotaDefaultRetentionPolicy: producer_exception bookkeeper: - nodeSelector: - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" @@ -165,8 +189,14 @@ pulsar: memory: "4Gi" zookeeper: - nodeSelector: - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" @@ -191,8 +221,14 @@ pulsar: cpu: "0.3" memory: "512Mi" kafka: - nodeSelector: - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" operator: "Exists" @@ -203,16 +239,20 @@ kafka: cpu: "0.5" memory: "1Gi" zookeeper: - replicaCount: 1 resources: requests: cpu: "0.3" memory: "512Mi" etcd: - nodeSelector: - node-role/nvme: "true" - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e" @@ -226,8 +266,14 @@ etcd: cpu: "0.3" memory: "100Mi" minio: - nodeSelector: - node-role.kubernetes.io/e2e: "" + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 1 + preference: + matchExpressions: + - key: "node-role.kubernetes.io/e2e" + operator: "Exists" tolerations: - key: "node-role.kubernetes.io/e2e"