From 9fd20de60a5399dc44ff3e15610dbc91c6b2458f Mon Sep 17 00:00:00 2001 From: Yu Sun Date: Mon, 10 Oct 2022 16:38:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(statefulset):=E4=BD=BF=E7=94=A8affinity?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E8=8A=82=E7=82=B9=E5=88=86=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../statefulset-timescaledb-accessnode.yaml | 18 +++++++++--------- .../statefulset-timescaledb-datanode.yaml | 14 ++++++++------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/charts/templates/statefulset-timescaledb-accessnode.yaml b/charts/templates/statefulset-timescaledb-accessnode.yaml index 4f401d1..fa0de3b 100644 --- a/charts/templates/statefulset-timescaledb-accessnode.yaml +++ b/charts/templates/statefulset-timescaledb-accessnode.yaml @@ -114,10 +114,8 @@ spec: subPath: "{{ .Values.persistentVolume.subPath }}" resources: {{ toYaml .Values.resources | indent 10 }} - # {{- with .Values.nodeSelector }} - # nodeSelector: + {{- with .Values.nodeSelector }} nodeSelector: - kubernetes.io/hostname: an {{ toYaml . | indent 8 }} {{- end }} {{- with .Values.tolerations }} @@ -127,13 +125,15 @@ spec: {{- if .Values.schedulerName }} schedulerName: {{ .Values.schedulerName }} {{- end }} - {{- if .Values.affinity }} affinity: -{{ .Values.affinity | toYaml | indent 8 }} - {{- else if .Values.affinityTemplate }} - affinity: -{{ tpl .Values.affinityTemplate . | indent 8 }} - {{- end }} + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - an {{- if not .Values.persistentVolume.enabled }} - name: storage-volume emptyDir: {} diff --git a/charts/templates/statefulset-timescaledb-datanode.yaml b/charts/templates/statefulset-timescaledb-datanode.yaml index 2ee2a4e..bda9296 100644 --- a/charts/templates/statefulset-timescaledb-datanode.yaml +++ b/charts/templates/statefulset-timescaledb-datanode.yaml @@ -120,13 +120,15 @@ spec: {{- if .Values.schedulerName }} schedulerName: {{ .Values.schedulerName }} {{- end }} - {{- if .Values.affinity }} affinity: -{{ .Values.affinity | toYaml | indent 8 }} - {{- else if .Values.affinityTemplate }} - affinity: -{{ tpl .Values.affinityTemplate . | indent 8 }} - {{- end }} + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: NotIn + values: + - an {{- if not .Values.persistentVolume.enabled }} - name: storage-volume emptyDir: {}