From b71f147ff75b22a6aa67f13e8b9acd3bd2fc21cf Mon Sep 17 00:00:00 2001
From: EamonZhang <zhang.eamon@hotmail.com>
Date: Tue, 10 Oct 2023 17:30:38 +0800
Subject: [PATCH 01/11] chore(mysql-cluster): modify networkpolicy

---
 .../templates/networkpolicy.yaml              | 31 ++++++++---------
 .../8.0/chart/mysql-cluster/values.yaml       | 33 +++++++++----------
 2 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/networkpolicy.yaml b/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/networkpolicy.yaml
index 45a67db3..827f8311 100644
--- a/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/networkpolicy.yaml
+++ b/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/networkpolicy.yaml
@@ -23,23 +23,24 @@ spec:
   ingress:
     # Allow inbound connections
     - ports:
-        - port: {{ .Values.primary.service.ports.mysql }}
-      {{- if not .Values.networkPolicy.allowExternal }}
+      - port: {{ .Values.router.service.portrw }}
+      - port: {{ .Values.router.service.portro }}
+      {{- if and .Values.metrics.enabled }}
+      - port: {{ .Values.metrics.service.port }}
+      {{ end }} 
+      {{- if or .Values.networkPolicy.allowCurrentNamespace .Values.networkPolicy.allowNamespaces }}
       from:
-        - podSelector:
+      {{- if .Values.networkPolicy.allowCurrentNamespace }}
+        - namespaceSelector:
             matchLabels:
-              {{ template "common.names.fullname" . }}-client: "true"
-          {{- if .Values.networkPolicy.explicitNamespacesSelector }}
-          namespaceSelector:
-{{ toYaml .Values.networkPolicy.explicitNamespacesSelector | indent 12 }}
-          {{- end }}
-        - podSelector:
+              kubernetes.io/metadata.name: {{ .Release.Namespace }}
+      {{- end }}
+      {{- range $namespace := .Values.networkPolicy.allowNamespaces }}
+      {{- if $namespace }}
+        - namespaceSelector:
             matchLabels:
-            {{- include "common.labels.matchLabels" . | nindent 14 }}
+              kubernetes.io/metadata.name: {{ $namespace }}
       {{- end }}
-    {{- if .Values.metrics.enabled }}
-    # Allow prometheus scrapes
-    - ports:
-        - port: 9104
-    {{- end }}
+      {{- end }}
+  {{- end }}
 {{- end }}
diff --git a/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml b/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml
index cdbfd0a3..ebfe4ed2 100644
--- a/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml
+++ b/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml
@@ -971,28 +971,16 @@ rbac:
 networkPolicy:
   ## @param networkPolicy.enabled Enable creation of NetworkPolicy resources
   ##
-  enabled: false
+  enabled: true
   ## @param networkPolicy.allowExternal The Policy model to apply.
   ## When set to false, only pods with the correct
   ## client label will have network access to the port MySQL is listening
   ## on. When true, MySQL will accept connections from any source
   ## (with the correct destination port).
   ##
-  allowExternal: true
-  ## @param networkPolicy.explicitNamespacesSelector A Kubernetes LabelSelector to explicitly select namespaces from which ingress traffic could be allowed to MySQL
-  ## If explicitNamespacesSelector is missing or set to {}, only client Pods that are in the networkPolicy's namespace
-  ## and that match other criteria, the ones that have the good label, can reach the DB.
-  ## But sometimes, we want the DB to be accessible to clients from other namespaces, in this case, we can use this
-  ## LabelSelector to select these namespaces, note that the networkPolicy's namespace should also be explicitly added.
-  ##
-  ## Example:
-  ## explicitNamespacesSelector:
-  ##   matchLabels:
-  ##     role: frontend
-  ##   matchExpressions:
-  ##    - {key: role, operator: In, values: [frontend]}
-  ##
-  explicitNamespacesSelector: {}
+  allowCurrentNamespace: true
+  allowNamespaces: []
+  
 
 ## @section Volume Permissions parameters
 
@@ -1035,7 +1023,7 @@ volumePermissions:
 metrics:
   ## @param metrics.enabled Start a side-car prometheus exporter
   ##
-  enabled: false
+  enabled: true
   ## @param metrics.image.registry Exporter image registry
   ## @param metrics.image.repository Exporter image repository
   ## @param metrics.image.tag Exporter image tag (immutable tags are recommended)
@@ -1132,6 +1120,17 @@ metrics:
     ##    cpu: 100m
     ##    memory: 256Mi
     requests: {}
+  containerSecurityContext:
+    enabled: true
+    runAsUser: 1001
+    runAsGroup: 0
+    runAsNonRoot: true
+    allowPrivilegeEscalation: false
+    seccompProfile:
+      type: RuntimeDefault
+    capabilities:
+      drop:
+        - ALL
   ## Mysqld Prometheus exporter liveness probe
   ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
   ## @param metrics.livenessProbe.enabled Enable livenessProbe

From d30010a82334ad1a5d6345a43ff3b578e084e79a Mon Sep 17 00:00:00 2001
From: EamonZhang <zhang.eamon@hotmail.com>
Date: Tue, 10 Oct 2023 17:33:07 +0800
Subject: [PATCH 02/11] fix(prometheus): fix typo

---
 addons/prometheus/2/{plan => plans}/standard-1-2/bind.yaml        | 0
 .../2/{plan => plans}/standard-1-2/create-instance-schema.json    | 0
 addons/prometheus/2/{plan => plans}/standard-1-2/meta.yaml        | 0
 addons/prometheus/2/{plan => plans}/standard-1-2/values.yaml      | 0
 4 files changed, 0 insertions(+), 0 deletions(-)
 rename addons/prometheus/2/{plan => plans}/standard-1-2/bind.yaml (100%)
 rename addons/prometheus/2/{plan => plans}/standard-1-2/create-instance-schema.json (100%)
 rename addons/prometheus/2/{plan => plans}/standard-1-2/meta.yaml (100%)
 rename addons/prometheus/2/{plan => plans}/standard-1-2/values.yaml (100%)

diff --git a/addons/prometheus/2/plan/standard-1-2/bind.yaml b/addons/prometheus/2/plans/standard-1-2/bind.yaml
similarity index 100%
rename from addons/prometheus/2/plan/standard-1-2/bind.yaml
rename to addons/prometheus/2/plans/standard-1-2/bind.yaml
diff --git a/addons/prometheus/2/plan/standard-1-2/create-instance-schema.json b/addons/prometheus/2/plans/standard-1-2/create-instance-schema.json
similarity index 100%
rename from addons/prometheus/2/plan/standard-1-2/create-instance-schema.json
rename to addons/prometheus/2/plans/standard-1-2/create-instance-schema.json
diff --git a/addons/prometheus/2/plan/standard-1-2/meta.yaml b/addons/prometheus/2/plans/standard-1-2/meta.yaml
similarity index 100%
rename from addons/prometheus/2/plan/standard-1-2/meta.yaml
rename to addons/prometheus/2/plans/standard-1-2/meta.yaml
diff --git a/addons/prometheus/2/plan/standard-1-2/values.yaml b/addons/prometheus/2/plans/standard-1-2/values.yaml
similarity index 100%
rename from addons/prometheus/2/plan/standard-1-2/values.yaml
rename to addons/prometheus/2/plans/standard-1-2/values.yaml

From 842cb24e279faaf75683363681d3a1f83bb78071 Mon Sep 17 00:00:00 2001
From: EamonZhang <zhang.eamon@hotmail.com>
Date: Thu, 12 Oct 2023 09:41:04 +0800
Subject: [PATCH 03/11] chore(prometheus): add plans 50

---
 .../{standard-1-2 => standard-10}/bind.yaml   |  0
 .../create-instance-schema.json               |  0
 .../{standard-1-2 => standard-10}/meta.yaml   |  0
 .../{standard-1-2 => standard-10}/values.yaml |  0
 .../prometheus/2/plans/standard-50/bind.yaml  | 34 +++++++++++++++++++
 .../standard-50/create-instance-schema.json   | 12 +++++++
 .../prometheus/2/plans/standard-50/meta.yaml  |  6 ++++
 .../2/plans/standard-50/values.yaml           |  7 ++++
 8 files changed, 59 insertions(+)
 rename addons/prometheus/2/plans/{standard-1-2 => standard-10}/bind.yaml (100%)
 rename addons/prometheus/2/plans/{standard-1-2 => standard-10}/create-instance-schema.json (100%)
 rename addons/prometheus/2/plans/{standard-1-2 => standard-10}/meta.yaml (100%)
 rename addons/prometheus/2/plans/{standard-1-2 => standard-10}/values.yaml (100%)
 create mode 100644 addons/prometheus/2/plans/standard-50/bind.yaml
 create mode 100644 addons/prometheus/2/plans/standard-50/create-instance-schema.json
 create mode 100644 addons/prometheus/2/plans/standard-50/meta.yaml
 create mode 100644 addons/prometheus/2/plans/standard-50/values.yaml

