Skip to content

fix(mariadb): mount the chart's my.cnf under a .cnf name - #4843

Merged
Aleksei Sviridkin (lexfrei) merged 2 commits into
mainfrom
fix/mariadb-mycnf-key
Oct 10, 2026
Merged

Aleksei Sviridkin (lexfrei) merged 2 commits into
mainfrom
fix/mariadb-mycnf-key

Conversation

@lexfrei

@lexfrei Aleksei Sviridkin (lexfrei) commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

The MariaDB chart's my.cnf has not been read by the server since the mariadb-operator bump to v0.28.1. Up to v0.0.27 the operator mounted the referenced ConfigMap key as /etc/mysql/conf.d/my.cnf whatever the key was called. Since v0.0.28 the file takes the key's own name, so the chart's key config became /etc/mysql/conf.d/config. The server's !includedir reads only *.cnf files, so it skipped it, and every instance has been running on stock MariaDB defaults. On the default t1.nano preset that means a 128M buffer pool inside a 128Mi memory limit.

This renames the key to my.cnf in the ConfigMap and in the MariaDB CR. The file content is unchanged. I started all four shipped versions (10.6.24, 10.11.15, 11.4.9, 11.8.5) with the rendered file under a 128m memory limit, and each one came up with the chart's values. The MySQL-only options in the file log a warning and are otherwise ignored. They and the deprecated innodb_flush_method are tracked in #4842.

Tests: a helm-unittest suite pins the key on both sides, and the mariadb chainsaw suite gets a step that compares @@innodb_buffer_pool_size on the running server with the value in the rendered my.cnf.

This changes behaviour on every existing instance, see the release note. Each instance rolls its pods once because the projected volume in the pod template changes: replicas first, then the primary with a switchover. After that the server runs with every setting in the chart's file. Instances created before the operator bump (May 2024) ran with these settings before. Newer ones never did.

Closes #4836

Screenshots

Not a UI change.

Downstream repositories

Release note

fix(mariadb): the chart's my.cnf is applied again. Since mariadb-operator v0.28.1 it was mounted under a name the server ignores, so MariaDB instances ran on stock defaults. Every existing instance rolls its pods once on upgrade (replicas first, then the primary with a switchover) and then runs with the chart's settings. That changes behaviour: buffer pool, redo log, connection limits and caches are sized from the instance's resources; sql_mode becomes NO_ENGINE_SUBSTITUTION, so strict mode is off and invalid values are truncated with a warning instead of rejected; innodb_flush_log_at_trx_commit=2 can lose up to about a second of committed transactions if the node crashes; innodb_fast_shutdown=0 makes every pod shutdown slower.

Summary by CodeRabbit

  • Bug Fixes
    • MariaDB configuration is now stored and read using the my.cnf key. A verification check confirms the running server applies the configured buffer-pool size.

mariadb-operator up to v0.0.27 mounted the referenced ConfigMap key as
/etc/mysql/conf.d/my.cnf whatever the key was called. Since v0.0.28 the
file takes the key's own name, so the chart's key "config" became
/etc/mysql/conf.d/config, and the server's !includedir reads only *.cnf
files from that directory. Every setting in the chart's my.cnf has been
ignored since that operator bump: instances run on stock defaults,
including a 128M InnoDB buffer pool inside the 128Mi default limit.

Renaming the key restores the file as intended. Existing instances roll
their pods once, since the projected volume in the pod template changes,
and come back with the chart's settings in effect, including sql-mode
and innodb_flush_log_at_trx_commit, not only the resource sizing.

Fixes: a9c42c8 ("Update mariadb-operator v0.28.1 (#124)")
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <[email protected]>
The chart's unit tests can pin the ConfigMap key and the CR reference,
but not what mariadb-operator does with them or which files the server
then reads from /etc/mysql/conf.d. Compare innodb_buffer_pool_size as
the live server reports it against the value in the rendered my.cnf,
which differs from the server default on this fixture's preset.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <[email protected]>
@github-actions github-actions Bot added area/database Issues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse) kind/bug Categorizes issue or PR as related to a bug size/L This PR changes 100-499 lines, ignoring generated files labels Oct 9, 2026
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: cozystack/cozystack/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a51fa1b7-cd87-4aa1-bcc9-027406dd1dd9

📥 Commits

Reviewing files that changed from the base of the PR and between f61e13f and 8ab6d49.


📒 Files selected for processing (5)
  • hack/e2e-chainsaw/mariadb/chainsaw-test.yaml
  • packages/apps/mariadb/templates/config.yaml
  • packages/apps/mariadb/templates/mariadb.yaml
  • packages/apps/mariadb/tests/my_cnf_key_test.yaml
  • packages/apps/mariadb/tests/my_cnf_resource_scaling_test.yaml

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.



📝 Walkthrough

Walkthrough

The MariaDB chart now stores its configuration under my.cnf and references that key. Helm tests check the key and retain existing sizing assertions. The Chainsaw test waits for readiness and compares the configured buffer-pool size with the running server value.

Changes

MariaDB configuration loading

Layer / File(s) Summary
Use and test the my.cnf key
packages/apps/mariadb/templates/config.yaml, packages/apps/mariadb/templates/mariadb.yaml, packages/apps/mariadb/tests/my_cnf_key_test.yaml, packages/apps/mariadb/tests/my_cnf_resource_scaling_test.yaml
The ConfigMap stores its configuration under my.cnf, and the MariaDB resource references that key. Helm tests check the key and continue to assert the existing sizing and behavioral settings.
Verify the running buffer-pool size
hack/e2e-chainsaw/mariadb/chainsaw-test.yaml
The Chainsaw test waits for mariadb-test-0 to become Ready, then compares the ConfigMap buffer-pool size with the running server value in bytes.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Medium


Merge Risk: ⚪ Minimal · up to 8ab6d

The configuration key and its reference align. No identified issue prevents merging after normal checks.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: mounting the MariaDB chart configuration under a .cnf filename by renaming the ConfigMap key.
Linked Issues check Passed #4836 requires a .cnf ConfigMap key and a running-instance check of innodb_buffer_pool_size. The chart now stores the configuration at data["my.cnf"] and the MariaDB CR references key: my.cnf.…
Out of Scope Changes check Passed The changed files support #4836. The template updates apply the filename fix. The Helm and Chainsaw tests verify the key, reference, rendered settings, and live server setting. Updating existing resou…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…


✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lexfrei
Aleksei Sviridkin (lexfrei) merged commit 6144805 into main Oct 10, 2026
19 checks passed
@lexfrei
Aleksei Sviridkin (lexfrei) deleted the fix/mariadb-mycnf-key branch October 10, 2026 01:38
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) kind/bug Categorizes issue or PR as related to a bug size/L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(apps/mariadb): the chart's my.cnf is mounted without a .cnf extension and the server never reads it

1 participant