_es.tpl 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. {{ range $env := . }}
  36. {{ $env.name }}: {{ $env.value }}
  37. {{ end }}
  38. {{ end }}
  39. probes:
  40. liveness:
  41. enabled: true
  42. type: {{ include "es.schema" . }}
  43. path: /_cluster/health?local=true
  44. port: {{ .Values.esNetwork.httpPort }}
  45. httpHeaders:
  46. Authorization: Basic {{ printf "elastic:%s" .Values.esConfig.password | b64enc }}
  47. readiness:
  48. enabled: true
  49. type: {{ include "es.schema" . }}
  50. path: /_cluster/health?local=true
  51. port: {{ .Values.esNetwork.httpPort }}
  52. httpHeaders:
  53. Authorization: Basic {{ printf "elastic:%s" .Values.esConfig.password | b64enc }}
  54. startup:
  55. enabled: true
  56. type: {{ include "es.schema" . }}
  57. path: /_cluster/health?local=true
  58. port: {{ .Values.esNetwork.httpPort }}
  59. httpHeaders:
  60. Authorization: Basic {{ printf "elastic:%s" .Values.esConfig.password | b64enc }}
  61. initContainers:
  62. {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
  63. "UID" .Values.esRunAs.user
  64. "GID" .Values.esRunAs.group
  65. "type" "install") | nindent 8 }}
  66. {{/* Service */}}
  67. service:
  68. es:
  69. enabled: true
  70. primary: true
  71. type: NodePort
  72. targetSelector: es
  73. ports:
  74. http:
  75. enabled: true
  76. primary: true
  77. port: {{ .Values.esNetwork.httpPort }}
  78. nodePort: {{ .Values.esNetwork.httpPort }}
  79. targetSelector: es
  80. {{/* Persistence */}}
  81. persistence:
  82. data:
  83. enabled: true
  84. type: {{ .Values.esStorage.data.type }}
  85. datasetName: {{ .Values.esStorage.data.datasetName | default "" }}
  86. hostPath: {{ .Values.esStorage.data.hostPath | default "" }}
  87. targetSelector:
  88. es:
  89. es:
  90. mountPath: /usr/share/elasticsearch/data
  91. 01-permissions:
  92. mountPath: /mnt/directories/data
  93. {{- if .Values.esNetwork.certificateID }}
  94. certs:
  95. enabled: true
  96. type: secret
  97. objectName: es-cert
  98. defaultMode: "0600"
  99. items:
  100. - key: tls.key
  101. path: tls.key
  102. - key: tls.crt
  103. path: tls.crt
  104. - key: tls.crt
  105. path: ca.crt
  106. targetSelector:
  107. es:
  108. es:
  109. mountPath: /usr/share/elasticsearch/config/certs
  110. readOnly: true
  111. scaleCertificate:
  112. es-cert:
  113. enabled: true
  114. id: {{ .Values.esNetwork.certificateID }}
  115. {{- end -}}
  116. {{- end -}}