diff --git a/addons/prometheus/2/plans/standard-1-2/bind.yaml b/addons/prometheus/2/plans/standard-10/bind.yaml
similarity index 100%
rename from addons/prometheus/2/plans/standard-1-2/bind.yaml
rename to addons/prometheus/2/plans/standard-10/bind.yaml
diff --git a/addons/prometheus/2/plans/standard-1-2/create-instance-schema.json b/addons/prometheus/2/plans/standard-10/create-instance-schema.json
similarity index 100%
rename from addons/prometheus/2/plans/standard-1-2/create-instance-schema.json
rename to addons/prometheus/2/plans/standard-10/create-instance-schema.json
diff --git a/addons/prometheus/2/plans/standard-1-2/meta.yaml b/addons/prometheus/2/plans/standard-10/meta.yaml
similarity index 100%
rename from addons/prometheus/2/plans/standard-1-2/meta.yaml
rename to addons/prometheus/2/plans/standard-10/meta.yaml
diff --git a/addons/prometheus/2/plans/standard-1-2/values.yaml b/addons/prometheus/2/plans/standard-10/values.yaml
similarity index 100%
rename from addons/prometheus/2/plans/standard-1-2/values.yaml
rename to addons/prometheus/2/plans/standard-10/values.yaml
diff --git a/addons/prometheus/2/plans/standard-50/bind.yaml b/addons/prometheus/2/plans/standard-50/bind.yaml
new file mode 100644
index 00000000..5ee819d9
--- /dev/null
+++ b/addons/prometheus/2/plans/standard-50/bind.yaml
@@ -0,0 +1,34 @@
+credential:
+  {{- if (eq .Values.router.service.type "LoadBalancer") }}
+  - name: host
+    valueFrom:
+      serviceRef:
+        name: {{ printf "%s-router" (include "common.names.fullname" .) }}
+        jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
+  - name: database
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.database }' 
+  - name: password
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: username
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: portrw
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portrw }' 
+  - name: portro
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portro }' 
+  {{- end }}
+
diff --git a/addons/prometheus/2/plans/standard-50/create-instance-schema.json b/addons/prometheus/2/plans/standard-50/create-instance-schema.json
new file mode 100644
index 00000000..66ebbaa0
--- /dev/null
+++ b/addons/prometheus/2/plans/standard-50/create-instance-schema.json
@@ -0,0 +1,12 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "type": "object",
+  "properties": {
+    "imagePullPolicy": {
+      "type": "string",
+      "enum": ["Always", "IfNotPresent", "Never"],
+      "default": "IfNotPresent",
+      "title": "Image pull policy"
+    }
+  }
+}
\ No newline at end of file
diff --git a/addons/prometheus/2/plans/standard-50/meta.yaml b/addons/prometheus/2/plans/standard-50/meta.yaml
new file mode 100644
index 00000000..0baaf0f9
--- /dev/null
+++ b/addons/prometheus/2/plans/standard-50/meta.yaml
@@ -0,0 +1,6 @@
+name: "standard-50"
+id: eb7b3f73-dd94-4d05-8a48-63e7775f534d
+description: "Prometheus Cluster standard-50 plan persistence size 50Gi."
+displayName: "50Gi"
+bindable: true
+maximum_polling_duration: 1800
diff --git a/addons/prometheus/2/plans/standard-50/values.yaml b/addons/prometheus/2/plans/standard-50/values.yaml
new file mode 100644
index 00000000..0dc80c4f
--- /dev/null
+++ b/addons/prometheus/2/plans/standard-50/values.yaml
@@ -0,0 +1,7 @@
+## @param fullnameOverride String to fully override common.names.fullname template
+##
+fullnameOverride: hb-prometheus-standard-50
+
+server:
+  persistence:
+    size: 50Gi
\ No newline at end of file

From 4155cdf4f1a0cd6eb8df499fd79f57ff7ef5dd61 Mon Sep 17 00:00:00 2001
From: EamonZhang <zhang.eamon@hotmail.com>
Date: Mon, 16 Oct 2023 14:16:44 +0800
Subject: [PATCH 04/11] chore(mysql-cluster): add networkpolicy

---
 .../chart/mysql-cluster/templates/networkpolicy.yaml   |  1 +
 .../mysql-cluster/templates/primary/statefulset.yaml   |  2 +-
 .../mysql-cluster/8.0/chart/mysql-cluster/values.yaml  | 10 +++++-----
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/networkpolicy.yaml b/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/networkpolicy.yaml
index 827f8311..74013298 100644
--- a/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/networkpolicy.yaml
+++ b/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/networkpolicy.yaml
@@ -25,6 +25,7 @@ spec:
     - ports:
       - port: {{ .Values.router.service.portrw }}
       - port: {{ .Values.router.service.portro }}
+      - port: 24901
       {{- if and .Values.metrics.enabled }}
       - port: {{ .Values.metrics.service.port }}
       {{ end }} 
diff --git a/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml b/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml
index 79694e68..56b3ec79 100644
--- a/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml
+++ b/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml
@@ -298,7 +298,7 @@ spec:
               if [[ -f "${MYSQL_ROOT_PASSWORD_FILE:-}" ]]; then
                   password_aux=$(cat "$MYSQL_ROOT_PASSWORD_FILE")
               fi
-              MYSQLD_EXPORTER_PASSWORD=${password_aux} /bin/mysqld_exporter --mysqld.address=localhost:3306 --mysqld.username=root {{- range .Values.metrics.extraArgs.primary }} {{ . }} {{- end }}
+              MYSQLD_EXPORTER_PASSWORD=${password_aux} /opt/drycc/mysqld_exporter/bin/mysqld_exporter --mysqld.address=localhost:3306 --mysqld.username=root {{- range .Values.metrics.extraArgs.primary }} {{ . }} {{- end }}
           {{- end }}
           ports:
             - name: metrics
diff --git a/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml b/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml
index ebfe4ed2..9d5e4293 100644
--- a/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml
+++ b/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml
@@ -971,7 +971,7 @@ rbac:
 networkPolicy:
   ## @param networkPolicy.enabled Enable creation of NetworkPolicy resources
   ##
-  enabled: true
+  enabled: true 
   ## @param networkPolicy.allowExternal The Policy model to apply.
   ## When set to false, only pods with the correct
   ## client label will have network access to the port MySQL is listening
@@ -1023,7 +1023,7 @@ volumePermissions:
 metrics:
   ## @param metrics.enabled Start a side-car prometheus exporter
   ##
-  enabled: true
+  enabled: true 
   ## @param metrics.image.registry Exporter image registry
   ## @param metrics.image.repository Exporter image repository
   ## @param metrics.image.tag Exporter image tag (immutable tags are recommended)
@@ -1032,9 +1032,9 @@ metrics:
   ## @param metrics.image.pullSecrets Specify docker-registry secret names as an array
   ##
   image:
-    registry: docker.io
-    repository: drycc/mysqld-exporter
-    tag: 0.14.0-debian-11-r45
+    registry: registry.drycc.cc
+    repository: drycc-addons/mysqld-exporter
+    tag: 0
     digest: ""
     pullPolicy: IfNotPresent
     ## Optionally specify an array of imagePullSecrets.

From f333fe78dd171a94c34f4d75e93a23cd2fc52cdf Mon Sep 17 00:00:00 2001
From: EamonZhang <zhang.eamon@hotmail.com>
Date: Mon, 16 Oct 2023 15:03:23 +0800
Subject: [PATCH 05/11] chore(prometheus): add networkpolicy

---
 .../2/chart/prometheus/templates/bind.yaml    | 34 ++++++++++++++
 .../prometheus/templates/networkpolicy.yaml   | 47 +++++++++++++++++++
 .../prometheus/2/chart/prometheus/values.yaml | 18 ++++++-
 .../prometheus/2/plans/standard-10/bind.yaml  | 42 +++++++----------
 .../prometheus/2/plans/standard-50/bind.yaml  |  4 +-
 5 files changed, 117 insertions(+), 28 deletions(-)
 create mode 100644 addons/prometheus/2/chart/prometheus/templates/bind.yaml
 create mode 100644 addons/prometheus/2/chart/prometheus/templates/networkpolicy.yaml

diff --git a/addons/prometheus/2/chart/prometheus/templates/bind.yaml b/addons/prometheus/2/chart/prometheus/templates/bind.yaml
new file mode 100644
index 00000000..8528bf3e
--- /dev/null
+++ b/addons/prometheus/2/chart/prometheus/templates/bind.yaml
@@ -0,0 +1,34 @@
+credential:
+  {{- if (eq .Values.server.service.type "LoadBalancer") }}
+  - name: host
+    valueFrom:
+      serviceRef:
+        name: {{ printf "%s" (include "common.names.fullname" .) }}
+        jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
+  - name: database
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.database }' 
+  - name: password
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: username
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: portrw
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portrw }' 
+  - name: portro
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portro }' 
+  {{- end }}
+
diff --git a/addons/prometheus/2/chart/prometheus/templates/networkpolicy.yaml b/addons/prometheus/2/chart/prometheus/templates/networkpolicy.yaml
new file mode 100644
index 00000000..1ef0125d
--- /dev/null
+++ b/addons/prometheus/2/chart/prometheus/templates/networkpolicy.yaml
@@ -0,0 +1,47 @@
+{{- /*
+Copyright VMware, Inc.
+SPDX-License-Identifier: APACHE-2.0
+*/}}
+
+{{- if .Values.networkPolicy.enabled }}
+kind: NetworkPolicy
+apiVersion: {{ template "common.capabilities.networkPolicy.apiVersion" . }}
+metadata:
+  name: {{ template "common.names.fullname" . }}
+  namespace: {{ include "common.names.namespace" . | quote }}
+  labels: {{- include "common.labels.standard" . | nindent 4 }}
+    {{- if .Values.commonLabels }}
+    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
+    {{- end }}
+  {{- if .Values.commonAnnotations }}
+  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
+  {{- end }}
+spec:
+  podSelector:
+    matchLabels:
+      {{- include "common.labels.matchLabels" . | nindent 6 }}
+  ingress:
+    # Allow inbound connections
+    - ports:
+      - port: {{ .Values.alertmanager.service.ports.http }} 
+      - port: {{ .Values.alertmanager.service.ports.cluster }} 
+      - port: {{ .Values.alertmanager.containerPorts.http }} 
+      - port: {{ .Values.alertmanager.containerPorts.cluster }} 
+      - port: {{ .Values.server.containerPorts.http }}
+      - port: {{ .Values.server.service.ports.http }}
+      {{- if or .Values.networkPolicy.allowCurrentNamespace .Values.networkPolicy.allowNamespaces }}
+      from:
+      {{- if .Values.networkPolicy.allowCurrentNamespace }}
+        - namespaceSelector:
+            matchLabels:
+              kubernetes.io/metadata.name: {{ .Release.Namespace }}
+      {{- end }}
+      {{- range $namespace := .Values.networkPolicy.allowNamespaces }}
+      {{- if $namespace }}
+        - namespaceSelector:
+            matchLabels:
+              kubernetes.io/metadata.name: {{ $namespace }}
+      {{- end }}
+      {{- end }}
+  {{- end }}
+{{- end }}
diff --git a/addons/prometheus/2/chart/prometheus/values.yaml b/addons/prometheus/2/chart/prometheus/values.yaml
index 5d24a56a..206aeabe 100644
--- a/addons/prometheus/2/chart/prometheus/values.yaml
+++ b/addons/prometheus/2/chart/prometheus/values.yaml
@@ -360,7 +360,7 @@ alertmanager:
   ingress:
     ## @param alertmanager.ingress.enabled Enable ingress record generation for Alertmanager
     ##
