Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

elasticsearch.yaml 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. {{- if eq .Values.env.DOC_ENGINE "elasticsearch" -}}
  2. apiVersion: v1
  3. kind: PersistentVolumeClaim
  4. metadata:
  5. name: {{ include "ragflow.fullname" . }}-es-data
  6. annotations:
  7. "helm.sh/resource-policy": keep
  8. labels:
  9. {{- include "ragflow.labels" . | nindent 4 }}
  10. app.kubernetes.io/component: elasticsearch
  11. spec:
  12. {{- with .Values.elasticsearch.storage.className }}
  13. storageClassName: {{ . }}
  14. {{- end }}
  15. accessModes:
  16. - ReadWriteOnce
  17. resources:
  18. requests:
  19. storage: {{ .Values.elasticsearch.storage.capacity }}
  20. ---
  21. apiVersion: apps/v1
  22. kind: Deployment
  23. metadata:
  24. name: {{ include "ragflow.fullname" . }}-es
  25. labels:
  26. {{- include "ragflow.labels" . | nindent 4 }}
  27. app.kubernetes.io/component: elasticsearch
  28. spec:
  29. replicas: 1
  30. selector:
  31. matchLabels:
  32. {{- include "ragflow.selectorLabels" . | nindent 6 }}
  33. app.kubernetes.io/component: elasticsearch
  34. {{- with .Values.elasticsearch.deployment.strategy }}
  35. strategy:
  36. {{- . | toYaml | nindent 4 }}
  37. {{- end }}
  38. template:
  39. metadata:
  40. labels:
  41. {{- include "ragflow.labels" . | nindent 8 }}
  42. app.kubernetes.io/component: elasticsearch
  43. annotations:
  44. checksum/config-es: {{ include (print $.Template.BasePath "/elasticsearch-config.yaml") . | sha256sum }}
  45. checksum/config-env: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
  46. spec:
  47. initContainers:
  48. - name: fix-data-volume-permissions
  49. image: alpine
  50. command:
  51. - sh
  52. - -c
  53. - "chown -R 1000:0 /usr/share/elasticsearch/data"
  54. volumeMounts:
  55. - mountPath: /usr/share/elasticsearch/data
  56. name: es-data
  57. - name: sysctl
  58. image: busybox
  59. securityContext:
  60. privileged: true
  61. runAsUser: 0
  62. command: ["sysctl", "-w", "vm.max_map_count=262144"]
  63. containers:
  64. - name: elasticsearch
  65. image: elasticsearch:{{ .Values.env.STACK_VERSION }}
  66. envFrom:
  67. - secretRef:
  68. name: {{ include "ragflow.fullname" . }}-env-config
  69. - configMapRef:
  70. name: {{ include "ragflow.fullname" . }}-es-config
  71. ports:
  72. - containerPort: 9200
  73. name: http
  74. - containerPort: 9300
  75. name: transport
  76. volumeMounts:
  77. - mountPath: /usr/share/elasticsearch/data
  78. name: es-data
  79. {{- with .Values.elasticsearch.deployment.resources }}
  80. resources:
  81. {{- . | toYaml | nindent 10 }}
  82. {{- end }}
  83. securityContext:
  84. capabilities:
  85. add:
  86. - "IPC_LOCK"
  87. runAsUser: 1000
  88. # NOTE: fsGroup doesn't seem to
  89. # work so use init container instead
  90. # fsGroup: 1000
  91. allowPrivilegeEscalation: false
  92. volumes:
  93. - name: es-data
  94. persistentVolumeClaim:
  95. claimName: {{ include "ragflow.fullname" . }}-es-data
  96. ---
  97. apiVersion: v1
  98. kind: Service
  99. metadata:
  100. name: {{ include "ragflow.fullname" . }}-es
  101. labels:
  102. {{- include "ragflow.labels" . | nindent 4 }}
  103. app.kubernetes.io/component: elasticsearch
  104. spec:
  105. selector:
  106. {{- include "ragflow.selectorLabels" . | nindent 4 }}
  107. app.kubernetes.io/component: elasticsearch
  108. ports:
  109. - protocol: TCP
  110. port: 9200
  111. targetPort: http
  112. type: {{ .Values.elasticsearch.service.type }}
  113. {{- end -}}