Skip to content

Commit 104fec2

Browse files
committed
chore(mysql-cluster): persistence group_replication_group_name after greate new cluster
1 parent 65a4cba commit 104fec2

26 files changed

Lines changed: 1683 additions & 24 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
22+
.vscode/
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v2
2+
description: Drycc Common
3+
home: https://github.com/drycc/common
4+
maintainers:
5+
- email: team@drycc.cc
6+
name: Team Drycc
7+
name: common
8+
type: library
9+
version: 1.1.3
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
{{/*
2+
Copyright VMware, Inc.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{/* vim: set filetype=mustache: */}}
7+
8+
{{/*
9+
Return a soft nodeAffinity definition
10+
{{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
11+
*/}}
12+
{{- define "common.affinities.nodes.soft" -}}
13+
preferredDuringSchedulingIgnoredDuringExecution:
14+
- preference:
15+
matchExpressions:
16+
- key: {{ .key }}
17+
operator: In
18+
values:
19+
{{- range .values }}
20+
- {{ . | quote }}
21+
{{- end }}
22+
weight: 1
23+
{{- end -}}
24+
25+
{{/*
26+
Return a hard nodeAffinity definition
27+
{{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
28+
*/}}
29+
{{- define "common.affinities.nodes.hard" -}}
30+
requiredDuringSchedulingIgnoredDuringExecution:
31+
nodeSelectorTerms:
32+
- matchExpressions:
33+
- key: {{ .key }}
34+
operator: In
35+
values:
36+
{{- range .values }}
37+
- {{ . | quote }}
38+
{{- end }}
39+
{{- end -}}
40+
41+
{{/*
42+
Return a nodeAffinity definition
43+
{{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
44+
*/}}
45+
{{- define "common.affinities.nodes" -}}
46+
{{- if eq .type "soft" }}
47+
{{- include "common.affinities.nodes.soft" . -}}
48+
{{- else if eq .type "hard" }}
49+
{{- include "common.affinities.nodes.hard" . -}}
50+
{{- end -}}
51+
{{- end -}}
52+
53+
{{/*
54+
Return a topologyKey definition
55+
{{ include "common.affinities.topologyKey" (dict "topologyKey" "BAR") -}}
56+
*/}}
57+
{{- define "common.affinities.topologyKey" -}}
58+
{{ .topologyKey | default "kubernetes.io/hostname" -}}
59+
{{- end -}}
60+
61+
{{/*
62+
Return a soft podAffinity/podAntiAffinity definition
63+
{{ include "common.affinities.pods.soft" (dict "component" "FOO" "customLabels" .Values.podLabels "extraMatchLabels" .Values.extraMatchLabels "topologyKey" "BAR" "extraPodAffinityTerms" .Values.extraPodAffinityTerms "context" $) -}}
64+
*/}}
65+
{{- define "common.affinities.pods.soft" -}}
66+
{{- $component := default "" .component -}}
67+
{{- $customLabels := default (dict) .customLabels -}}
68+
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
69+
{{- $extraPodAffinityTerms := default (list) .extraPodAffinityTerms -}}
70+
preferredDuringSchedulingIgnoredDuringExecution:
71+
- podAffinityTerm:
72+
labelSelector:
73+
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" .context )) | nindent 10 }}
74+
{{- if not (empty $component) }}
75+
{{ printf "app.kubernetes.io/component: %s" $component }}
76+
{{- end }}
77+
{{- range $key, $value := $extraMatchLabels }}
78+
{{ $key }}: {{ $value | quote }}
79+
{{- end }}
80+
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
81+
weight: 1
82+
{{- range $extraPodAffinityTerms }}
83+
- podAffinityTerm:
84+
labelSelector:
85+
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" $.context )) | nindent 10 }}
86+
{{- if not (empty $component) }}
87+
{{ printf "app.kubernetes.io/component: %s" $component }}
88+
{{- end }}
89+
{{- range $key, $value := .extraMatchLabels }}
90+
{{ $key }}: {{ $value | quote }}
91+
{{- end }}
92+
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
93+
weight: {{ .weight | default 1 -}}
94+
{{- end -}}
95+
{{- end -}}
96+
97+
{{/*
98+
Return a hard podAffinity/podAntiAffinity definition
99+
{{ include "common.affinities.pods.hard" (dict "component" "FOO" "customLabels" .Values.podLabels "extraMatchLabels" .Values.extraMatchLabels "topologyKey" "BAR" "extraPodAffinityTerms" .Values.extraPodAffinityTerms "context" $) -}}
100+
*/}}
101+
{{- define "common.affinities.pods.hard" -}}
102+
{{- $component := default "" .component -}}
103+
{{- $customLabels := default (dict) .customLabels -}}
104+
{{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
105+
{{- $extraPodAffinityTerms := default (list) .extraPodAffinityTerms -}}
106+
requiredDuringSchedulingIgnoredDuringExecution:
107+
- labelSelector:
108+
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" .context )) | nindent 8 }}
109+
{{- if not (empty $component) }}
110+
{{ printf "app.kubernetes.io/component: %s" $component }}
111+
{{- end }}
112+
{{- range $key, $value := $extraMatchLabels }}
113+
{{ $key }}: {{ $value | quote }}
114+
{{- end }}
115+
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
116+
{{- range $extraPodAffinityTerms }}
117+
- labelSelector:
118+
matchLabels: {{- (include "common.labels.matchLabels" ( dict "customLabels" $customLabels "context" $.context )) | nindent 8 }}
119+
{{- if not (empty $component) }}
120+
{{ printf "app.kubernetes.io/component: %s" $component }}
121+
{{- end }}
122+
{{- range $key, $value := .extraMatchLabels }}
123+
{{ $key }}: {{ $value | quote }}
124+
{{- end }}
125+
topologyKey: {{ include "common.affinities.topologyKey" (dict "topologyKey" .topologyKey) }}
126+
{{- end -}}
127+
{{- end -}}
128+
129+
{{/*
130+
Return a podAffinity/podAntiAffinity definition
131+
{{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
132+
*/}}
133+
{{- define "common.affinities.pods" -}}
134+
{{- if eq .type "soft" }}
135+
{{- include "common.affinities.pods.soft" . -}}
136+
{{- else if eq .type "hard" }}
137+
{{- include "common.affinities.pods.hard" . -}}
138+
{{- end -}}
139+
{{- end -}}
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
{{/*
2+
Copyright VMware, Inc.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{/* vim: set filetype=mustache: */}}
7+
8+
{{/*
9+
Return the target Kubernetes version
10+
*/}}
11+
{{- define "common.capabilities.kubeVersion" -}}
12+
{{- if .Values.global }}
13+
{{- if .Values.global.kubeVersion }}
14+
{{- .Values.global.kubeVersion -}}
15+
{{- else }}
16+
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}}
17+
{{- end -}}
18+
{{- else }}
19+
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}}
20+
{{- end -}}
21+
{{- end -}}
22+
23+
{{/*
24+
Return the appropriate apiVersion for poddisruptionbudget.
25+
*/}}
26+
{{- define "common.capabilities.policy.apiVersion" -}}
27+
{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}}
28+
{{- print "policy/v1beta1" -}}
29+
{{- else -}}
30+
{{- print "policy/v1" -}}
31+
{{- end -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Return the appropriate apiVersion for networkpolicy.
36+
*/}}
37+
{{- define "common.capabilities.networkPolicy.apiVersion" -}}
38+
{{- if semverCompare "<1.7-0" (include "common.capabilities.kubeVersion" .) -}}
39+
{{- print "extensions/v1beta1" -}}
40+
{{- else -}}
41+
{{- print "networking.k8s.io/v1" -}}
42+
{{- end -}}
43+
{{- end -}}
44+
45+
{{/*
46+
Return the appropriate apiVersion for cronjob.
47+
*/}}
48+
{{- define "common.capabilities.cronjob.apiVersion" -}}
49+
{{- if semverCompare "<1.21-0" (include "common.capabilities.kubeVersion" .) -}}
50+
{{- print "batch/v1beta1" -}}
51+
{{- else -}}
52+
{{- print "batch/v1" -}}
53+
{{- end -}}
54+
{{- end -}}
55+
56+
{{/*
57+
Return the appropriate apiVersion for daemonset.
58+
*/}}
59+
{{- define "common.capabilities.daemonset.apiVersion" -}}
60+
{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
61+
{{- print "extensions/v1beta1" -}}
62+
{{- else -}}
63+
{{- print "apps/v1" -}}
64+
{{- end -}}
65+
{{- end -}}
66+
67+
{{/*
68+
Return the appropriate apiVersion for deployment.
69+
*/}}
70+
{{- define "common.capabilities.deployment.apiVersion" -}}
71+
{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
72+
{{- print "extensions/v1beta1" -}}
73+
{{- else -}}
74+
{{- print "apps/v1" -}}
75+
{{- end -}}
76+
{{- end -}}
77+
78+
{{/*
79+
Return the appropriate apiVersion for statefulset.
80+
*/}}
81+
{{- define "common.capabilities.statefulset.apiVersion" -}}
82+
{{- if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
83+
{{- print "apps/v1beta1" -}}
84+
{{- else -}}
85+
{{- print "apps/v1" -}}
86+
{{- end -}}
87+
{{- end -}}
88+
89+
{{/*
90+
Return the appropriate apiVersion for ingress.
91+
*/}}
92+
{{- define "common.capabilities.ingress.apiVersion" -}}
93+
{{- if .Values.ingress -}}
94+
{{- if .Values.ingress.apiVersion -}}
95+
{{- .Values.ingress.apiVersion -}}
96+
{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
97+
{{- print "extensions/v1beta1" -}}
98+
{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}}
99+
{{- print "networking.k8s.io/v1beta1" -}}
100+
{{- else -}}
101+
{{- print "networking.k8s.io/v1" -}}
102+
{{- end }}
103+
{{- else if semverCompare "<1.14-0" (include "common.capabilities.kubeVersion" .) -}}
104+
{{- print "extensions/v1beta1" -}}
105+
{{- else if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}}
106+
{{- print "networking.k8s.io/v1beta1" -}}
107+
{{- else -}}
108+
{{- print "networking.k8s.io/v1" -}}
109+
{{- end -}}
110+
{{- end -}}
111+
112+
{{/*
113+
Return the appropriate apiVersion for RBAC resources.
114+
*/}}
115+
{{- define "common.capabilities.rbac.apiVersion" -}}
116+
{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}}
117+
{{- print "rbac.authorization.k8s.io/v1beta1" -}}
118+
{{- else -}}
119+
{{- print "rbac.authorization.k8s.io/v1" -}}
120+
{{- end -}}
121+
{{- end -}}
122+
123+
{{/*
124+
Return the appropriate apiVersion for CRDs.
125+
*/}}
126+
{{- define "common.capabilities.crd.apiVersion" -}}
127+
{{- if semverCompare "<1.19-0" (include "common.capabilities.kubeVersion" .) -}}
128+
{{- print "apiextensions.k8s.io/v1beta1" -}}
129+
{{- else -}}
130+
{{- print "apiextensions.k8s.io/v1" -}}
131+
{{- end -}}
132+
{{- end -}}
133+
134+
{{/*
135+
Return the appropriate apiVersion for APIService.
136+
*/}}
137+
{{- define "common.capabilities.apiService.apiVersion" -}}
138+
{{- if semverCompare "<1.10-0" (include "common.capabilities.kubeVersion" .) -}}
139+
{{- print "apiregistration.k8s.io/v1beta1" -}}
140+
{{- else -}}
141+
{{- print "apiregistration.k8s.io/v1" -}}
142+
{{- end -}}
143+
{{- end -}}
144+
145+
{{/*
146+
Return the appropriate apiVersion for Horizontal Pod Autoscaler.
147+
*/}}
148+
{{- define "common.capabilities.hpa.apiVersion" -}}
149+
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .context) -}}
150+
{{- if .beta2 -}}
151+
{{- print "autoscaling/v2beta2" -}}
152+
{{- else -}}
153+
{{- print "autoscaling/v2beta1" -}}
154+
{{- end -}}
155+
{{- else -}}
156+
{{- print "autoscaling/v2" -}}
157+
{{- end -}}
158+
{{- end -}}
159+
160+
{{/*
161+
Return the appropriate apiVersion for Vertical Pod Autoscaler.
162+
*/}}
163+
{{- define "common.capabilities.vpa.apiVersion" -}}
164+
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .context) -}}
165+
{{- if .beta2 -}}
166+
{{- print "autoscaling/v2beta2" -}}
167+
{{- else -}}
168+
{{- print "autoscaling/v2beta1" -}}
169+
{{- end -}}
170+
{{- else -}}
171+
{{- print "autoscaling/v2" -}}
172+
{{- end -}}
173+
{{- end -}}
174+
175+
{{/*
176+
Returns true if the used Helm version is 3.3+.
177+
A way to check the used Helm version was not introduced until version 3.3.0 with .Capabilities.HelmVersion, which contains an additional "{}}" structure.
178+
This check is introduced as a regexMatch instead of {{ if .Capabilities.HelmVersion }} because checking for the key HelmVersion in <3.3 results in a "interface not found" error.
179+
**To be removed when the catalog's minimun Helm version is 3.3**
180+
*/}}
181+
{{- define "common.capabilities.supportsHelmVersion" -}}
182+
{{- if regexMatch "{(v[0-9])*[^}]*}}$" (.Capabilities | toString ) }}
183+
{{- true -}}
184+
{{- end -}}
185+
{{- end -}}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{{/*
2+
Copyright VMware, Inc.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{/* vim: set filetype=mustache: */}}
7+
{{/*
8+
Through error when upgrading using empty passwords values that must not be empty.
9+
10+
Usage:
11+
{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
12+
{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
13+
{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
14+
15+
Required password params:
16+
- validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
17+
- context - Context - Required. Parent context.
18+
*/}}
19+
{{- define "common.errors.upgrade.passwords.empty" -}}
20+
{{- $validationErrors := join "" .validationErrors -}}
21+
{{- if and $validationErrors .context.Release.IsUpgrade -}}
22+
{{- $errorString := "\nPASSWORDS ERROR: You must provide your current passwords when upgrading the release." -}}
23+
{{- $errorString = print $errorString "\n Note that even after reinstallation, old credentials may be needed as they may be kept in persistent volume claims." -}}
24+
{{- $errorString = print $errorString "\n Further information can be obtained at https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#credential-errors-while-upgrading-chart-releases" -}}
25+
{{- $errorString = print $errorString "\n%s" -}}
26+
{{- printf $errorString $validationErrors | fail -}}
27+
{{- end -}}
28+
{{- end -}}

0 commit comments

Comments
 (0)