Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
More flexible affinity configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
donbeave committed Jan 8, 2020
1 parent 9687191 commit 9403c03
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 43 deletions.
16 changes: 3 additions & 13 deletions helm/opendistro-es/templates/elasticsearch/es-client-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,10 @@ spec:
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
# Weighted anti-affinity to disallow deploying client node to the same worker node as master node
{{- with .Values.elasticsearch.client.affinity }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
topologyKey: "kubernetes.io/hostname"
labelSelector:
matchLabels:
role: client
{{- with .Values.elasticsearch.client.nodeAffinity }}
nodeAffinity:
{{ toYaml . | indent 10 }}
{{- end }}
{{- toYaml . | nindent 8 }}
{{- end }}
initContainers:
- name: init-sysctl
image: {{ .Values.elasticsearch.initContainer.image }}:{{ .Values.elasticsearch.initContainer.imageTag }}
Expand Down
16 changes: 3 additions & 13 deletions helm/opendistro-es/templates/elasticsearch/es-data-sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,10 @@ spec:
- mountPath: /usr/share/elasticsearch/data
name: data
subPath: {{ .Values.elasticsearch.data.persistence.subPath }}
# Weighted anti-affinity to disallow deploying client node to the same worker node as master node
{{- with .Values.elasticsearch.data.affinity }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
topologyKey: "kubernetes.io/hostname"
labelSelector:
matchLabels:
role: data
{{- with .Values.elasticsearch.data.nodeAffinity }}
nodeAffinity:
{{ toYaml . | indent 10 }}
{{- end }}
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ template "opendistro-es.elasticsearch.serviceAccountName" . }}
containers:
- name: elasticsearch
Expand Down
14 changes: 3 additions & 11 deletions helm/opendistro-es/templates/elasticsearch/es-master-sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,10 @@ spec:
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
# Anti-affinity to disallow deploying client and master nodes on the same worker node
{{- with .Values.elasticsearch.master.affinity }}
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: "kubernetes.io/hostname"
labelSelector:
matchLabels:
role: master
{{- with .Values.elasticsearch.master.nodeAffinity }}
nodeAffinity:
{{ toYaml . | indent 10 }}
{{- end }}
{{- toYaml . | nindent 8 }}
{{- end }}
initContainers:
- name: init-sysctl
image: {{ .Values.elasticsearch.initContainer.image }}:{{ .Values.elasticsearch.initContainer.imageTag }}
Expand Down
4 changes: 4 additions & 0 deletions helm/opendistro-es/templates/kibana/kibana-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ spec:
{{- with .Values.kibana.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.elasticsearch.client.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.kibana.tolerations }}
tolerations:
Expand Down
38 changes: 32 additions & 6 deletions helm/opendistro-es/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ kibana:
##
tolerations: []

affinity: {}

serviceAccount:
# Specifies whether a ServiceAccount should be created
Expand Down Expand Up @@ -154,7 +155,6 @@ elasticsearch:
enabled: true
replicas: 3
updateStrategy: "RollingUpdate"
nodeAffinity: {}

## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
Expand Down Expand Up @@ -196,21 +196,28 @@ elasticsearch:
podDisruptionBudget:
enabled: false
minAvailable: 1
tolerations: []
readinessProbe: []
livenessProbe:
tcpSocket:
port: transport
initialDelaySeconds: 60
periodSeconds: 10
nodeSelector: {}
tolerations: []
# Anti-affinity to disallow deploying client and master nodes on the same worker node
affinity: {}
# podAntiAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# - topologyKey: "kubernetes.io/hostname"
# labelSelector:
# matchLabels:
# role: master
podAnnotations: {}

data:
enabled: true
replicas: 3
updateStrategy: "RollingUpdate"
nodeAffinity: {}

## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
Expand Down Expand Up @@ -252,14 +259,24 @@ elasticsearch:
podDisruptionBudget:
enabled: false
minAvailable: 1
tolerations: []
readinessProbe: []
livenessProbe:
tcpSocket:
port: transport
initialDelaySeconds: 60
periodSeconds: 10
nodeSelector: {}
tolerations: []
# Anti-affinity to disallow deploying client and master nodes on the same worker node
affinity: {}
# podAntiAffinity:
# preferredDuringSchedulingIgnoredDuringExecution:
# - weight: 1
# podAffinityTerm:
# topologyKey: "kubernetes.io/hostname"
# labelSelector:
# matchLabels:
# role: data
podAnnotations: {}

client:
Expand All @@ -283,7 +300,6 @@ elasticsearch:
# service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
replicas: 2
javaOpts: "-Xms512m -Xmx512m"
nodeAffinity: {}
ingress:
enabled: true
annotations: {}
Expand All @@ -307,14 +323,24 @@ elasticsearch:
podDisruptionBudget:
enabled: false
minAvailable: 1
tolerations: []
readinessProbe: []
livenessProbe:
tcpSocket:
port: transport
initialDelaySeconds: 60
periodSeconds: 10
nodeSelector: {}
tolerations: []
# Weighted anti-affinity to disallow deploying client node to the same worker node as master node
affinity: {}
# podAntiAffinity:
# preferredDuringSchedulingIgnoredDuringExecution:
# - weight: 1
# podAffinityTerm:
# topologyKey: "kubernetes.io/hostname"
# labelSelector:
# matchLabels:
# role: client
podAnnotations: {}

config: {}
Expand Down

0 comments on commit 9403c03

Please sign in to comment.