-    enabled: false
+    enabled: true
     ## @param alertmanager.ingress.pathType Ingress path type
     ##
     pathType: ImplementationSpecific
@@ -1225,7 +1225,7 @@ server:
   ingress:
     ## @param server.ingress.enabled Enable ingress record generation for Prometheus
     ##
-    enabled: false
+    enabled: true
     ## @param server.ingress.pathType Ingress path type
     ##
     pathType: ImplementationSpecific
@@ -1460,6 +1460,20 @@ server:
     ##
     rules: []
 
+## Prometheus Nework Policy configuration
+##
+networkPolicy:
+  ## @param networkPolicy.enabled Enable creation of NetworkPolicy resources
+  ##
+  enabled: true
+  ## @param networkPolicy.allowExternal The Policy model to apply.
+  ## When set to false, only pods with the correct
+  ## client label will have network access to the port MySQL is listening
+  ## on. When true, MySQL will accept connections from any source
+  ## (with the correct destination port).
+  ##
+  allowCurrentNamespace: true
+  allowNamespaces: []
 ## @section Init Container Parameters
 ##
 
diff --git a/addons/prometheus/2/plans/standard-10/bind.yaml b/addons/prometheus/2/plans/standard-10/bind.yaml
index 5ee819d9..c6efaaba 100644
--- a/addons/prometheus/2/plans/standard-10/bind.yaml
+++ b/addons/prometheus/2/plans/standard-10/bind.yaml
@@ -1,34 +1,28 @@
 credential:
-  {{- if (eq .Values.router.service.type "LoadBalancer") }}
+  {{- if (eq .Values.server.service.type "LoadBalancer") }}
   - name: host
     valueFrom:
       serviceRef:
-        name: {{ printf "%s-router" (include "common.names.fullname" .) }}
+        name: {{ printf "%s" (include "common.names.fullname" .) }}
         jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
-  - name: database
+  - name: port
     valueFrom:
       secretKeyRef:
-        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
-        jsonpath: '{ .data.database }' 
-  - name: password
-    valueFrom:
-      secretKeyRef:
-        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
-        jsonpath: '{ .data.username }' 
-  - name: username
-    valueFrom:
-      secretKeyRef:
-        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
-        jsonpath: '{ .data.username }' 
-  - name: portrw
+        name: {{ template "common.names.fullname" . }}
+        jsonpath: '{ .spec.ports.port }' 
+  {{- end }}
+
+alertmanager
+
+  {{- if (eq .Values.alertmanager.service.type "LoadBalancer") }}
+  - name: host
     valueFrom:
-      secretKeyRef:
-        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
-        jsonpath: '{ .data.portrw }' 
-  - name: portro
+      serviceRef:
+        name: {{ printf "%s" (include "common.names.fullname" .) }}
+        jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
+  - name: port
     valueFrom:
       secretKeyRef:
-        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
-        jsonpath: '{ .data.portro }' 
-  {{- end }}
-
+        name: {{ template "common.names.fullname" . }}
+        jsonpath: '{ .spec.ports.port }' 
+  {{- end }}
\ No newline at end of file
diff --git a/addons/prometheus/2/plans/standard-50/bind.yaml b/addons/prometheus/2/plans/standard-50/bind.yaml
index 5ee819d9..3e652f1c 100644
--- a/addons/prometheus/2/plans/standard-50/bind.yaml
+++ b/addons/prometheus/2/plans/standard-50/bind.yaml
@@ -1,9 +1,9 @@
 credential:
-  {{- if (eq .Values.router.service.type "LoadBalancer") }}
+  {{- if (eq .Values.service.type "LoadBalancer") }}
   - name: host
     valueFrom:
       serviceRef:
-        name: {{ printf "%s-router" (include "common.names.fullname" .) }}
+        name: {{ printf "%s" (include "common.names.fullname" .) }}
         jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
   - name: database
     valueFrom:

From 14de943df62001dd7fdfc2373671c5162c69e9de Mon Sep 17 00:00:00 2001
From: EamonZhang <zhang.eamon@hotmail.com>
Date: Wed, 18 Oct 2023 14:57:47 +0800
Subject: [PATCH 06/11] chore(promtheus): service discovery in namespace

---
 .../prometheus/templates/_scrape_config.tpl   |  3 +-
 .../2/chart/prometheus/templates/bind.yaml    | 34 -----------
 .../prometheus/2/chart/prometheus/values.yaml | 57 +++++++++++++++++--
 3 files changed, 54 insertions(+), 40 deletions(-)
 delete mode 100644 addons/prometheus/2/chart/prometheus/templates/bind.yaml

diff --git a/addons/prometheus/2/chart/prometheus/templates/_scrape_config.tpl b/addons/prometheus/2/chart/prometheus/templates/_scrape_config.tpl
index ea669ead..7fb0e110 100644
--- a/addons/prometheus/2/chart/prometheus/templates/_scrape_config.tpl
+++ b/addons/prometheus/2/chart/prometheus/templates/_scrape_config.tpl
@@ -12,6 +12,7 @@ Usage:
 kubernetes_sd_configs:
   - role: endpoints
     namespaces:
+      own_namespace: true
       names:
       - {{ include "common.names.namespace" .context }}
 metrics_path: /metrics
@@ -83,4 +84,4 @@ relabel_configs:
       - __tmp_hash
     regex: 0
     action: keep
-{{- end -}}
\ No newline at end of file
+{{- end -}}
diff --git a/addons/prometheus/2/chart/prometheus/templates/bind.yaml b/addons/prometheus/2/chart/prometheus/templates/bind.yaml
deleted file mode 100644
index 8528bf3e..00000000
--- a/addons/prometheus/2/chart/prometheus/templates/bind.yaml
+++ /dev/null
@@ -1,34 +0,0 @@
-credential:
-  {{- if (eq .Values.server.service.type "LoadBalancer") }}
-  - name: host
-    valueFrom:
-      serviceRef:
-        name: {{ printf "%s" (include "common.names.fullname" .) }}
-        jsonpath: '{ .status.loadBalancer.ingress[*].ip }'
-  - name: database
-    valueFrom:
-      secretKeyRef:
-        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
-        jsonpath: '{ .data.database }' 
-  - name: password
-    valueFrom:
-      secretKeyRef:
-        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
-        jsonpath: '{ .data.username }' 
-  - name: username
-    valueFrom:
-      secretKeyRef:
-        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
-        jsonpath: '{ .data.username }' 
-  - name: portrw
-    valueFrom:
-      secretKeyRef:
-        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
-        jsonpath: '{ .data.portrw }' 
-  - name: portro
-    valueFrom:
-      secretKeyRef:
-        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
-        jsonpath: '{ .data.portro }' 
-  {{- end }}
-
diff --git a/addons/prometheus/2/chart/prometheus/values.yaml b/addons/prometheus/2/chart/prometheus/values.yaml
index 206aeabe..a551fa68 100644
--- a/addons/prometheus/2/chart/prometheus/values.yaml
+++ b/addons/prometheus/2/chart/prometheus/values.yaml
@@ -628,6 +628,9 @@ server:
     {{- if .Values.server.extraScrapeConfigs}}
     {{- include "common.tplvalues.render" (dict "value" .Values.server.extraScrapeConfigs "context" $) | nindent 2 }}
     {{- end }}
+    {{- if .Values.server.dsScrapeConfigs}}
+    {{- include "common.tplvalues.render" (dict "value" .Values.server.dsScrapeConfigs "context" $) | nindent 2 }}
+    {{- end }}
     {{- if or .Values.alertmanager.enabled .Values.server.alertingEndpoints}}
     alerting:
       alertmanagers:
@@ -649,7 +652,50 @@ server:
   ## @param server.extraScrapeConfigs Promethus configuration, useful to declare new scrape_configs. This content will be merged with the 'server.configuration' value and stored in the the prometheus.yaml file.
   ## ref: <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config>
   ##
