Skip to content

Commit 116d26f

Browse files
authored
chore(mysql-cluster): set persistentVolumeClaimRetentionPolicy deleted (#28)
1 parent 0ac1b1b commit 116d26f

20 files changed

Lines changed: 255 additions & 112 deletions

File tree

addons/mysql-cluster/8.0/chart/mysql-cluster/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
annotations:
22
category: Database
33
apiVersion: v2
4-
appVersion: 8.0.30
4+
appVersion: 8.0.35
55
dependencies:
66
- name: common
77
repository: oci://registry.drycc.cc/charts
@@ -25,4 +25,4 @@ name: mysql
2525
sources:
2626
- https://github.com/drycc/containers/tree/main/drycc/mysql
2727
- https://mysql.com
28-
version: 9.3.5
28+
version: 8.0.35
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{- /*
2+
Copyright Drycc Community.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
apiVersion: apps/v1
7+
kind: Deployment
8+
metadata:
9+
name: {{ include "mysql.cluster.fullname" . }}-tools
10+
namespace: {{ include "common.names.namespace" . | quote }}
11+
spec:
12+
replicas: 1
13+
selector:
14+
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
15+
app.kubernetes.io/component: mysql-cluster-tools
16+
17+
template:
18+
metadata:
19+
labels: {{- include "common.labels.standard" . | nindent 8 }}
20+
app.kubernetes.io/component: mysql-cluster-tools
21+
22+
spec:
23+
containers:
24+
- name: cluster-tools
25+
image: {{ include "cluster.image" . }}
26+
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
27+
command:
28+
- /bin/bash
29+
- -ec
30+
- |
31+
sleep infinity
32+
env:
33+
- name: MYSQL_MASTER_PORT_NUMBER
34+
value: {{ .Values.primary.service.ports.mysql | quote }}
35+
- name: MYSQL_MASTER_ROOT_USER
36+
value: "root"
37+
- name: MYSQL_ROOT_PASSWORD
38+
valueFrom:
39+
secretKeyRef:
40+
name: {{ template "mysql.secretName" . }}
41+
key: mysql-root-password

addons/mysql-cluster/8.0/chart/mysql-cluster/templates/cluster/job.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ spec:
6767
" > /tmp/slave.sql
6868
mysql -h${HOST_1} -P${MYSQL_MASTER_PORT_NUMBER} -uroot -p${MYSQL_ROOT_PASSWORD} < /tmp/slave.sql
6969
mysql -h${HOST_2} -P${MYSQL_MASTER_PORT_NUMBER} -uroot -p${MYSQL_ROOT_PASSWORD} < /tmp/slave.sql
70-
70+
mysql -h${HOST_0} -P${MYSQL_MASTER_PORT_NUMBER} -uroot -p${MYSQL_ROOT_PASSWORD} -e "GRANT ALL PRIVILEGES ON *.* TO administrator@'%' WITH GRANT OPTION;flush privileges;"
71+
7172
env:
7273
- name: DRYCC_DEBUG
7374
value: {{ ternary "true" "false" (or .Values.image.debug .Values.diagnosticMode.enabled) | quote }}

addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,11 @@ spec:
369369
- name: data
370370
emptyDir: {}
371371
{{- else if and .Values.primary.persistence.enabled (not .Values.primary.persistence.existingClaim) }}
372+
{{- if .Values.primary.persistentVolumeClaimRetentionPolicy.enabled }}
373+
persistentVolumeClaimRetentionPolicy:
374+
whenDeleted: {{ .Values.primary.persistentVolumeClaimRetentionPolicy.whenDeleted }}
375+
whenScaled: {{ .Values.primary.persistentVolumeClaimRetentionPolicy.whenScaled }}
376+
{{- end }}
372377
volumeClaimTemplates:
373378
- metadata:
374379
name: data

addons/mysql-cluster/8.0/chart/mysql-cluster/templates/secrets.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ metadata:
4646
{{- end }}
4747
type: servicebinding.io/mysql
4848
data:
49-
provider: {{ print "bitnami" | b64enc | quote }}
49+
provider: {{ print "drycc" | b64enc | quote }}
5050
type: {{ print "mysql" | b64enc | quote }}
5151
host: {{ print $host | b64enc | quote }}
5252
port: {{ print $port | b64enc | quote }}
@@ -60,7 +60,7 @@ data:
6060
apiVersion: v1
6161
kind: Secret
6262
metadata:
63-
name: {{ include "common.names.fullname" . }}-svcbind-custom-user
63+
name: {{ include "common.names.fullname" . }}-svcbind-administrator-user
6464
namespace: {{ .Release.Namespace | quote }}
6565
labels: {{- include "common.labels.standard" . | nindent 4 }}
6666
{{- if .Values.commonLabels }}

addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ auth:
113113
## @param auth.database Name for a custom database to create
114114
## ref: https://github.com/drycc/containers/tree/main/drycc/mysql#creating-a-database-on-first-run
115115
##
116-
database: "mx_database"
116+
database: "mondb"
117117
## @param auth.username Name for a custom user to create
118118
## ref: https://github.com/drycc/containers/tree/main/drycc/mysql#creating-a-database-user-on-first-run
119119
##
120-
username: "mx111"
120+
username: "administrator"
121121
## @param auth.password Password for the new user. Ignored if existing secret is provided
122122
##
123123
password: ""
@@ -127,7 +127,7 @@ auth:
127127
replicationUser: replicator
128128
## @param auth.replicationPassword MySQL replication user password. Ignored if existing secret is provided
129129
##
130-
replicationPassword: "user4_repUU"
130+
replicationPassword: ""
131131
## @param auth.existingSecret Use existing secret for password details. The secret has to contain the keys `mysql-root-password`, `mysql-replication-password` and `mysql-password`
132132
## NOTE: When it's set the auth.rootPassword, auth.password, auth.replicationPassword are ignored.
133133
##
@@ -244,6 +244,7 @@ primary:
244244
disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"
245245
sql_require_primary_key=ON
246246
log_error_suppression_list='MY-013360'
247+
binlog_transaction_dependency_tracking=WRITESET
247248
# Replication
248249
249250
log_bin=mysql-bin
@@ -473,6 +474,10 @@ primary:
473474
## Enable persistence using Persistent Volume Claims
474475
## ref: https://kubernetes.io/docs/user-guide/persistent-volumes/
475476
##
477+
persistentVolumeClaimRetentionPolicy:
478+
enabled: true
479+
whenScaled: Delete
480+
whenDeleted: Delete
476481
persistence:
477482
## @param primary.persistence.enabled Enable persistence on MySQL primary replicas using a `PersistentVolumeClaim`. If false, use emptyDir
478483
##
@@ -603,6 +608,7 @@ cluster:
603608
digest: ""
604609
pullPolicy: IfNotPresent
605610

611+
606612
router:
607613
## @param router.name Name of the router
608614
##

addons/mysql-cluster/8.0/meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ tags: mysql-cluster
1313
bindable: true
1414
instances_retrievable: true
1515
bindings_retrievable: true
16-
plan_updateable: false
16+
plan_updateable: true
1717
allow_parameters:
1818
- name: "networkPolicy.allowNamespaces"
1919
required: false
2020
description: "networkPolicy allowNamespaces config for values.yaml"
2121
- name: "router.service.type"
2222
required: false
2323
description: "service type config for values.yaml"
24-
archive: false
24+
archive: false
Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,33 @@
11
credential:
22
{{- if (eq .Values.router.service.type "LoadBalancer") }}
3-
- name: HOST
3+
- name: EXTRANET_HOST
44
valueFrom:
55
serviceRef:
66
name: {{ include "common.names.fullname" . }}
77
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
8-
{{- else if (eq .Values.router.service.type "ClusterIP") }}
8+
{{- end }}
99
- name: HOST
1010
valueFrom:
1111
serviceRef:
12-
name: {{ include "common.names.fullname" . }}
12+
name: {{ include "common.names.fullname" . }}-router
1313
jsonpath: '{ .spec.clusterIP }'
14-
{{- end }}
15-
- name: DADABASE
16-
valueFrom:
17-
secretKeyRef:
18-
name: {{ template "common.names.fullname" . }}-svcbind-custom-user
19-
jsonpath: '{ .data.database }'
2014
- name: PASSWORD
2115
valueFrom:
2216
secretKeyRef:
23-
name: {{ template "common.names.fullname" . }}-svcbind-custom-user
24-
jsonpath: '{ .data.username }'
17+
name: {{ template "common.names.fullname" . }}-svcbind-administrator-user
18+
jsonpath: '{ .data.password }'
2519
- name: USERNAME
2620
valueFrom:
2721
secretKeyRef:
28-
name: {{ template "common.names.fullname" . }}-svcbind-custom-user
22+
name: {{ template "common.names.fullname" . }}-svcbind-administrator-user
2923
jsonpath: '{ .data.username }'
3024
- name: READONLY_PORT
3125
valueFrom:
3226
secretKeyRef:
33-
name: {{ template "common.names.fullname" . }}-svcbind-custom-user
27+
name: {{ template "common.names.fullname" . }}-svcbind-administrator-user
3428
jsonpath: '{ .data.portro }'
3529
- name: READWRITE_PORT
3630
valueFrom:
3731
secretKeyRef:
38-
name: {{ template "common.names.fullname" . }}-svcbind-custom-user
32+
name: {{ template "common.names.fullname" . }}-svcbind-administrator-user
3933
jsonpath: '{ .data.portrw }'

addons/mysql-cluster/8.0/plans/standard-10/values.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ primary:
1616
resources:
1717
limits:
1818
cpu: 1000m
19-
memory: 1024Mi
19+
memory: 4Gi
2020
requests:
2121
cpu: 1000m
22-
memory: 1024Mi
23-
22+
memory: 4Gi
23+
2424

2525
## @section Persistence parameters
2626

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,33 @@
11
credential:
22
{{- if (eq .Values.router.service.type "LoadBalancer") }}
3-
- name: HOST
3+
- name: EXTRANET_HOST
44
valueFrom:
55
serviceRef:
66
name: {{ include "common.names.fullname" . }}
77
jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
8-
{{- else if (eq .Values.router.service.type "ClusterIP") }}
8+
{{- end }}
99
- name: HOST
1010
valueFrom:
1111
serviceRef:
12-
name: {{ include "common.names.fullname" . }}
12+
name: {{ include "common.names.fullname" . }}-router
1313
jsonpath: '{ .spec.clusterIP }'
14-
{{- end }}
15-
- name: DADABASE
16-
valueFrom:
17-
secretKeyRef:
18-
name: {{ template "common.names.fullname" . }}-svcbind-custom-user
19-
jsonpath: '{ .data.database }'
2014
- name: PASSWORD
2115
valueFrom:
2216
secretKeyRef:
23-
name: {{ template "common.names.fullname" . }}-svcbind-custom-user
24-
jsonpath: '{ .data.username }'
17+
name: {{ template "common.names.fullname" . }}-svcbind-administrator-user
18+
jsonpath: '{ .data.password }'
2519
- name: USERNAME
2620
valueFrom:
2721
secretKeyRef:
28-
name: {{ template "common.names.fullname" . }}-svcbind-custom-user
22+
name: {{ template "common.names.fullname" . }}-svcbind-administrator-user
2923
jsonpath: '{ .data.username }'
3024
- name: READONLY_PORT
3125
valueFrom:
3226
secretKeyRef:
33-
name: {{ template "common.names.fullname" . }}-svcbind-custom-user
27+
name: {{ template "common.names.fullname" . }}-svcbind-administrator-user
3428
jsonpath: '{ .data.portro }'
3529
- name: READWRITE_PORT
3630
valueFrom:
3731
secretKeyRef:
38-
name: {{ template "common.names.fullname" . }}-svcbind-custom-user
32+
name: {{ template "common.names.fullname" . }}-svcbind-administrator-user
3933
jsonpath: '{ .data.portrw }'

0 commit comments

Comments
 (0)