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.

mysql.yaml 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ---
  2. apiVersion: v1
  3. kind: PersistentVolumeClaim
  4. metadata:
  5. name: {{ include "ragflow.fullname" . }}-mysql
  6. labels:
  7. {{- include "ragflow.labels" . | nindent 4 }}
  8. app.kubernetes.io/component: mysql
  9. spec:
  10. {{- with .Values.mysql.storage.className }}
  11. storageClassName: {{ . }}
  12. {{- end }}
  13. accessModes:
  14. - ReadWriteOnce
  15. resources:
  16. requests:
  17. storage: {{ .Values.mysql.storage.capacity }}
  18. ---
  19. apiVersion: apps/v1
  20. kind: Deployment
  21. metadata:
  22. name: {{ include "ragflow.fullname" . }}-mysql
  23. labels:
  24. {{- include "ragflow.labels" . | nindent 4 }}
  25. app.kubernetes.io/component: mysql
  26. spec:
  27. replicas: 1
  28. selector:
  29. matchLabels:
  30. {{- include "ragflow.selectorLabels" . | nindent 6 }}
  31. app.kubernetes.io/component: mysql
  32. {{- with .Values.mysql.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: mysql
  41. annotations:
  42. checksum/config-mysql: {{ include (print $.Template.BasePath "/mysql-config.yaml") . | sha256sum }}
  43. checksum/config-env: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
  44. spec:
  45. containers:
  46. - name: mysql
  47. image: {{ .Values.mysql.image.repository }}:{{ .Values.mysql.image.tag }}
  48. envFrom:
  49. - secretRef:
  50. name: {{ include "ragflow.fullname" . }}-env-config
  51. args:
  52. - --max_connections=1000
  53. - --character-set-server=utf8mb4
  54. - --collation-server=utf8mb4_general_ci
  55. - --default-authentication-plugin=mysql_native_password
  56. - --tls_version=TLSv1.2,TLSv1.3
  57. - --init-file=/data/application/init.sql
  58. - --disable-log-bin
  59. ports:
  60. - containerPort: 3306
  61. name: mysql
  62. {{- with .Values.mysql.deployment.resources }}
  63. resources:
  64. {{- . | toYaml | nindent 10 }}
  65. {{- end }}
  66. volumeMounts:
  67. - mountPath: /var/lib/mysql
  68. name: mysql-data
  69. - mountPath: /data/application/init.sql
  70. subPath: init.sql
  71. readOnly: true
  72. name: init-script-volume
  73. volumes:
  74. - name: mysql-data
  75. persistentVolumeClaim:
  76. claimName: {{ include "ragflow.fullname" . }}-mysql
  77. - name: init-script-volume
  78. configMap:
  79. name: mysql-init-script
  80. ---
  81. apiVersion: v1
  82. kind: Service
  83. metadata:
  84. name: {{ include "ragflow.fullname" . }}-mysql
  85. labels:
  86. {{- include "ragflow.labels" . | nindent 4 }}
  87. app.kubernetes.io/component: mysql
  88. spec:
  89. selector:
  90. {{- include "ragflow.selectorLabels" . | nindent 4 }}
  91. app.kubernetes.io/component: mysql
  92. ports:
  93. - protocol: TCP
  94. port: 3306
  95. targetPort: mysql
  96. type: {{ .Values.mysql.service.type }}