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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. ports:
  59. - containerPort: 3306
  60. name: mysql
  61. {{- with .Values.mysql.deployment.resources }}
  62. resources:
  63. {{- . | toYaml | nindent 10 }}
  64. {{- end }}
  65. volumeMounts:
  66. - mountPath: /var/lib/mysql
  67. name: mysql-data
  68. - mountPath: /data/application/init.sql
  69. subPath: init.sql
  70. readOnly: true
  71. name: init-script-volume
  72. volumes:
  73. - name: mysql-data
  74. persistentVolumeClaim:
  75. claimName: {{ include "ragflow.fullname" . }}-mysql
  76. - name: init-script-volume
  77. configMap:
  78. name: mysql-init-script
  79. ---
  80. apiVersion: v1
  81. kind: Service
  82. metadata:
  83. name: {{ include "ragflow.fullname" . }}-mysql
  84. labels:
  85. {{- include "ragflow.labels" . | nindent 4 }}
  86. app.kubernetes.io/component: mysql
  87. spec:
  88. selector:
  89. {{- include "ragflow.selectorLabels" . | nindent 4 }}
  90. app.kubernetes.io/component: mysql
  91. ports:
  92. - protocol: TCP
  93. port: 3306
  94. targetPort: mysql
  95. type: {{ .Values.mysql.service.type }}