Skip to content

[Backport release-1.5] fix(mariadb): re-guard replication so single-replica passes the operator webhook - #3183

Merged
myasnikovdaniil merged 2 commits into
release-1.5from
backport-3180-to-release-1.5
Jul 3, 2026
Merged

[Backport release-1.5] fix(mariadb): re-guard replication so single-replica passes the operator webhook#3183
myasnikovdaniil merged 2 commits into
release-1.5from
backport-3180-to-release-1.5

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Description

Backport of #3180 to release-1.5.

scooby87 added 2 commits July 2, 2026 19:54
…tor webhook

PR #2279 made `replication.enabled: true` unconditional so the operator would
always create -primary/-secondary services. But the mariadb-operator validating
webhook (vmariadb-v1alpha1.kb.io) rejects replication when spec.replicas == 1,
so single-replica MariaDB could no longer be created — the HelmRelease never
became Ready.

Re-guard replication on replicas>1 and teach the service-name consumers about
the bare <release> service the operator provisions in both topologies:

- mariadb.yaml: gate `replication` on replicas>1; restore single-replica
  external access via `service.type: LoadBalancer` and keep `primaryService`
  LoadBalancer for replicas>1 only.
- backup-cronjob.yaml: route single-replica dumps to the bare service
  (no -secondary exists without replication).
- dashboard-resourcemap.yaml: always grant RBAC on the bare service, plus
  -primary/-secondary when replicas>1, matching the ApplicationDefinition.
- mariadb-rd: list the bare service in services.include so single-replica
  installs are visible in the dashboard.

Adds a single-replica e2e test that reproduces the webhook rejection and
guards against regression.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Алексей Артамонов <alexeyartamonov1987@gmail.com>
(cherry picked from commit c7e8f4d)
… dump

The failure-path dump queried mariadbs.k8s.mariadb.com with $name, but the
operator CR is named after the Helm release ({{ .Release.Name }} = mariadb-$name),
so the dump would hit NotFound instead of showing the rejected CR.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Алексей Артамонов <alexeyartamonov1987@gmail.com>
(cherry picked from commit f8e4222)
@dosubot dosubot Bot added area/database Issues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse) backport Should change be backported on previous release kind/bug Categorizes issue or PR as related to a bug labels Jul 2, 2026
@myasnikovdaniil
myasnikovdaniil merged commit 943f2b0 into release-1.5 Jul 3, 2026
5 checks passed
@myasnikovdaniil
myasnikovdaniil deleted the backport-3180-to-release-1.5 branch July 3, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/database Issues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse) backport Should change be backported on previous release kind/bug Categorizes issue or PR as related to a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants