2020-08-11 14:09:48 +00:00
|
|
|
{{- if .Values.es.nodeSets }}
|
|
|
|
apiVersion: elasticsearch.k8s.elastic.co/v1
|
|
|
|
kind: Elasticsearch
|
|
|
|
metadata:
|
|
|
|
name: {{ template "kubezero-lib.fullname" . }}
|
|
|
|
namespace: {{ .Release.Namespace }}
|
|
|
|
labels:
|
|
|
|
{{ include "kubezero-lib.labels" . | indent 4 }}
|
|
|
|
spec:
|
|
|
|
version: {{ .Values.version }}
|
|
|
|
nodeSets:
|
|
|
|
{{- range .Values.es.nodeSets }}
|
|
|
|
- name: {{ .name }}
|
|
|
|
config:
|
|
|
|
node.master: true
|
|
|
|
node.data: true
|
|
|
|
node.ingest: true
|
|
|
|
node.ml: false
|
|
|
|
prometheus.indices: false
|
|
|
|
{{- if .zone }}
|
|
|
|
node.attr.zone: {{ .zone }}
|
|
|
|
cluster.routing.allocation.awareness.attributes: zone
|
|
|
|
{{- end }}
|
|
|
|
podTemplate:
|
2020-08-14 14:52:10 +00:00
|
|
|
{{- if $.Values.es.s3Snapshot.iamrole }}
|
2020-08-11 14:09:48 +00:00
|
|
|
metadata:
|
|
|
|
annotations:
|
2020-08-13 18:44:50 +00:00
|
|
|
iam.amazonaws.com/role: {{ $.Values.es.s3Snapshot.iamrole }}
|
2020-08-11 14:09:48 +00:00
|
|
|
{{- end }}
|
|
|
|
spec:
|
2020-08-13 18:44:50 +00:00
|
|
|
{{- if or $.Values.es.prometheus $.Values.es.s3Snapshot.enabled }}
|
2020-08-11 14:09:48 +00:00
|
|
|
initContainers:
|
|
|
|
- name: install-plugins
|
|
|
|
command:
|
|
|
|
- sh
|
|
|
|
- -c
|
|
|
|
- |
|
2020-08-13 18:44:50 +00:00
|
|
|
{{- if $.Values.es.s3Snapshot.enabled }}
|
2020-08-14 14:52:10 +00:00
|
|
|
bin/elasticsearch-plugin install --batch repository-s3;
|
2020-08-13 18:44:50 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if $.Values.es.prometheus }}
|
2020-08-14 14:52:10 +00:00
|
|
|
bin/elasticsearch-plugin install --batch https://github.com/vvanholl/elasticsearch-prometheus-exporter/releases/download/{{ $.Values.version }}.0/prometheus-exporter-{{ $.Values.version }}.0.zip;
|
2020-08-13 18:44:50 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2020-08-11 14:09:48 +00:00
|
|
|
containers:
|
|
|
|
- name: elasticsearch
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
cpu: 100m
|
|
|
|
memory: 2500Mi
|
|
|
|
limits:
|
|
|
|
memory: 4Gi
|
|
|
|
env:
|
|
|
|
- name: ES_JAVA_OPTS
|
|
|
|
value: "-Xms2g -Xmx2g"
|
|
|
|
affinity:
|
|
|
|
podAntiAffinity:
|
|
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
2020-08-14 22:02:30 +00:00
|
|
|
- labelSelector:
|
|
|
|
matchLabels:
|
|
|
|
elasticsearch.k8s.elastic.co/cluster-name: {{ template "kubezero-lib.fullname" $ }}
|
2020-08-11 14:09:48 +00:00
|
|
|
topologyKey: kubernetes.io/hostname
|
|
|
|
{{- if .zone }}
|
|
|
|
nodeAffinity:
|
|
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
|
|
nodeSelectorTerms:
|
|
|
|
- matchExpressions:
|
|
|
|
- key: failure-domain.beta.kubernetes.io/zone
|
|
|
|
operator: In
|
|
|
|
values:
|
|
|
|
- {{ .zone }}
|
|
|
|
{{- end }}
|
|
|
|
count: {{ .count }}
|
|
|
|
volumeClaimTemplates:
|
|
|
|
- metadata:
|
|
|
|
name: elasticsearch-data
|
|
|
|
spec:
|
|
|
|
accessModes:
|
|
|
|
- ReadWriteOnce
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: {{ .storage.size }}
|
|
|
|
storageClassName: {{ .storage.class }}
|
|
|
|
{{- end }}
|
|
|
|
http:
|
|
|
|
tls:
|
|
|
|
selfSignedCertificate:
|
|
|
|
disabled: true
|
|
|
|
{{- end }}
|