-  extraScrapeConfigs: []
+  extraScrapeConfigs: [] 
+  dsScrapeConfigs: 
+      - job_name: 'service-endpoints'
+        honor_labels: true
+        kubernetes_sd_configs:
+          - role: endpoints
+            namespaces:
+              own_namespace: true
+              names:
+                - default
+        relabel_configs:
+          - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]
+            action: keep
+            regex: true
+          - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape_slow]
+            action: drop
+            regex: true
+          - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]
+            action: replace
+            target_label: __scheme__
+            regex: (https?)
+          - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path]
+            action: replace
+            target_label: __metrics_path__
+            regex: (.+)
+          - source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port]
+            action: replace
+            target_label: __address__
+            regex: (.+?)(?::\d+)?;(\d+)
+            replacement: $1:$2
+          - action: labelmap
+            regex: __meta_kubernetes_service_annotation_prometheus_io_param_(.+)
+            replacement: __param_$1
+          - action: labelmap
+            regex: __meta_kubernetes_service_label_(.+)
+          - source_labels: [__meta_kubernetes_namespace]
+            action: replace
+            target_label: namespace
+          - source_labels: [__meta_kubernetes_service_name]
+            action: replace
+            target_label: service
+          - source_labels: [__meta_kubernetes_pod_node_name]
+            action: replace
+            target_label: node
   ## @param server.replicaCount Number of Prometheus replicas to deploy
   ##
   replicaCount: 1
@@ -824,7 +870,7 @@ server:
     ## StrategyType
     ## Can be set to RollingUpdate or Recreate
     ##
-    type: RollingUpdate
+    type: Recreate 
 
   ## @param server.priorityClassName Prometheus pods' priorityClassName
   ##
@@ -1465,7 +1511,7 @@ server:
 networkPolicy:
   ## @param networkPolicy.enabled Enable creation of NetworkPolicy resources
   ##
-  enabled: true
+  enabled: true 
   ## @param networkPolicy.allowExternal The Policy model to apply.
   ## When set to false, only pods with the correct
   ## client label will have network access to the port MySQL is listening
@@ -1473,7 +1519,8 @@ networkPolicy:
   ## (with the correct destination port).
   ##
   allowCurrentNamespace: true
-  allowNamespaces: []
+  allowNamespaces: 
+    - traefik
 ## @section Init Container Parameters
 ##
 
@@ -1521,4 +1568,4 @@ volumePermissions:
   ##   "auto" is especially useful for OpenShift which has scc with dynamic user ids (and 0 is not allowed)
   ##
   containerSecurityContext:
-    runAsUser: 0
\ No newline at end of file
+    runAsUser: 0

From 58ce2cb1700478e79b045cad88a8fe1b238a2cdf Mon Sep 17 00:00:00 2001
From: EamonZhang <zhang.eamon@hotmail.com>
Date: Wed, 25 Oct 2023 11:49:13 +0800
Subject: [PATCH 07/11] chore(mysql-cluster): plans 10

---
 .../templates/primary/statefulset.yaml           |  4 ++++
 .../8.0/chart/mysql-cluster/values.yaml          |  8 ++++++--
 .../8.0/plans/standard-10/values.yaml            | 16 +++++++++-------
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml b/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml
index 56b3ec79..49b8c703 100644
--- a/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml
+++ b/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml
@@ -156,6 +156,10 @@ spec:
             - name: MYSQL_DATABASE
               value: {{ .Values.auth.database | quote }}
             {{- end }}
+            {{- if and .Values.auth.createDatabase .Values.auth.database }}
+            - name: MAX_CONNECTION_LIMIT
+              value: {{ .Values.maxConnectionLimit | quote }}
+            {{- end }}
             {{- if or (eq .Values.architecture "replication") (eq .Values.architecture "mgr") }}
             - name: MYSQL_REPLICATION_MODE
               value: "master"
diff --git a/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml b/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml
index 9d5e4293..3199eede 100644
--- a/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml
+++ b/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml
@@ -149,7 +149,7 @@ auth:
 ## initdbScripts:
 ##   my_init_script.sh: |
 ##      #!/bin/bash
-##      echo "Do something."
+##      echo "Do something." 
 ##
 initdbScripts: 
   int-mysql.sh: |
@@ -181,6 +181,8 @@ initdbScripts:
     echo loose-group_replication_group_seeds="$svc_mgr_host-0.$svc_mgr_host:24901,$svc_mgr_host-1.$svc_mgr_host:24901,$svc_mgr_host-2.$svc_mgr_host:24901" >> $base_conf_file 
 
     echo plugin_load_add='group_replication.so' >> $base_conf_file
+      
+    echo max_connections=$MAX_CONNECTION_LIMIT
 
 ## @param initdbScriptsConfigMap ConfigMap with the initdb scripts (Note: Overrides `initdbScripts`)
 ##
@@ -211,10 +213,12 @@ primary:
   ## @param primary.configuration [string] Configure MySQL Primary with a custom my.cnf file
   ## ref: https://mysql.com/kb/en/mysql/configuring-mysql-with-mycnf/#example-of-configuration-file
   ##
+  maxConnectionLimit: 2000
+  
   configuration: |-
     [mysqld]
     # server
-    max_connections=500
+    max_connections=10000
     default_authentication_plugin=caching_sha2_password
     skip-name-resolve
     relay-log=relay-log
diff --git a/addons/mysql-cluster/8.0/plans/standard-10/values.yaml b/addons/mysql-cluster/8.0/plans/standard-10/values.yaml
index baca4920..e8d14da0 100644
--- a/addons/mysql-cluster/8.0/plans/standard-10/values.yaml
+++ b/addons/mysql-cluster/8.0/plans/standard-10/values.yaml
@@ -11,13 +11,15 @@ fullnameOverride: hb-mysql-cluster-standard-10
 ## @param resources.limits The resources limits for the MinIO&reg; container
 ## @param resources.requests The requested resources for the MinIO&reg; container
 ##
-resources:
-  limits:
-    cpu: 1000m
-    memory: 1024Mi
-  requests:
-    cpu: 100m
-    memory: 512Mi
+primary: 
+  resources:
+    limits:
+      cpu: 1000m
+      memory: 1024Mi
+    requests:
+      cpu: 100m
+      memory: 512Mi
+      
 
 ## @section Persistence parameters
 

From 7c93cee8b35b03477f674658fdd6ed9f88ddbb62 Mon Sep 17 00:00:00 2001
From: EamonZhang <zhang.eamon@hotmail.com>
Date: Wed, 25 Oct 2023 15:11:19 +0800
Subject: [PATCH 08/11] chore(mysql-cluster): add max_connection_limit

---
 .../chart/mysql-cluster/templates/primary/statefulset.yaml   | 5 +++--
 addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml     | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml b/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml
index 49b8c703..24d81878 100644
--- a/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml
+++ b/addons/mysql-cluster/8.0/chart/mysql-cluster/templates/primary/statefulset.yaml
@@ -156,9 +156,9 @@ spec:
             - name: MYSQL_DATABASE
               value: {{ .Values.auth.database | quote }}
             {{- end }}
-            {{- if and .Values.auth.createDatabase .Values.auth.database }}
+            {{- if .Values.primary.maxConnectionLimit }}
             - name: MAX_CONNECTION_LIMIT
-              value: {{ .Values.maxConnectionLimit | quote }}
+              value: {{ .Values.primary.maxConnectionLimit | quote }}
             {{- end }}
             {{- if or (eq .Values.architecture "replication") (eq .Values.architecture "mgr") }}
             - name: MYSQL_REPLICATION_MODE
@@ -397,3 +397,4 @@ spec:
         selector: {{- include "common.tplvalues.render" (dict "value" .Values.primary.persistence.selector "context" $) | nindent 10 }}
         {{- end -}}
   {{- end }}
+
diff --git a/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml b/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml
index 3199eede..a33e364c 100644
--- a/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml
+++ b/addons/mysql-cluster/8.0/chart/mysql-cluster/values.yaml
@@ -182,7 +182,7 @@ initdbScripts:
 
     echo plugin_load_add='group_replication.so' >> $base_conf_file
       
-    echo max_connections=$MAX_CONNECTION_LIMIT
+    echo max_connections=$MAX_CONNECTION_LIMIT >> $base_conf_file
 
 ## @param initdbScriptsConfigMap ConfigMap with the initdb scripts (Note: Overrides `initdbScripts`)
 ##

From ae4809d6a88a8f4c9949139b7fa9a169fc1d7553 Mon Sep 17 00:00:00 2001
From: EamonZhang <zhang.eamon@hotmail.com>
Date: Wed, 25 Oct 2023 16:06:56 +0800
Subject: [PATCH 09/11] chore(mysql-cluster): add plans

