diff --git a/charts/jindocache/templates/master/statefulset.yaml b/charts/jindocache/templates/master/statefulset.yaml index 4bc55058615..5ec924ffd98 100755 --- a/charts/jindocache/templates/master/statefulset.yaml +++ b/charts/jindocache/templates/master/statefulset.yaml @@ -62,6 +62,22 @@ spec: {{- toYaml .Values.imagePullSecrets | nindent 8 }} {{- end }} hostNetwork: {{ .Values.useHostNetwork }} + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + 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 4cc2e459939..c9b577049ac 100755 --- a/charts/jindofsx/templates/master/statefulset.yaml +++ b/charts/jindofsx/templates/master/statefulset.yaml @@ -62,6 +62,22 @@ spec: {{- toYaml .Values.imagePullSecrets | nindent 8 }} {{- end }} hostNetwork: {{ .Values.useHostNetwork }} + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + 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/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 } }