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

108 lines
3.4 KiB
YAML
Raw Normal View History

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.roles: [ master, data, ingest ]
2020-08-15 12:24:14 +00:00
{{- if $.Values.es.prometheus }}
2020-08-11 14:09:48 +00:00
prometheus.indices: false
2020-08-15 12:24:14 +00:00
{{- end }}
2020-08-11 14:09:48 +00:00
{{- if .zone }}
node.attr.zone: {{ .zone }}
cluster.routing.allocation.awareness.attributes: k8s_node_name,zone
2020-08-11 14:09:48 +00:00
{{- end }}
transport.compress: true
{{- if .processors }}
node.processors: {{ .processors }}
{{- end }}
indices.memory.index_buffer_size: "30%"
2020-08-11 14:09:48 +00:00
podTemplate:
{{- if $.Values.es.s3Snapshot.iamrole }}
2020-08-11 14:09:48 +00:00
metadata:
annotations:
iam.amazonaws.com/role: {{ $.Values.es.s3Snapshot.iamrole }}
2020-08-11 14:09:48 +00:00
{{- end }}
spec:
{{- if or $.Values.es.prometheus $.Values.es.s3Snapshot.enabled }}
2020-08-11 14:09:48 +00:00
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 }}
2020-08-11 14:09:48 +00:00
containers:
- name: elasticsearch
securityContext:
capabilities:
add: ["SYS_CHROOT"]
{{- with .resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
{{- if .jvm_heap }}
2020-08-11 14:09:48 +00:00
env:
- name: ES_JAVA_OPTS
value: -Xms{{ .jvm_heap }}g -Xmx{{ .jvm_heap }}g
{{- end }}
2020-08-11 14:09:48 +00:00
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 or .zone .nodeAffinity }}
2020-08-11 14:09:48 +00:00
nodeAffinity:
{{- if .zone }}
2020-08-11 14:09:48 +00:00
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
2021-05-12 14:32:24 +00:00
- key: topology.kubernetes.io/zone
2020-08-11 14:09:48 +00:00
operator: In
values:
- {{ .zone }}
{{- end }}
{{- if .nodeAffinity }}
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: {{ .nodeAffinity.key }}
operator: In
values:
- {{ .nodeAffinity.value }}
{{- end }}
2020-08-11 14:09:48 +00:00
{{- 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 }}