Skip to content

Commit

Permalink
Merge pull request #206 from yubingjiaocn/main
Browse files Browse the repository at this point in the history
feat: Add persist option for MySQL and RabbitMQ
  • Loading branch information
niallthomson authored Apr 13, 2023
2 parents 6a8ff17 + 2e486c0 commit 5e40033
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 1 deletion.
35 changes: 35 additions & 0 deletions deploy/kubernetes/charts/catalog/templates/mysql-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ spec:
secretKeyRef:
name: {{ .Values.mysql.secret.name }}
key: password
args:
- "--ignore-db-dir=lost+found"
volumeMounts:
- name: data
mountPath: /var/lib/mysql
ports:
- name: mysql
containerPort: 3306
Expand All @@ -59,4 +64,34 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.mysql.persistentVolume.enabled }}
volumeClaimTemplates:
- metadata:
name: data
{{- if .Values.mysql.persistentVolume.annotations }}
annotations:
{{ toYaml .Values.mysql.persistentVolume.annotations | indent 10 }}
{{- end }}
{{- if .Values.mysql.persistentVolume.labels }}
labels:
{{ toYaml .Values.mysql.persistentVolume.labels | indent 10 }}
{{- end }}
spec:
accessModes:
{{ toYaml .Values.mysql.persistentVolume.accessModes | indent 8 }}
resources:
requests:
storage: "{{ .Values.mysql.persistentVolume.size }}"
{{- if .Values.mysql.persistentVolume.storageClass }}
{{- if (eq "-" .Values.mysql.persistentVolume.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.mysql.persistentVolume.storageClass }}"
{{- end }}
{{- end }}
{{- else }}
volumes:
- name: data
emptyDir: {}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions deploy/kubernetes/charts/catalog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ mysql:

affinity: {}

persistentVolume:
enabled: true
annotations: {}
labels: {}
accessModes:
- ReadWriteOnce
size: 10Gi
# storageClass: gp2

securityGroups:
create: false

Expand Down
35 changes: 35 additions & 0 deletions deploy/kubernetes/charts/orders/templates/mysql-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ spec:
secretKeyRef:
name: {{ .Values.mysql.secret.name }}
key: password
args:
- "--ignore-db-dir=lost+found"
volumeMounts:
- name: data
mountPath: /var/lib/mysql
ports:
- name: mysql
containerPort: 3306
Expand All @@ -59,4 +64,34 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.mysql.persistentVolume.enabled }}
volumeClaimTemplates:
- metadata:
name: data
{{- if .Values.mysql.persistentVolume.annotations }}
annotations:
{{ toYaml .Values.mysql.persistentVolume.annotations | indent 10 }}
{{- end }}
{{- if .Values.mysql.persistentVolume.labels }}
labels:
{{ toYaml .Values.mysql.persistentVolume.labels | indent 10 }}
{{- end }}
spec:
accessModes:
{{ toYaml .Values.mysql.persistentVolume.accessModes | indent 8 }}
resources:
requests:
storage: "{{ .Values.mysql.persistentVolume.size }}"
{{- if .Values.mysql.persistentVolume.storageClass }}
{{- if (eq "-" .Values.mysql.persistentVolume.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.mysql.persistentVolume.storageClass }}"
{{- end }}
{{- end }}
{{- else }}
volumes:
- name: data
emptyDir: {}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ spec:
- name: http
containerPort: 15672
protocol: TCP
volumeMounts:
- name: data
mountPath: "/var/lib/rabbitmq/mnesia"
{{- with .Values.rabbitmq.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand All @@ -47,4 +50,35 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

{{- if .Values.rabbitmq.persistentVolume.enabled }}
volumeClaimTemplates:
- metadata:
name: data
{{- if .Values.rabbitmq.persistentVolume.annotations }}
annotations:
{{ toYaml .Values.rabbitmq.persistentVolume.annotations | indent 10 }}
{{- end }}
{{- if .Values.rabbitmq.persistentVolume.labels }}
labels:
{{ toYaml .Values.rabbitmq.persistentVolume.labels | indent 10 }}
{{- end }}
spec:
accessModes:
{{ toYaml .Values.rabbitmq.persistentVolume.accessModes | indent 8 }}
resources:
requests:
storage: "{{ .Values.rabbitmq.persistentVolume.size }}"
{{- if .Values.rabbitmq.persistentVolume.storageClass }}
{{- if (eq "-" .Values.rabbitmq.persistentVolume.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.rabbitmq.persistentVolume.storageClass }}"
{{- end }}
{{- end }}
{{- else }}
volumes:
- name: data
emptyDir: {}
{{- end }}
{{- end }}
20 changes: 19 additions & 1 deletion deploy/kubernetes/charts/orders/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,20 @@ mysql:

affinity: {}

persistentVolume:
enabled: true
annotations: {}
labels: {}
accessModes:
- ReadWriteOnce
size: 10Gi
# storageClass: gp2

rabbitmq:
create: true

address: ""

secret:
create: true
name: orders-rabbitmq
Expand All @@ -139,6 +148,15 @@ rabbitmq:

affinity: {}

persistentVolume:
enabled: true
annotations: {}
labels: {}
accessModes:
- ReadWriteOnce
size: 10Gi
# storageClass: gp2

securityGroups:
create: false

Expand Down

0 comments on commit 5e40033

Please sign in to comment.