From 614fb6c8866ec368432626180f8b6bfefcc0337e Mon Sep 17 00:00:00 2001 From: trafalgarzzz Date: Tue, 24 Dec 2024 13:55:56 +0800 Subject: [PATCH 1/2] bugfix: add pod anti affinity to master sts to make HA available Signed-off-by: trafalgarzzz --- .../jindocache/templates/master/statefulset.yaml | 15 +++++++++++++++ charts/jindofsx/templates/master/statefulset.yaml | 15 +++++++++++++++ pkg/ddc/jindocache/transform.go | 7 ------- pkg/ddc/jindofsx/transform.go | 7 ------- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/charts/jindocache/templates/master/statefulset.yaml b/charts/jindocache/templates/master/statefulset.yaml index 4bc55058615..48a4c5d95ae 100755 --- a/charts/jindocache/templates/master/statefulset.yaml +++ b/charts/jindocache/templates/master/statefulset.yaml @@ -62,6 +62,21 @@ spec: {{- toYaml .Values.imagePullSecrets | nindent 8 }} {{- end }} hostNetwork: {{ .Values.useHostNetwork }} + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + labelSelector: + matchExpressions: + - key: role + operator: In + values: + - jindofs-master + - key: release + operator: In + values: + - {{ .Release.Name | quote }} + topologyKey: kubernetes.io/hostname nodeSelector: {{- if .Values.master.nodeSelector }} {{ toYaml .Values.master.nodeSelector | trim | indent 8 }} diff --git a/charts/jindofsx/templates/master/statefulset.yaml b/charts/jindofsx/templates/master/statefulset.yaml index 4cc2e459939..5b14eae8e7b 100755 --- a/charts/jindofsx/templates/master/statefulset.yaml +++ b/charts/jindofsx/templates/master/statefulset.yaml @@ -62,6 +62,21 @@ spec: {{- toYaml .Values.imagePullSecrets | nindent 8 }} {{- end }} hostNetwork: {{ .Values.useHostNetwork }} + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + labelSelector: + matchExpressions: + - key: role + operator: In + values: + - jindofs-master + - key: release + operator: In + values: + - {{ .Release.Name | quote }} + topologyKey: kubernetes.io/hostname nodeSelector: {{- if .Values.master.nodeSelector }} {{ toYaml .Values.master.nodeSelector | trim | indent 8 }} diff --git a/pkg/ddc/jindocache/transform.go b/pkg/ddc/jindocache/transform.go index 8e388d42b14..323452aa827 100644 --- a/pkg/ddc/jindocache/transform.go +++ b/pkg/ddc/jindocache/transform.go @@ -247,13 +247,6 @@ func (e *JindoCacheEngine) transformMaster(runtime *datav1alpha1.JindoRuntime, m // combine properties together if len(runtime.Spec.Master.Properties) > 0 { for k, v := range runtime.Spec.Master.Properties { - // user define master volume eg: pvc to persist metadata, they can use namespace.meta-dir to define, but can't used under 3 master - // because master will shared the same path to save data - if k == "namespace.meta-dir" && runtime.Spec.Master.Replicas == 3 { - err = fmt.Errorf("not support set namespace.meta.dir with %v and replicas = 3", v) - e.Log.Error(err, "namespace.meta-dir", v) - return - } properties[k] = v } } diff --git a/pkg/ddc/jindofsx/transform.go b/pkg/ddc/jindofsx/transform.go index 68552784f70..8310dd0a817 100644 --- a/pkg/ddc/jindofsx/transform.go +++ b/pkg/ddc/jindofsx/transform.go @@ -227,13 +227,6 @@ func (e *JindoFSxEngine) transformMaster(runtime *datav1alpha1.JindoRuntime, met // combine properties together if len(runtime.Spec.Master.Properties) > 0 { for k, v := range runtime.Spec.Master.Properties { - // user define master volume eg: pvc to persist metadata, they can use namespace.meta-dir to define, but can't used under 3 master - // because master will shared the same path to save data - if k == "namespace.meta-dir" && runtime.Spec.Master.Replicas == 3 { - err = fmt.Errorf("not support set namespace.meta.dir with %v and replicas = 3", v) - e.Log.Error(err, "namespace.meta-dir", v) - return - } properties[k] = v } } From 85fd925c5a54c9dcb8c663b436543c3dd270f372 Mon Sep 17 00:00:00 2001 From: trafalgarzzz Date: Tue, 24 Dec 2024 14:04:51 +0800 Subject: [PATCH 2/2] bugfix: add pod anti affinity to master sts to make HA available Signed-off-by: trafalgarzzz --- .../templates/master/statefulset.yaml | 23 ++++++++++--------- .../templates/master/statefulset.yaml | 23 ++++++++++--------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/charts/jindocache/templates/master/statefulset.yaml b/charts/jindocache/templates/master/statefulset.yaml index 48a4c5d95ae..5ec924ffd98 100755 --- a/charts/jindocache/templates/master/statefulset.yaml +++ b/charts/jindocache/templates/master/statefulset.yaml @@ -66,17 +66,18 @@ spec: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 - labelSelector: - matchExpressions: - - key: role - operator: In - values: - - jindofs-master - - key: release - operator: In - values: - - {{ .Release.Name | quote }} - topologyKey: kubernetes.io/hostname + podAffinityTerm: + labelSelector: + matchExpressions: + - key: role + operator: In + values: + - jindofs-master + - key: release + operator: In + values: + - {{ .Release.Name | quote }} + topologyKey: kubernetes.io/hostname nodeSelector: {{- if .Values.master.nodeSelector }} {{ toYaml .Values.master.nodeSelector | trim | indent 8 }} diff --git a/charts/jindofsx/templates/master/statefulset.yaml b/charts/jindofsx/templates/master/statefulset.yaml index 5b14eae8e7b..c9b577049ac 100755 --- a/charts/jindofsx/templates/master/statefulset.yaml +++ b/charts/jindofsx/templates/master/statefulset.yaml @@ -66,17 +66,18 @@ spec: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 - labelSelector: - matchExpressions: - - key: role - operator: In - values: - - jindofs-master - - key: release - operator: In - values: - - {{ .Release.Name | quote }} - topologyKey: kubernetes.io/hostname + podAffinityTerm: + labelSelector: + matchExpressions: + - key: role + operator: In + values: + - jindofs-master + - key: release + operator: In + values: + - {{ .Release.Name | quote }} + topologyKey: kubernetes.io/hostname nodeSelector: {{- if .Values.master.nodeSelector }} {{ toYaml .Values.master.nodeSelector | trim | indent 8 }}