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:
|
2021-03-05 15:53:02 +00:00
|
|
|
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 }}
|
2021-03-19 15:15:58 +00:00
|
|
|
cluster.routing.allocation.awareness.attributes: k8s_node_name,zone
|
2020-08-11 14:09:48 +00:00
|
|
|
{{- end }}
|
2020-10-05 10:50:23 +00:00
|
|
|
transport.compress: true
|
2021-03-05 15:53:02 +00:00
|
|
|
{{- if .processors }}
|
|
|
|
node.processors: {{ .processors }}
|
|
|
|
{{- end }}
|
2021-05-13 14:21:16 +00:00
|
|
|
indices.memory.index_buffer_size: "20%"
|
2023-12-01 16:56:21 +00:00
|
|
|
index.store.type: niofs
|
2020-08-11 14:09:48 +00:00
|
|
|
podTemplate:
|
2021-08-03 11:44:38 +00:00
|
|
|
# Remove once https://github.com/elastic/elasticsearch/pull/65923 is merged
|
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
|
2020-12-04 14:05:35 +00:00
|
|
|
securityContext:
|
|
|
|
capabilities:
|
|
|
|
add: ["SYS_CHROOT"]
|
2021-03-05 15:53:02 +00:00
|
|
|
{{- with .resources }}
|
|
|
|
resources: {{ toYaml . | nindent 12 }}
|
|
|
|
{{- end }}
|
2021-08-03 11:44:38 +00:00
|
|
|
# {{- if or .jvm_heap $.Values.es.s3Snapshot.iamrole }}
|
|
|
|
# env:
|
|
|
|
# {{- end }}
|
2021-03-05 15:53:02 +00:00
|
|
|
{{- if .jvm_heap }}
|
2020-08-11 14:09:48 +00:00
|
|
|
env:
|
|
|
|
- name: ES_JAVA_OPTS
|
2023-12-01 16:56:21 +00:00
|
|
|
value: -Xms{{ .jvm_heap }} -Xmx{{ .jvm_heap }}
|
2021-03-05 15:53:02 +00:00
|
|
|
{{- end }}
|
2021-08-03 11:44:38 +00:00
|
|
|
#{{- if $.Values.es.s3Snapshot.iamrole }}
|
|
|
|
# - name: AWS_ROLE_ARN
|
|
|
|
# value: {{ $.Values.es.s3Snapshot.iamrole }}
|
|
|
|
# - name: AWS_WEB_IDENTITY_TOKEN_FILE
|
|
|
|
# value: "/var/run/secrets/sts.amazonaws.com/serviceaccount/token"
|
|
|
|
# - name: AWS_STS_REGIONAL_ENDPOINTS
|
|
|
|
# value: regional
|
|
|
|
# volumeMounts:
|
|
|
|
# - name: aws-token
|
|
|
|
# mountPath: "/var/run/secrets/sts.amazonaws.com/serviceaccount/"
|
|
|
|
# readOnly: true
|
|
|
|
#volumes:
|
|
|
|
#- name: aws-token
|
|
|
|
# projected:
|
|
|
|
# sources:
|
|
|
|
# - serviceAccountToken:
|
|
|
|
# path: token
|
|
|
|
# expirationSeconds: 86400
|
|
|
|
# audience: "sts.amazonaws.com"
|
|
|
|
#{{- 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
|
2021-03-19 15:15:58 +00:00
|
|
|
{{- if or .zone .nodeAffinity }}
|
2020-08-11 14:09:48 +00:00
|
|
|
nodeAffinity:
|
2021-03-19 15:15:58 +00:00
|
|
|
{{- 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 }}
|
2021-03-19 15:15:58 +00:00
|
|
|
{{- 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 }}
|
2021-08-03 11:44:38 +00:00
|
|
|
{{- with .storage.class }}
|
|
|
|
storageClassName: {{ . }}
|
|
|
|
{{- end }}
|
2020-08-11 14:09:48 +00:00
|
|
|
{{- end }}
|
|
|
|
http:
|
|
|
|
tls:
|
|
|
|
selfSignedCertificate:
|
|
|
|
disabled: true
|
|
|
|
{{- end }}
|