From 848abc4bd1781d251ae8db0ab37f2ecb0063c600 Mon Sep 17 00:00:00 2001 From: Timofei Larkin Date: Wed, 25 Jun 2025 14:24:43 +0300 Subject: [PATCH] Create LoadBalancer service for single-node MySQL [mysql] Bugfix: external=true did not work for MySQL deployed with a single replica, since the MariaDB operator does not create separate primary and secondary services for a single-node DB. A special condition is added to make the "all-node" service a LoadBalancer if external=true and replicas=1. Signed-off-by: Timofei Larkin --- packages/apps/mysql/Chart.yaml | 2 +- packages/apps/mysql/templates/mariadb.yaml | 6 ++++-- packages/apps/versions_map | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/apps/mysql/Chart.yaml b/packages/apps/mysql/Chart.yaml index 4f5a9446..694e2dc3 100644 --- a/packages/apps/mysql/Chart.yaml +++ b/packages/apps/mysql/Chart.yaml @@ -16,7 +16,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.8.1 +version: 0.8.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/packages/apps/mysql/templates/mariadb.yaml b/packages/apps/mysql/templates/mariadb.yaml index 42580644..50a1ca1c 100644 --- a/packages/apps/mysql/templates/mariadb.yaml +++ b/packages/apps/mysql/templates/mariadb.yaml @@ -61,7 +61,9 @@ spec: metadata: labels: app.kubernetes.io/instance: {{ $.Release.Name }} - + {{- if and .Values.external (eq (int .Values.replicas) 1) }} + type: LoadBalancer + {{- end }} storage: size: {{ .Values.size }} resizeInUseVolumes: true @@ -70,7 +72,7 @@ spec: storageClassName: {{ . }} {{- end }} - {{- if .Values.external }} + {{- if and .Values.external (gt (int .Values.replicas) 1) }} primaryService: type: LoadBalancer {{- end }} diff --git a/packages/apps/versions_map b/packages/apps/versions_map index 445d700b..895a350a 100644 --- a/packages/apps/versions_map +++ b/packages/apps/versions_map @@ -63,7 +63,8 @@ mysql 0.6.0 93bdf411 mysql 0.7.0 6130f43d mysql 0.7.1 632224a3 mysql 0.8.0 62cb694d -mysql 0.8.1 HEAD +mysql 0.8.1 4369b031 +mysql 0.8.2 HEAD nats 0.1.0 e9716091 nats 0.2.0 6c5cf5bf nats 0.3.0 78366f19