---
 .../8.0/plans/standard-10/bind.yaml           |  9 ++-
 .../8.0/plans/standard-10/meta.yaml           |  2 +-
 .../8.0/plans/standard-10/values.yaml         |  7 ++-
 .../8.0/plans/standard-100/bind.yaml          | 34 +++++++++++
 .../standard-100/create-instance-schema.json  | 12 ++++
 .../8.0/plans/standard-100/meta.yaml          |  6 ++
 .../8.0/plans/standard-100/values.yaml        | 61 +++++++++++++++++++
 .../8.0/plans/standard-20/bind.yaml           | 34 +++++++++++
 .../standard-20/create-instance-schema.json   | 12 ++++
 .../8.0/plans/standard-20/meta.yaml           |  6 ++
 .../8.0/plans/standard-20/values.yaml         | 61 +++++++++++++++++++
 .../8.0/plans/standard-200/bind.yaml          | 34 +++++++++++
 .../standard-200/create-instance-schema.json  | 12 ++++
 .../8.0/plans/standard-200/meta.yaml          |  6 ++
 .../8.0/plans/standard-200/values.yaml        | 61 +++++++++++++++++++
 .../8.0/plans/standard-400/bind.yaml          | 34 +++++++++++
 .../standard-400/create-instance-schema.json  | 12 ++++
 .../8.0/plans/standard-400/meta.yaml          |  6 ++
 .../8.0/plans/standard-400/values.yaml        | 61 +++++++++++++++++++
 .../8.0/plans/standard-50/bind.yaml           | 34 +++++++++++
 .../standard-50/create-instance-schema.json   | 12 ++++
 .../8.0/plans/standard-50/meta.yaml           |  6 ++
 .../8.0/plans/standard-50/values.yaml         | 60 ++++++++++++++++++
 .../8.0/plans/standard-800/bind.yaml          | 34 +++++++++++
 .../standard-800/create-instance-schema.json  | 12 ++++
 .../8.0/plans/standard-800/meta.yaml          |  6 ++
 .../8.0/plans/standard-800/values.yaml        | 61 +++++++++++++++++++
 27 files changed, 689 insertions(+), 6 deletions(-)
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-100/bind.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-100/create-instance-schema.json
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-100/meta.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-100/values.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-20/bind.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-20/create-instance-schema.json
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-20/meta.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-20/values.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-200/bind.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-200/create-instance-schema.json
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-200/meta.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-200/values.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-400/bind.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-400/create-instance-schema.json
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-400/meta.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-400/values.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-50/bind.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-50/create-instance-schema.json
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-50/meta.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-50/values.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-800/bind.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-800/create-instance-schema.json
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-800/meta.yaml
 create mode 100644 addons/mysql-cluster/8.0/plans/standard-800/values.yaml

diff --git a/addons/mysql-cluster/8.0/plans/standard-10/bind.yaml b/addons/mysql-cluster/8.0/plans/standard-10/bind.yaml
index fa1ceb8e..e8b99314 100644
--- a/addons/mysql-cluster/8.0/plans/standard-10/bind.yaml
+++ b/addons/mysql-cluster/8.0/plans/standard-10/bind.yaml
@@ -20,10 +20,15 @@ credential:
       secretKeyRef:
         name: {{ template "common.names.fullname" . }}-svcbind-custom-user
         jsonpath: '{ .data.username }' 
-  - name: port
+  - name: portro
     valueFrom:
       secretKeyRef:
         name: {{ template "common.names.fullname" . }}-svcbind-custom-user
-        jsonpath: '{ .data.port }' 
+        jsonpath: '{ .data.portro }'
+  - name: portrw
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portrw }' 
   {{- end }}
 
diff --git a/addons/mysql-cluster/8.0/plans/standard-10/meta.yaml b/addons/mysql-cluster/8.0/plans/standard-10/meta.yaml
index 426c302e..6c738828 100644
--- a/addons/mysql-cluster/8.0/plans/standard-10/meta.yaml
+++ b/addons/mysql-cluster/8.0/plans/standard-10/meta.yaml
@@ -1,6 +1,6 @@
 name: "standard-10"
 id: 2b455154-8725-482a-95b2-a193c180d9b5
-description: "Mysql Cluster standard-10 plan which limit persistence size 10Gi."
+description: "Mysql Cluster standard-10 plan: Disk 10Gi ,vCPUs 1 , RAM 2G , DB MAX Connection 600"
 displayName: "standard-10"
 bindable: true
 maximum_polling_duration: 1800
diff --git a/addons/mysql-cluster/8.0/plans/standard-10/values.yaml b/addons/mysql-cluster/8.0/plans/standard-10/values.yaml
index e8d14da0..f90075a8 100644
--- a/addons/mysql-cluster/8.0/plans/standard-10/values.yaml
+++ b/addons/mysql-cluster/8.0/plans/standard-10/values.yaml
@@ -12,14 +12,15 @@ fullnameOverride: hb-mysql-cluster-standard-10
 ## @param resources.requests The requested resources for the MinIO&reg; container
 ##
 primary: 
+  maxConnectionLimit: 600
   resources:
     limits:
       cpu: 1000m
       memory: 1024Mi
     requests:
-      cpu: 100m
-      memory: 512Mi
-      
+      cpu: 1000m
+      memory: 1024Mi
+  
 
 ## @section Persistence parameters
 
