KubeZero/charts/kubezero-logging/templates/eck/elasticsearch.yaml

95 lines
3.0 KiB
YAML

{{- 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
{{- if $.Values.es.prometheus }}
prometheus.indices: false
{{- end }}
{{- if .zone }}
node.attr.zone: {{ .zone }}
cluster.routing.allocation.awareness.attributes: zone
{{- end }}
podTemplate:
{{- if $.Values.es.s3Snapshot.iamrole }}
metadata:
annotations:
iam.amazonaws.com/role: {{ $.Values.es.s3Snapshot.iamrole }}
{{- end }}
spec:
{{- if or $.Values.es.prometheus $.Values.es.s3Snapshot.enabled }}
initContainers:
- name: install-plugins
command:
- sh
- -c
- |
{{- if $.Values.es.s3Snapshot.enabled }}
bin/elasticsearch-plugin install --batch repository-s3;
{{- end }}
{{- if $.Values.es.prometheus }}
bin/elasticsearch-plugin install --batch https://github.com/vvanholl/elasticsearch-prometheus-exporter/releases/download/{{ $.Values.version }}.0/prometheus-exporter-{{ $.Values.version }}.0.zip;
{{- end }}
{{- end }}
containers:
- name: elasticsearch
resources:
requests:
cpu: {{ default "200m" .cpu_request }}
memory: {{ mul 2 ( default "4" .jvm_heap ) }}Gi
limits:
{{- if .cpu_limit }}
cpu: {{ .cpu_limit }}
{{- end }}
memory: {{ mul 2 ( default "4" .jvm_heap ) }}Gi
env:
- name: ES_JAVA_OPTS
value: -Xms{{ default "2" .jvm_heap }}g -Xmx{{ default "2" .jvm_heap }}g
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
elasticsearch.k8s.elastic.co/cluster-name: {{ template "kubezero-lib.fullname" $ }}
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 }}