_es.tpl 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. {{- define "es.workload" -}}
  2. workload:
  3. es:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. hostNetwork: {{ .Values.esNetwork.hostNetwork }}
  9. containers:
  10. es:
  11. enabled: true
  12. primary: true
  13. imageSelector: image
  14. securityContext:
  15. runAsUser: {{ .Values.esRunAs.user }}
  16. runAsGroup: {{ .Values.esRunAs.group }}
  17. readOnlyRootFilesystem: false
  18. env:
  19. {{/* https://www.elastic.co/guide/en/elasticsearch/reference/master/docker.html#docker-configuration-methods */}}
  20. ES_HEAP_SIZE: {{ .Values.esConfig.heapSize }}
  21. ELASTIC_PASSWORD: {{ .Values.esConfig.password }}
  22. ES_SETTING_HTTP_PORT: {{ .Values.esNetwork.httpPort }}
  23. ES_SETTING_NODE_NAME: {{ .Values.esConfig.nodeName }}
  24. ES_SETTING_DISCOVERY_TYPE: single-node
  25. ES_SETTING_XPACK_SECURITY_ENABLED: true
  26. {{/* Transport is not used on single nodes */}}
  27. ES_SETTING_XPACK_SECURITY_TRANSPORT_SSL_ENABLED: false
  28. {{ if .Values.esNetwork.certificateID }}
  29. ES_SETTING_XPACK_SECURITY_HTTP_SSL_ENABLED: true
  30. ES_SETTING_XPACK_SECURITY_HTTP_SSL_KEY: /usr/share/elasticsearch/config/certs/tls.key
  31. ES_SETTING_XPACK_SECURITY_HTTP_SSL_CERTIFICATE: /usr/share/elasticsearch/config/certs/tls.crt
  32. ES_SETTING_XPACK_SECURITY_HTTP_SSL_CERTIFICATE__AUTHORITIES: /usr/share/elasticsearch/config/certs/ca.crt
  33. {{ end }}
  34. {{ with .Values.esConfig.additionalEnvs }}
  35. envList:
  36. {{ range $env := . }}
  37. - name: {{ $env.name }}
  38. value: {{ $env.value }}
  39. {{ end }}
  40. {{ end }}
  41. probes:
  42. liveness:
  43. enabled: true
  44. type: {{ include "es.schema" . }}
  45. path: /_cluster/health?local=true
  46. port: {{ .Values.esNetwork.httpPort }}
  47. httpHeaders:
  48. Authorization: Basic {{ printf "elastic:%s" .Values.esConfig.password | b64enc }}
  49. readiness:
  50. enabled: true
  51. type: {{ include "es.schema" . }}
  52. path: /_cluster/health?local=true
  53. port: {{ .Values.esNetwork.httpPort }}
  54. httpHeaders:
  55. Authorization: Basic {{ printf "elastic:%s" .Values.esConfig.password | b64enc }}
  56. startup:
  57. enabled: true
  58. type: {{ include "es.schema" . }}
  59. path: /_cluster/health?local=true
  60. port: {{ .Values.esNetwork.httpPort }}
  61. httpHeaders:
  62. Authorization: Basic {{ printf "elastic:%s" .Values.esConfig.password | b64enc }}
  63. initContainers:
  64. {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
  65. "UID" .Values.esRunAs.user
  66. "GID" .Values.esRunAs.group
  67. "mode" "check"
  68. "type" "install") | nindent 8 }}
  69. {{/* Service */}}
  70. service:
  71. es:
  72. enabled: true
  73. primary: true
  74. type: NodePort
  75. targetSelector: es
  76. ports:
  77. http:
  78. enabled: true
  79. primary: true
  80. port: {{ .Values.esNetwork.httpPort }}
  81. nodePort: {{ .Values.esNetwork.httpPort }}
  82. targetSelector: es
  83. {{/* Persistence */}}
  84. persistence:
  85. data:
  86. enabled: true
  87. {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.esStorage.data) | nindent 4 }}
  88. targetSelector:
  89. es:
  90. es:
  91. mountPath: /usr/share/elasticsearch/data
  92. {{- if and (eq .Values.esStorage.data.type "ixVolume")
  93. (not (.Values.esStorage.data.ixVolumeConfig | default dict).aclEnable) }}
  94. 01-permissions:
  95. mountPath: /mnt/directories/data
  96. {{- end }}
  97. {{- range $idx, $storage := .Values.esStorage.additionalStorages }}
  98. {{ printf "es-%v:" (int $idx) }}
  99. enabled: true
  100. {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }}
  101. targetSelector:
  102. es:
  103. es:
  104. mountPath: {{ $storage.mountPath }}
  105. {{- if and (eq $storage.type "ixVolume") (not ($storage.ixVolumeConfig | default dict).aclEnable) }}
  106. 01-permissions:
  107. mountPath: /mnt/directories{{ $storage.mountPath }}
  108. {{- end }}
  109. {{- end }}
  110. {{- if .Values.esNetwork.certificateID }}
  111. certs:
  112. enabled: true
  113. type: secret
  114. objectName: es-cert
  115. defaultMode: "0600"
  116. items:
  117. - key: tls.key
  118. path: tls.key
  119. - key: tls.crt
  120. path: tls.crt
  121. - key: tls.crt
  122. path: ca.crt
  123. targetSelector:
  124. es:
  125. es:
  126. mountPath: /usr/share/elasticsearch/config/certs
  127. readOnly: true
  128. scaleCertificate:
  129. es-cert:
  130. enabled: true
  131. id: {{ .Values.esNetwork.certificateID }}
  132. {{- end -}}
  133. {{- end -}}