You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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