fix(mariadb): always enable replication for consistent service naming

Enable replication unconditionally regardless of replica count.
Previously, single-replica instances created a general service
without -primary/-secondary suffixes, causing dashboard and
backup-cronjob to reference non-existent services.

Also fix duplicate YAML key in backup-cronjob template.

BREAKING CHANGE: Single-replica MariaDB instances will now have
service names with -primary/-secondary suffixes instead of the
bare instance name. Applications connecting via the old service
DNS name need to be updated.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
This commit is contained in:
Kirill Ilin 2026-03-27 11:03:23 +05:00
parent 7c26bea81e
commit d2030bef87
No known key found for this signature in database
GPG key ID: E902D8B383F7675E
2 changed files with 1 additions and 9 deletions

View file

@ -13,9 +13,6 @@ spec:
jobTemplate:
spec:
backoffLimit: 2
template:
spec:
restartPolicy: OnFailure
template:
metadata:
annotations:

View file

@ -29,13 +29,11 @@ spec:
- {{ .Release.Name }}
topologyKey: "kubernetes.io/hostname"
{{- if gt (int .Values.replicas) 1 }}
replication:
enabled: true
#primary:
# podIndex: 0
# automaticFailover: true
{{- end }}
podMetadata:
labels:
@ -65,9 +63,6 @@ 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
@ -76,7 +71,7 @@ spec:
storageClassName: {{ . }}
{{- end }}
{{- if and .Values.external (gt (int .Values.replicas) 1) }}
{{- if .Values.external }}
primaryService:
type: LoadBalancer
{{- end }}