_es.tpl 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. "type" "install") | nindent 8 }}
  68. {{/* Service */}}
  69. service:
  70. es:
  71. enabled: true
  72. primary: true
  73. type: NodePort
  74. targetSelector: es
  75. ports:
  76. http:
  77. enabled: true
  78. primary: true
  79. port: {{ .Values.esNetwork.httpPort }}
  80. nodePort: {{ .Values.esNetwork.httpPort }}
  81. targetSelector: es
  82. {{/* Persistence */}}
  83. persistence:
  84. data:
  85. enabled: true
  86. type: {{ .Values.esStorage.data.type }}
  87. datasetName: {{ .Values.esStorage.data.datasetName | default "" }}
  88. hostPath: {{ .Values.esStorage.data.hostPath | default "" }}
  89. targetSelector:
  90. es:
  91. es:
  92. mountPath: /usr/share/elasticsearch/data
  93. 01-permissions:
  94. mountPath: /mnt/directories/data
  95. {{- if .Values.esNetwork.certificateID }}
  96. certs:
  97. enabled: true
  98. type: secret
  99. objectName: es-cert
  100. defaultMode: "0600"
  101. items:
  102. - key: tls.key
  103. path: tls.key
  104. - key: tls.crt
  105. path: tls.crt
  106. - key: tls.crt
  107. path: ca.crt
  108. targetSelector:
  109. es:
  110. es:
  111. mountPath: /usr/share/elasticsearch/config/certs
  112. readOnly: true
  113. scaleCertificate:
  114. es-cert:
  115. enabled: true
  116. id: {{ .Values.esNetwork.certificateID }}
  117. {{- end -}}
  118. {{- end -}}