diff --git a/addons/mysql-cluster/8.0/plans/standard-100/bind.yaml b/addons/mysql-cluster/8.0/plans/standard-100/bind.yaml
new file mode 100644
index 00000000..e8b99314
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-100/bind.yaml
@@ -0,0 +1,34 @@
+credential:
+  {{- if (eq .Values.router.service.type "LoadBalancer") }}
+  - name: host
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.host }' 
+  - name: database
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.database }' 
+  - name: password
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: username
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: portro
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portro }'
+  - name: portrw
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portrw }' 
+  {{- end }}
+
diff --git a/addons/mysql-cluster/8.0/plans/standard-100/create-instance-schema.json b/addons/mysql-cluster/8.0/plans/standard-100/create-instance-schema.json
new file mode 100644
index 00000000..66ebbaa0
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-100/create-instance-schema.json
@@ -0,0 +1,12 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "type": "object",
+  "properties": {
+    "imagePullPolicy": {
+      "type": "string",
+      "enum": ["Always", "IfNotPresent", "Never"],
+      "default": "IfNotPresent",
+      "title": "Image pull policy"
+    }
+  }
+}
\ No newline at end of file
diff --git a/addons/mysql-cluster/8.0/plans/standard-100/meta.yaml b/addons/mysql-cluster/8.0/plans/standard-100/meta.yaml
new file mode 100644
index 00000000..1856a446
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-100/meta.yaml
@@ -0,0 +1,6 @@
+name: "standard-100"
+id: 8205e5d3-a954-4c68-a570-efa8c607c1d7
+description: "Mysql Cluster standard-100 plan: Disk 100Gi ,vCPUs 4 , RAM 16G , DB MAX Connection 4000"
+displayName: "standard-100"
+bindable: true
+maximum_polling_duration: 1800
diff --git a/addons/mysql-cluster/8.0/plans/standard-100/values.yaml b/addons/mysql-cluster/8.0/plans/standard-100/values.yaml
new file mode 100644
index 00000000..1c6b865b
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-100/values.yaml
@@ -0,0 +1,61 @@
+## @param fullnameOverride String to fully override common.names.fullname template
+##
+fullnameOverride: hb-mysql-cluster-standard-100
+
+## MinIO&reg; containers' resource requests and limits
+## ref: https://kubernetes.io/docs/user-guide/compute-resources/
+## We usually recommend not to specify default resources and to leave this as a conscious
+## choice for the user. This also increases chances charts run on environments with little
+## resources, such as Minikube. If you do want to specify resources, uncomment the following
+## lines, adjust them as necessary, and remove the curly braces after 'resources:'.
+## @param resources.limits The resources limits for the MinIO&reg; container
+## @param resources.requests The requested resources for the MinIO&reg; container
+##
+primary: 
+  maxConnectionLimit: 4000
+  resources:
+    limits:
+      cpu: 4000m
+      memory: 16Gi
+    requests:
+      cpu: 4000m
+      memory: 16Gi
+  
+
+## @section Persistence parameters
+
+## Enable persistence using Persistent Volume Claims
+## ref: https://kubernetes.io/docs/user-guide/persistent-volumes/
+##
+  persistence:
+    ## @param primary.persistence.enabled Enable persistence on MySQL primary replicas using a `PersistentVolumeClaim`. If false, use emptyDir
+    ##
+    enabled: true
+    ## @param primary.persistence.existingClaim Name of an existing `PersistentVolumeClaim` for MySQL primary replicas
+    ## NOTE: When it's set the rest of persistence parameters are ignored
+    ##
+    existingClaim: ""
+    ## @param primary.persistence.storageClass MySQL primary persistent volume storage Class
+    ## If defined, storageClassName: <storageClass>
+    ## If set to "-", storageClassName: "", which disables dynamic provisioning
+    ## If undefined (the default) or set to null, no storageClassName spec is
+    ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
+    ##   GKE, AWS & OpenStack)
+    ##
+    storageClass: ""
+    ## @param primary.persistence.annotations MySQL primary persistent volume claim annotations
+    ##
+    annotations: {}
+    ## @param primary.persistence.accessModes MySQL primary persistent volume access Modes
+    ##
+    accessModes:
+      - ReadWriteOnce
+    ## @param primary.persistence.size MySQL primary persistent volume size
+    ##
+    size: 100Gi
+    ## @param primary.persistence.selector Selector to match an existing Persistent Volume
+    ## selector:
+    ##   matchLabels:
+    ##     app: my-app
+    ##
+    selector: {}
diff --git a/addons/mysql-cluster/8.0/plans/standard-20/bind.yaml b/addons/mysql-cluster/8.0/plans/standard-20/bind.yaml
new file mode 100644
index 00000000..e8b99314
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-20/bind.yaml
@@ -0,0 +1,34 @@
+credential:
+  {{- if (eq .Values.router.service.type "LoadBalancer") }}
+  - name: host
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.host }' 
+  - name: database
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.database }' 
+  - name: password
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: username
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: portro
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portro }'
+  - name: portrw
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portrw }' 
+  {{- end }}
+
diff --git a/addons/mysql-cluster/8.0/plans/standard-20/create-instance-schema.json b/addons/mysql-cluster/8.0/plans/standard-20/create-instance-schema.json
new file mode 100644
index 00000000..66ebbaa0
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-20/create-instance-schema.json
@@ -0,0 +1,12 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "type": "object",
+  "properties": {
+    "imagePullPolicy": {
+      "type": "string",
+      "enum": ["Always", "IfNotPresent", "Never"],
+      "default": "IfNotPresent",
+      "title": "Image pull policy"
+    }
+  }
+}
\ No newline at end of file
diff --git a/addons/mysql-cluster/8.0/plans/standard-20/meta.yaml b/addons/mysql-cluster/8.0/plans/standard-20/meta.yaml
new file mode 100644
index 00000000..e749a7db
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-20/meta.yaml
@@ -0,0 +1,6 @@
+name: "standard-20"
+id: 95fd7cf2-f2fb-46c9-b3fc-9e7f48899dcc
+description: "Mysql Cluster standard-20 plan: Disk 20Gi ,vCPUs 2 , RAM 4G , DB MAX Connection 1000"
+displayName: "standard-20"
+bindable: true
+maximum_polling_duration: 1800
diff --git a/addons/mysql-cluster/8.0/plans/standard-20/values.yaml b/addons/mysql-cluster/8.0/plans/standard-20/values.yaml
new file mode 100644
index 00000000..d9422e70
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-20/values.yaml
@@ -0,0 +1,61 @@
+## @param fullnameOverride String to fully override common.names.fullname template
+##
+fullnameOverride: hb-mysql-cluster-standard-20
+
+## MinIO&reg; containers' resource requests and limits
+## ref: https://kubernetes.io/docs/user-guide/compute-resources/
+## We usually recommend not to specify default resources and to leave this as a conscious
+## choice for the user. This also increases chances charts run on environments with little
+## resources, such as Minikube. If you do want to specify resources, uncomment the following
+## lines, adjust them as necessary, and remove the curly braces after 'resources:'.
+## @param resources.limits The resources limits for the MinIO&reg; container
+## @param resources.requests The requested resources for the MinIO&reg; container
+##
+primary: 
+  maxConnectionLimit: 1000
+  resources:
+    limits:
+      cpu: 2000m
+      memory: 4Gi
+    requests:
+      cpu: 2000m
+      memory: 4Gi
+  
+
+## @section Persistence parameters
+
+## Enable persistence using Persistent Volume Claims
+## ref: https://kubernetes.io/docs/user-guide/persistent-volumes/
+##
+  persistence:
+    ## @param primary.persistence.enabled Enable persistence on MySQL primary replicas using a `PersistentVolumeClaim`. If false, use emptyDir
+    ##
+    enabled: true
+    ## @param primary.persistence.existingClaim Name of an existing `PersistentVolumeClaim` for MySQL primary replicas
+    ## NOTE: When it's set the rest of persistence parameters are ignored
+    ##
+    existingClaim: ""
+    ## @param primary.persistence.storageClass MySQL primary persistent volume storage Class
+    ## If defined, storageClassName: <storageClass>
+    ## If set to "-", storageClassName: "", which disables dynamic provisioning
+    ## If undefined (the default) or set to null, no storageClassName spec is
+    ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
+    ##   GKE, AWS & OpenStack)
+    ##
+    storageClass: ""
+    ## @param primary.persistence.annotations MySQL primary persistent volume claim annotations
+    ##
+    annotations: {}
+    ## @param primary.persistence.accessModes MySQL primary persistent volume access Modes
+    ##
+    accessModes:
+      - ReadWriteOnce
+    ## @param primary.persistence.size MySQL primary persistent volume size
+    ##
+    size: 20Gi
+    ## @param primary.persistence.selector Selector to match an existing Persistent Volume
+    ## selector:
+    ##   matchLabels:
+    ##     app: my-app
+    ##
+    selector: {}
diff --git a/addons/mysql-cluster/8.0/plans/standard-200/bind.yaml b/addons/mysql-cluster/8.0/plans/standard-200/bind.yaml
new file mode 100644
index 00000000..e8b99314
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-200/bind.yaml
@@ -0,0 +1,34 @@
+credential:
+  {{- if (eq .Values.router.service.type "LoadBalancer") }}
+  - name: host
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.host }' 
+  - name: database
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.database }' 
+  - name: password
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: username
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: portro
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portro }'
+  - name: portrw
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portrw }' 
+  {{- end }}
+
diff --git a/addons/mysql-cluster/8.0/plans/standard-200/create-instance-schema.json b/addons/mysql-cluster/8.0/plans/standard-200/create-instance-schema.json
new file mode 100644
index 00000000..66ebbaa0
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-200/create-instance-schema.json
@@ -0,0 +1,12 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "type": "object",
+  "properties": {
+    "imagePullPolicy": {
+      "type": "string",
+      "enum": ["Always", "IfNotPresent", "Never"],
+      "default": "IfNotPresent",
+      "title": "Image pull policy"
+    }
+  }
+}
\ No newline at end of file
diff --git a/addons/mysql-cluster/8.0/plans/standard-200/meta.yaml b/addons/mysql-cluster/8.0/plans/standard-200/meta.yaml
new file mode 100644
index 00000000..b857ef1e
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-200/meta.yaml
@@ -0,0 +1,6 @@
+name: "standard-200"
+id: 8205e5d3-a954-4c68-a570-efa8c607c1d7
+description: "Mysql Cluster standard-200 plan: Disk 200Gi ,vCPUs 8 , RAM 32G , DB MAX Connection 8000"
+displayName: "standard-200"
+bindable: true
+maximum_polling_duration: 1800
diff --git a/addons/mysql-cluster/8.0/plans/standard-200/values.yaml b/addons/mysql-cluster/8.0/plans/standard-200/values.yaml
new file mode 100644
index 00000000..baf7e8a9
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-200/values.yaml
@@ -0,0 +1,61 @@
+## @param fullnameOverride String to fully override common.names.fullname template
+##
+fullnameOverride: hb-mysql-cluster-standard-200
+
+## MinIO&reg; containers' resource requests and limits
+## ref: https://kubernetes.io/docs/user-guide/compute-resources/
+## We usually recommend not to specify default resources and to leave this as a conscious
+## choice for the user. This also increases chances charts run on environments with little
+## resources, such as Minikube. If you do want to specify resources, uncomment the following
+## lines, adjust them as necessary, and remove the curly braces after 'resources:'.
+## @param resources.limits The resources limits for the MinIO&reg; container
+## @param resources.requests The requested resources for the MinIO&reg; container
+##
+primary: 
+  maxConnectionLimit: 8000
+  resources:
+    limits:
+      cpu: 8000m
+      memory: 32Gi
+    requests:
+      cpu: 8000m
+      memory: 32Gi
+  
+
+## @section Persistence parameters
+
+## Enable persistence using Persistent Volume Claims
+## ref: https://kubernetes.io/docs/user-guide/persistent-volumes/
+##
+  persistence:
+    ## @param primary.persistence.enabled Enable persistence on MySQL primary replicas using a `PersistentVolumeClaim`. If false, use emptyDir
+    ##
+    enabled: true
+    ## @param primary.persistence.existingClaim Name of an existing `PersistentVolumeClaim` for MySQL primary replicas
+    ## NOTE: When it's set the rest of persistence parameters are ignored
+    ##
+    existingClaim: ""
+    ## @param primary.persistence.storageClass MySQL primary persistent volume storage Class
+    ## If defined, storageClassName: <storageClass>
+    ## If set to "-", storageClassName: "", which disables dynamic provisioning
+    ## If undefined (the default) or set to null, no storageClassName spec is
+    ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
+    ##   GKE, AWS & OpenStack)
+    ##
+    storageClass: ""
+    ## @param primary.persistence.annotations MySQL primary persistent volume claim annotations
+    ##
+    annotations: {}
+    ## @param primary.persistence.accessModes MySQL primary persistent volume access Modes
+    ##
+    accessModes:
+      - ReadWriteOnce
+    ## @param primary.persistence.size MySQL primary persistent volume size
+    ##
+    size: 200Gi
+    ## @param primary.persistence.selector Selector to match an existing Persistent Volume
+    ## selector:
+    ##   matchLabels:
+    ##     app: my-app
+    ##
+    selector: {}
diff --git a/addons/mysql-cluster/8.0/plans/standard-400/bind.yaml b/addons/mysql-cluster/8.0/plans/standard-400/bind.yaml
new file mode 100644
index 00000000..e8b99314
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-400/bind.yaml
@@ -0,0 +1,34 @@
+credential:
+  {{- if (eq .Values.router.service.type "LoadBalancer") }}
+  - name: host
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.host }' 
+  - name: database
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.database }' 
+  - name: password
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: username
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: portro
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portro }'
+  - name: portrw
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portrw }' 
+  {{- end }}
+
diff --git a/addons/mysql-cluster/8.0/plans/standard-400/create-instance-schema.json b/addons/mysql-cluster/8.0/plans/standard-400/create-instance-schema.json
new file mode 100644
index 00000000..66ebbaa0
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-400/create-instance-schema.json
@@ -0,0 +1,12 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "type": "object",
+  "properties": {
+    "imagePullPolicy": {
+      "type": "string",
+      "enum": ["Always", "IfNotPresent", "Never"],
+      "default": "IfNotPresent",
+      "title": "Image pull policy"
+    }
+  }
+}
\ No newline at end of file
diff --git a/addons/mysql-cluster/8.0/plans/standard-400/meta.yaml b/addons/mysql-cluster/8.0/plans/standard-400/meta.yaml
new file mode 100644
index 00000000..c802ccc6
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-400/meta.yaml
@@ -0,0 +1,6 @@
+name: "standard-400"
+id: f96fb7d8-3012-4175-931e-902e26697441
+description: "Mysql Cluster standard-400 plan: Disk 400Gi ,vCPUs 16 , RAM 64G , DB MAX Connection 1600"
+displayName: "standard-400"
+bindable: true
+maximum_polling_duration: 1800
diff --git a/addons/mysql-cluster/8.0/plans/standard-400/values.yaml b/addons/mysql-cluster/8.0/plans/standard-400/values.yaml
new file mode 100644
index 00000000..2cc0d06e
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-400/values.yaml
@@ -0,0 +1,61 @@
+## @param fullnameOverride String to fully override common.names.fullname template
+##
+fullnameOverride: hb-mysql-cluster-standard-400
+
+## MinIO&reg; containers' resource requests and limits
+## ref: https://kubernetes.io/docs/user-guide/compute-resources/
+## We usually recommend not to specify default resources and to leave this as a conscious
+## choice for the user. This also increases chances charts run on environments with little
+## resources, such as Minikube. If you do want to specify resources, uncomment the following
+## lines, adjust them as necessary, and remove the curly braces after 'resources:'.
+## @param resources.limits The resources limits for the MinIO&reg; container
+## @param resources.requests The requested resources for the MinIO&reg; container
+##
+primary: 
+  maxConnectionLimit: 1600
+  resources:
+    limits:
+      cpu: 16000m
+      memory: 64Gi
+    requests:
+      cpu: 16000m
+      memory: 64Gi
+  
+
+## @section Persistence parameters
+
+## Enable persistence using Persistent Volume Claims
+## ref: https://kubernetes.io/docs/user-guide/persistent-volumes/
+##
+  persistence:
+    ## @param primary.persistence.enabled Enable persistence on MySQL primary replicas using a `PersistentVolumeClaim`. If false, use emptyDir
+    ##
+    enabled: true
+    ## @param primary.persistence.existingClaim Name of an existing `PersistentVolumeClaim` for MySQL primary replicas
+    ## NOTE: When it's set the rest of persistence parameters are ignored
+    ##
+    existingClaim: ""
+    ## @param primary.persistence.storageClass MySQL primary persistent volume storage Class
+    ## If defined, storageClassName: <storageClass>
+    ## If set to "-", storageClassName: "", which disables dynamic provisioning
+    ## If undefined (the default) or set to null, no storageClassName spec is
+    ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
+    ##   GKE, AWS & OpenStack)
+    ##
+    storageClass: ""
+    ## @param primary.persistence.annotations MySQL primary persistent volume claim annotations
+    ##
+    annotations: {}
+    ## @param primary.persistence.accessModes MySQL primary persistent volume access Modes
+    ##
+    accessModes:
+      - ReadWriteOnce
+    ## @param primary.persistence.size MySQL primary persistent volume size
+    ##
+    size: 400Gi
+    ## @param primary.persistence.selector Selector to match an existing Persistent Volume
+    ## selector:
+    ##   matchLabels:
+    ##     app: my-app
+    ##
+    selector: {}
diff --git a/addons/mysql-cluster/8.0/plans/standard-50/bind.yaml b/addons/mysql-cluster/8.0/plans/standard-50/bind.yaml
new file mode 100644
index 00000000..e8b99314
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-50/bind.yaml
@@ -0,0 +1,34 @@
+credential:
+  {{- if (eq .Values.router.service.type "LoadBalancer") }}
+  - name: host
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.host }' 
+  - name: database
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.database }' 
+  - name: password
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: username
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: portro
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portro }'
+  - name: portrw
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portrw }' 
+  {{- end }}
+
diff --git a/addons/mysql-cluster/8.0/plans/standard-50/create-instance-schema.json b/addons/mysql-cluster/8.0/plans/standard-50/create-instance-schema.json
new file mode 100644
index 00000000..66ebbaa0
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-50/create-instance-schema.json
@@ -0,0 +1,12 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "type": "object",
+  "properties": {
+    "imagePullPolicy": {
+      "type": "string",
+      "enum": ["Always", "IfNotPresent", "Never"],
+      "default": "IfNotPresent",
+      "title": "Image pull policy"
+    }
+  }
+}
\ No newline at end of file
diff --git a/addons/mysql-cluster/8.0/plans/standard-50/meta.yaml b/addons/mysql-cluster/8.0/plans/standard-50/meta.yaml
new file mode 100644
index 00000000..a6d4e5bd
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-50/meta.yaml
@@ -0,0 +1,6 @@
+name: "standard-50"
+id: 6f69bee2-6de2-4baf-bbe1-27844a2998b2
+description: "Mysql Cluster standard-10 plan: Disk 50Gi ,vCPUs 2 , RAM 8G , DB MAX Connection 2000"
+displayName: "standard-50"
+bindable: true
+maximum_polling_duration: 1800
diff --git a/addons/mysql-cluster/8.0/plans/standard-50/values.yaml b/addons/mysql-cluster/8.0/plans/standard-50/values.yaml
new file mode 100644
index 00000000..bc9fd336
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-50/values.yaml
@@ -0,0 +1,60 @@
+## @param fullnameOverride String to fully override common.names.fullname template
+##
+fullnameOverride: hb-mysql-cluster-standard-50
+
+## MinIO&reg; containers' resource requests and limits
+## ref: https://kubernetes.io/docs/user-guide/compute-resources/
+## We usually recommend not to specify default resources and to leave this as a conscious
+## choice for the user. This also increases chances charts run on environments with little
+## resources, such as Minikube. If you do want to specify resources, uncomment the following
+## lines, adjust them as necessary, and remove the curly braces after 'resources:'.
+## @param resources.limits The resources limits for the MinIO&reg; container
+## @param resources.requests The requested resources for the MinIO&reg; container
+##
+primary: 
+  maxConnectionLimit: 2000
+  resources:
+    limits:
+      cpu: 2000m
+      memory: 8Gi
+    requests:
+      cpu: 2000m
+      memory: 8Gi
+  
+## @section Persistence parameters
+
+## Enable persistence using Persistent Volume Claims
+## ref: https://kubernetes.io/docs/user-guide/persistent-volumes/
+##
+  persistence:
+    ## @param primary.persistence.enabled Enable persistence on MySQL primary replicas using a `PersistentVolumeClaim`. If false, use emptyDir
+    ##
+    enabled: true
+    ## @param primary.persistence.existingClaim Name of an existing `PersistentVolumeClaim` for MySQL primary replicas
+    ## NOTE: When it's set the rest of persistence parameters are ignored
+    ##
+    existingClaim: ""
+    ## @param primary.persistence.storageClass MySQL primary persistent volume storage Class
+    ## If defined, storageClassName: <storageClass>
+    ## If set to "-", storageClassName: "", which disables dynamic provisioning
+    ## If undefined (the default) or set to null, no storageClassName spec is
+    ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
+    ##   GKE, AWS & OpenStack)
+    ##
+    storageClass: ""
+    ## @param primary.persistence.annotations MySQL primary persistent volume claim annotations
+    ##
+    annotations: {}
+    ## @param primary.persistence.accessModes MySQL primary persistent volume access Modes
+    ##
+    accessModes:
+      - ReadWriteOnce
+    ## @param primary.persistence.size MySQL primary persistent volume size
+    ##
+    size: 50Gi
+    ## @param primary.persistence.selector Selector to match an existing Persistent Volume
+    ## selector:
+    ##   matchLabels:
+    ##     app: my-app
+    ##
+    selector: {}
diff --git a/addons/mysql-cluster/8.0/plans/standard-800/bind.yaml b/addons/mysql-cluster/8.0/plans/standard-800/bind.yaml
new file mode 100644
index 00000000..e8b99314
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-800/bind.yaml
@@ -0,0 +1,34 @@
+credential:
+  {{- if (eq .Values.router.service.type "LoadBalancer") }}
+  - name: host
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.host }' 
+  - name: database
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.database }' 
+  - name: password
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: username
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.username }' 
+  - name: portro
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portro }'
+  - name: portrw
+    valueFrom:
+      secretKeyRef:
+        name: {{ template "common.names.fullname" . }}-svcbind-custom-user
+        jsonpath: '{ .data.portrw }' 
+  {{- end }}
+
diff --git a/addons/mysql-cluster/8.0/plans/standard-800/create-instance-schema.json b/addons/mysql-cluster/8.0/plans/standard-800/create-instance-schema.json
new file mode 100644
index 00000000..66ebbaa0
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-800/create-instance-schema.json
@@ -0,0 +1,12 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "type": "object",
+  "properties": {
+    "imagePullPolicy": {
+      "type": "string",
+      "enum": ["Always", "IfNotPresent", "Never"],
+      "default": "IfNotPresent",
+      "title": "Image pull policy"
+    }
+  }
+}
\ No newline at end of file
diff --git a/addons/mysql-cluster/8.0/plans/standard-800/meta.yaml b/addons/mysql-cluster/8.0/plans/standard-800/meta.yaml
new file mode 100644
index 00000000..72806d97
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-800/meta.yaml
@@ -0,0 +1,6 @@
+name: "standard-800"
+id: 829768aa-f287-42ee-b98c-db40ec670d38
+description: "Mysql Cluster standard-800 plan: Disk 800Gi ,vCPUs 32 , RAM 128G , DB MAX Connection 32000"
+displayName: "standard-800"
+bindable: true
+maximum_polling_duration: 1800
diff --git a/addons/mysql-cluster/8.0/plans/standard-800/values.yaml b/addons/mysql-cluster/8.0/plans/standard-800/values.yaml
new file mode 100644
index 00000000..82a515d7
--- /dev/null
+++ b/addons/mysql-cluster/8.0/plans/standard-800/values.yaml
@@ -0,0 +1,61 @@
+## @param fullnameOverride String to fully override common.names.fullname template
+##
+fullnameOverride: hb-mysql-cluster-standard-800
+
+## MinIO&reg; containers' resource requests and limits
+## ref: https://kubernetes.io/docs/user-guide/compute-resources/
+## We usually recommend not to specify default resources and to leave this as a conscious
+## choice for the user. This also increases chances charts run on environments with little
+## resources, such as Minikube. If you do want to specify resources, uncomment the following
+## lines, adjust them as necessary, and remove the curly braces after 'resources:'.
+## @param resources.limits The resources limits for the MinIO&reg; container
+## @param resources.requests The requested resources for the MinIO&reg; container
+##
+primary: 
+  maxConnectionLimit: 32000
+  resources:
+    limits:
+      cpu: 32000m
+      memory: 128Gi
+    requests:
+      cpu: 32000m
+      memory: 128Gi
+  
+
+## @section Persistence parameters
+
+## Enable persistence using Persistent Volume Claims
+## ref: https://kubernetes.io/docs/user-guide/persistent-volumes/
+##
+  persistence:
+    ## @param primary.persistence.enabled Enable persistence on MySQL primary replicas using a `PersistentVolumeClaim`. If false, use emptyDir
+    ##
+    enabled: true
+    ## @param primary.persistence.existingClaim Name of an existing `PersistentVolumeClaim` for MySQL primary replicas
+    ## NOTE: When it's set the rest of persistence parameters are ignored
+    ##
+    existingClaim: ""
+    ## @param primary.persistence.storageClass MySQL primary persistent volume storage Class
+    ## If defined, storageClassName: <storageClass>
+    ## If set to "-", storageClassName: "", which disables dynamic provisioning
+    ## If undefined (the default) or set to null, no storageClassName spec is
+    ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
+    ##   GKE, AWS & OpenStack)
+    ##
+    storageClass: ""
+    ## @param primary.persistence.annotations MySQL primary persistent volume claim annotations
+    ##
+    annotations: {}
+    ## @param primary.persistence.accessModes MySQL primary persistent volume access Modes
+    ##
+    accessModes:
+      - ReadWriteOnce
+    ## @param primary.persistence.size MySQL primary persistent volume size
+    ##
+    size: 800Gi
+    ## @param primary.persistence.selector Selector to match an existing Persistent Volume
+    ## selector:
+    ##   matchLabels:
+    ##     app: my-app
+    ##
+    selector: {}

