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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. ---
  2. apiVersion: v1
  3. kind: Service
  4. metadata:
  5. name: {{ include "ragflow.fullname" . }}-redis
  6. annotations:
  7. "helm.sh/resource-policy": keep
  8. labels:
  9. {{- include "ragflow.labels" . | nindent 4 }}
  10. app.kubernetes.io/component: redis
  11. spec:
  12. ports:
  13. - port: 6379
  14. name: redis
  15. protocol: TCP
  16. clusterIP: None # Headless service for StatefulSet
  17. selector:
  18. {{- include "ragflow.selectorLabels" . | nindent 4 }}
  19. app.kubernetes.io/component: redis
  20. ---
  21. apiVersion: apps/v1
  22. kind: StatefulSet
  23. metadata:
  24. name: {{ include "ragflow.fullname" . }}-redis
  25. labels:
  26. {{- include "ragflow.labels" . | nindent 4 }}
  27. app.kubernetes.io/component: redis
  28. spec:
  29. serviceName: {{ include "ragflow.fullname" . }}-redis
  30. replicas: 1
  31. selector:
  32. matchLabels:
  33. {{- include "ragflow.selectorLabels" . | nindent 6 }}
  34. app.kubernetes.io/component: redis
  35. template:
  36. metadata:
  37. labels:
  38. {{- include "ragflow.labels" . | nindent 8 }}
  39. app.kubernetes.io/component: redis
  40. annotations:
  41. checksum/config-env: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
  42. spec:
  43. {{- if or .Values.imagePullSecrets .Values.redis.image.pullSecrets }}
  44. imagePullSecrets:
  45. {{- with .Values.imagePullSecrets }}
  46. {{- toYaml . | nindent 8 }}
  47. {{- end }}
  48. {{- with .Values.redis.image.pullSecrets }}
  49. {{- toYaml . | nindent 8 }}
  50. {{- end }}
  51. {{- end }}
  52. terminationGracePeriodSeconds: 60
  53. containers:
  54. - name: redis
  55. image: {{ .Values.redis.image.repository }}:{{ .Values.redis.image.tag }}
  56. {{- with .Values.redis.image.pullPolicy }}
  57. imagePullPolicy: {{ . }}
  58. {{- end }}
  59. command:
  60. - "sh"
  61. - "-c"
  62. - "exec redis-server --requirepass ${REDIS_PASSWORD} --maxmemory 128mb --maxmemory-policy allkeys-lru"
  63. envFrom:
  64. - secretRef:
  65. name: {{ include "ragflow.fullname" . }}-env-config
  66. ports:
  67. - containerPort: 6379
  68. name: redis
  69. {{- if .Values.redis.persistence.enabled }}
  70. volumeMounts:
  71. - name: redis-data
  72. mountPath: /data
  73. {{- end }}
  74. {{- with .Values.redis.deployment.resources }}
  75. resources:
  76. {{- . | toYaml | nindent 12 }}
  77. {{- end }}
  78. {{- if .Values.redis.persistence.enabled }}
  79. {{- with .Values.redis.persistence.retentionPolicy }}
  80. persistentVolumeClaimRetentionPolicy:
  81. {{- with .whenDeleted }}
  82. whenDeleted: {{ . }}
  83. {{- end }}
  84. {{- with .whenScaled }}
  85. whenScaled: {{ . }}
  86. {{- end }}
  87. {{- end }}
  88. volumeClaimTemplates:
  89. - metadata:
  90. name: redis-data
  91. labels:
  92. {{- include "ragflow.selectorLabels" . | nindent 10 }}
  93. app.kubernetes.io/component: redis
  94. spec:
  95. accessModes:
  96. - ReadWriteOnce
  97. {{- with .Values.redis.storage.className }}
  98. storageClassName: {{ . }}
  99. {{- end }}
  100. resources:
  101. requests:
  102. storage: {{ .Values.redis.storage.capacity }}
  103. {{- end }}
  104. ---
  105. apiVersion: v1
  106. kind: Service
  107. metadata:
  108. name: {{ include "ragflow.fullname" . }}-redis-svc
  109. labels:
  110. {{- include "ragflow.labels" . | nindent 4 }}
  111. app.kubernetes.io/component: redis
  112. spec:
  113. ports:
  114. - port: 6379
  115. targetPort: redis
  116. protocol: TCP
  117. selector:
  118. {{- include "ragflow.selectorLabels" . | nindent 4 }}
  119. app.kubernetes.io/component: redis
  120. ---
  121. apiVersion: policy/v1
  122. kind: PodDisruptionBudget
  123. metadata:
  124. name: {{ include "ragflow.fullname" . }}-redis-pdb
  125. labels:
  126. {{- include "ragflow.labels" . | nindent 4 }}
  127. app.kubernetes.io/component: redis
  128. spec:
  129. minAvailable: 1
  130. selector:
  131. matchLabels:
  132. {{- include "ragflow.selectorLabels" . | nindent 6 }}
  133. app.kubernetes.io/component: redis