Files
charts/bitnami/elasticsearch/templates/coordinating-deploy.yaml
2021-03-08 16:24:22 +01:00

196 lines
9.1 KiB
YAML

apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "elasticsearch.coordinating.fullname" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: coordinating-only
## Istio Labels: https://istio.io/docs/ops/deployment/requirements/
app: coordinating-only
spec:
strategy:
type: {{ .Values.coordinating.updateStrategy.type }}
{{- if (eq "Recreate" .Values.coordinating.updateStrategy.type) }}
rollingUpdate: null
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: coordinating-only
replicas: {{ .Values.coordinating.replicas }}
template:
metadata:
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/component: coordinating-only
## Istio Labels: https://istio.io/docs/ops/deployment/requirements/
app: coordinating-only
{{- if .Values.coordinating.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.coordinating.podLabels "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.coordinating.podAnnotations }}
annotations: {{- toYaml . | nindent 10 }}
{{- end }}
spec:
{{- include "elasticsearch.imagePullSecrets" . | nindent 6 }}
{{- if .Values.coordinating.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.coordinating.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.coordinating.schedulerName }}
schedulerName: {{ .Values.coordinating.schedulerName }}
{{- end }}
{{- if .Values.coordinating.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.coordinating.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.coordinating.podAffinityPreset "component" "coordinating-only" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.coordinating.podAntiAffinityPreset "component" "coordinating-only" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.coordinating.nodeAffinityPreset.type "key" .Values.coordinating.nodeAffinityPreset.key "values" .Values.coordinating.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.coordinating.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.coordinating.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.coordinating.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.coordinating.tolerations "context" $) | nindent 8 }}
{{- end }}
serviceAccountName: {{ template "elasticsearch.coordinating.serviceAccountName" . }}
{{- if .Values.coordinating.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.coordinating.securityContext.fsGroup }}
{{- end }}
{{- if .Values.sysctlImage.enabled }}
## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors)
initContainers:
- name: sysctl
image: {{ include "elasticsearch.sysctl.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
command:
- /bin/bash
- -ec
- |
sysctl -w vm.max_map_count=262144 && sysctl -w fs.file-max=65536
securityContext:
privileged: true
{{- if .Values.sysctlImage.resources }}
resources: {{- toYaml .Values.sysctlImage.resources | nindent 12 }}
{{- end }}
{{- end }}
containers:
- name: elasticsearch
image: {{ include "elasticsearch.image" . }}
{{- if .Values.coordinating.securityContext.enabled }}
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
securityContext:
runAsUser: {{ .Values.coordinating.securityContext.runAsUser }}
{{- end }}
env:
- name: BITNAMI_DEBUG
value: {{ ternary "true" "false" .Values.image.debug | quote }}
- name: ELASTICSEARCH_CLUSTER_NAME
value: {{ .Values.name | quote }}
- name: ELASTICSEARCH_CLUSTER_HOSTS
value: {{ include "elasticsearch.hosts" . | quote }}
- name: ELASTICSEARCH_TOTAL_NODES
value: {{ add .Values.master.replicas .Values.data.replicas | quote }}
{{- if .Values.plugins }}
- name: ELASTICSEARCH_PLUGINS
value: {{ .Values.plugins | quote }}
{{- end }}
- name: ELASTICSEARCH_HEAP_SIZE
value: {{ .Values.coordinating.heapSize | quote }}
- name: ELASTICSEARCH_IS_DEDICATED_NODE
value: "yes"
- name: ELASTICSEARCH_NODE_TYPE
value: "coordinating"
{{- if .Values.extraEnvVars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.extraEnvVars "context" $ ) | nindent 12 }}
{{- end }}
{{- if or .Values.extraEnvVarsConfigMap .Values.extraEnvVarsSecret }}
envFrom:
{{- if .Values.extraEnvVarsConfigMap }}
- configMapRef:
name: {{ include "common.tplvalues.render" ( dict "value" .Values.extraEnvVarsConfigMap "context" $ ) }}
{{- end }}
{{- if .Values.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" ( dict "value" .Values.extraEnvVarsSecret "context" $ ) }}
{{- end }}
{{- end }}
ports:
- name: http
containerPort: 9200
- name: transport
containerPort: 9300
{{- if .Values.coordinating.livenessProbe.enabled }}
livenessProbe:
initialDelaySeconds: {{ .Values.coordinating.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.coordinating.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.coordinating.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.coordinating.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.coordinating.livenessProbe.failureThreshold }}
httpGet:
path: /_cluster/health?local=true
port: http
{{- end }}
{{- if .Values.coordinating.readinessProbe.enabled}}
readinessProbe:
initialDelaySeconds: {{ .Values.coordinating.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.coordinating.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.coordinating.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.coordinating.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.coordinating.readinessProbe.failureThreshold }}
httpGet:
path: /_cluster/health?local=true
port: http
{{- end }}
{{- if .Values.coordinating.resources }}
resources: {{- toYaml .Values.coordinating.resources | nindent 12 }}
{{- end}}
volumeMounts:
{{- if .Values.config }}
- mountPath: /opt/bitnami/elasticsearch/config/elasticsearch.yml
name: config
subPath: elasticsearch.yml
{{- end }}
- name: data
mountPath: "/bitnami/elasticsearch/data/"
{{- if .Values.extraVolumeMounts }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.initScripts }}
- name: custom-init-scripts
mountPath: /docker-entrypoint-initdb.d/init-scripts
{{- end }}
{{- if .Values.initScriptsCM }}
- name: custom-init-scripts-cm
mountPath: /docker-entrypoint-initdb.d/init-scripts-cm
{{- end }}
{{- if .Values.initScriptsSecret }}
- name: custom-init-scripts-secret
mountPath: /docker-entrypoint-initdb.d/init-scripts-secret
{{- end }}
volumes:
{{- if .Values.config }}
- name: config
configMap:
name: {{ include "common.names.fullname" . }}
{{- end }}
- name: data
emptyDir: {}
{{- if .Values.extraVolumes }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- if .Values.initScripts }}
- name: custom-init-scripts
configMap:
name: {{ template "elasticsearch.initScripts" . }}
{{- end }}
{{- if .Values.initScriptsCM }}
- name: custom-init-scripts-cm
configMap:
name: {{ template "elasticsearch.initScriptsCM" . }}
{{- end }}
{{- if .Values.initScriptsSecret }}
- name: custom-init-scripts-secret
secret:
secretName: {{ template "elasticsearch.initScriptsSecret" . }}
defaultMode: 0755
{{- end }}