From 8a97c7ed3aaf794c1b614b3828415242f749cda5 Mon Sep 17 00:00:00 2001
From: EamonZhang <zhang.eamon@hotmail.com>
Date: Wed, 25 Oct 2023 17:00:36 +0800
Subject: [PATCH 10/11] chore(prometheus): support discovery addons in
 namespaces

---
 .../prometheus/templates/_scrape_config.tpl   | 44 ++++++++++++++
 .../prometheus/2/chart/prometheus/values.yaml | 57 ++++---------------
 2 files changed, 55 insertions(+), 46 deletions(-)

diff --git a/addons/prometheus/2/chart/prometheus/templates/_scrape_config.tpl b/addons/prometheus/2/chart/prometheus/templates/_scrape_config.tpl
index 7fb0e110..316031e2 100644
--- a/addons/prometheus/2/chart/prometheus/templates/_scrape_config.tpl
+++ b/addons/prometheus/2/chart/prometheus/templates/_scrape_config.tpl
@@ -85,3 +85,47 @@ relabel_configs:
     regex: 0
     action: keep
 {{- end -}}
+
+{{- define "addons.ds_scrape_config" -}}
+honor_labels: true
+kubernetes_sd_configs:
+  - role: endpoints
+    namespaces:
+      own_namespace: true
+      names:
+      - {{ include "common.names.namespace" .context }}
+relabel_configs:
+  - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]
+    action: keep
+    regex: true
+  - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape_slow]
+    action: drop
+    regex: true
+  - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]
+    action: replace
+    target_label: __scheme__
+    regex: (https?)
+  - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path]
+    action: replace
+    target_label: __metrics_path__
+    regex: (.+)
+  - source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port]
+    action: replace
+    target_label: __address__
+    regex: (.+?)(?::\d+)?;(\d+)
+    replacement: $1:$2
+  - action: labelmap
+    regex: __meta_kubernetes_service_annotation_prometheus_io_param_(.+)
+    replacement: __param_$1
+  - action: labelmap
+    regex: __meta_kubernetes_service_label_(.+)
+  - source_labels: [__meta_kubernetes_namespace]
+    action: replace
+    target_label: namespace
+  - source_labels: [__meta_kubernetes_service_name]
+    action: replace
+    target_label: service
+  - source_labels: [__meta_kubernetes_pod_node_name]
+    action: replace
+    target_label: node
+{{- end -}}
diff --git a/addons/prometheus/2/chart/prometheus/values.yaml b/addons/prometheus/2/chart/prometheus/values.yaml
index a551fa68..fb195934 100644
--- a/addons/prometheus/2/chart/prometheus/values.yaml
+++ b/addons/prometheus/2/chart/prometheus/values.yaml
@@ -625,12 +625,16 @@ server:
       - job_name: alertmanager
         {{- include "prometheus.scrape_config" (dict "component" "alertmanager" "context" $) | nindent 4 }}
     {{- end }}
+    {{- if .Values.scrapeAddons.enabled }}
+      - job_name: addons
+        {{- include "addons.ds_scrape_config"  (dict "context" $) | nindent 4 }}
+    {{- end }}  
     {{- if .Values.server.extraScrapeConfigs}}
     {{- include "common.tplvalues.render" (dict "value" .Values.server.extraScrapeConfigs "context" $) | nindent 2 }}
     {{- end }}
-    {{- if .Values.server.dsScrapeConfigs}}
-    {{- include "common.tplvalues.render" (dict "value" .Values.server.dsScrapeConfigs "context" $) | nindent 2 }}
-    {{- end }}
+    # {{- if .Values.server.dsScrapeConfigs}}
+    # {{- include "common.tplvalues.render" (dict "value" .Values.server.dsScrapeConfigs "context" $) | nindent 2 }}
+    # {{- end }}
     {{- if or .Values.alertmanager.enabled .Values.server.alertingEndpoints}}
     alerting:
       alertmanagers:
@@ -653,49 +657,7 @@ server:
   ## ref: <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config>
   ##
   extraScrapeConfigs: [] 
-  dsScrapeConfigs: 
-      - job_name: 'service-endpoints'
-        honor_labels: true
-        kubernetes_sd_configs:
-          - role: endpoints
-            namespaces:
-              own_namespace: true
-              names:
-                - default
-        relabel_configs:
-          - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]
-            action: keep
-            regex: true
-          - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape_slow]
-            action: drop
-            regex: true
-          - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]
-            action: replace
-            target_label: __scheme__
-            regex: (https?)
-          - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path]
-            action: replace
-            target_label: __metrics_path__
-            regex: (.+)
-          - source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port]
-            action: replace
-            target_label: __address__
-            regex: (.+?)(?::\d+)?;(\d+)
-            replacement: $1:$2
-          - action: labelmap
-            regex: __meta_kubernetes_service_annotation_prometheus_io_param_(.+)
-            replacement: __param_$1
-          - action: labelmap
-            regex: __meta_kubernetes_service_label_(.+)
-          - source_labels: [__meta_kubernetes_namespace]
-            action: replace
-            target_label: namespace
-          - source_labels: [__meta_kubernetes_service_name]
-            action: replace
-            target_label: service
-          - source_labels: [__meta_kubernetes_pod_node_name]
-            action: replace
-            target_label: node
+ 
   ## @param server.replicaCount Number of Prometheus replicas to deploy
   ##
   replicaCount: 1
@@ -1569,3 +1531,6 @@ volumePermissions:
   ##
   containerSecurityContext:
     runAsUser: 0
+
+scrapeAddons:
+  enable: true

From 187ec9991af7c2bc26e58b9f3cfb686d4ed40092 Mon Sep 17 00:00:00 2001
From: EamonZhang <zhang.eamon@hotmail.com>
Date: Wed, 25 Oct 2023 17:33:57 +0800
Subject: [PATCH 11/11] fix(prometheus): is enabled scrape addons metrics

---
 addons/prometheus/2/chart/prometheus/values.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/prometheus/2/chart/prometheus/values.yaml b/addons/prometheus/2/chart/prometheus/values.yaml
index fb195934..21331135 100644
--- a/addons/prometheus/2/chart/prometheus/values.yaml
+++ b/addons/prometheus/2/chart/prometheus/values.yaml
@@ -1533,4 +1533,4 @@ volumePermissions:
     runAsUser: 0
 
 scrapeAddons:
-  enable: true
+  enabled: true
