Skip to content

[MISC] 8.4 - Cleanup K8s legacy permissions fix#167

Open
sinclert-canonical wants to merge 1 commit into8.4/edgefrom
sinclert/legacy-data-dir-fix
Open

[MISC] 8.4 - Cleanup K8s legacy permissions fix#167
sinclert-canonical wants to merge 1 commit into8.4/edgefrom
sinclert/legacy-data-dir-fix

Conversation

@sinclert-canonical
Copy link
Contributor

@sinclert-canonical sinclert-canonical commented Mar 19, 2026

This PR removes an old MySQL data directory permissions fix, reverting this old PR.

As far as I understand, we are already setting the permissions in the charmed MySQL rock (see code), but the /var/lib/mysql folder does not exist yet. To that end, I am proposing to explicitly create such folder before the ownership change takes place (see PR). This will need to be updated, pointing at the new image SHA.


Required for MySQL K8s charm in root-less mode.

@sinclert-canonical sinclert-canonical added the not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes label Mar 19, 2026
@github-actions github-actions bot added the Libraries: Out of sync The charm libs used are out-of-sync label Mar 19, 2026
@sinclert-canonical sinclert-canonical changed the title [MISC] Cleanup K8s legacy permissions fix [MISC] 8.4 - Cleanup K8s legacy permissions fix Mar 19, 2026
@sinclert-canonical sinclert-canonical marked this pull request as ready for review March 19, 2026 17:31
@astrojuanlu
Copy link
Contributor

I'm confused. The changes in the MySQL rock predate canonical/mysql-k8s-operator#238 by a few months 🤔

@sinclert-canonical
Copy link
Contributor Author

I'm confused. The changes in the MySQL rock predate canonical/mysql-k8s-operator#238 by a few months

Yes, let me figure out why. Worst case, we make changes to the charmed rock first, then bump the rock SHA-256 to point at the upcoming rock, alongside this cleanup.

@sinclert-canonical
Copy link
Contributor Author

sinclert-canonical commented Mar 20, 2026

I'm confused. The changes in the MySQL rock predate canonical/mysql-k8s-operator#238 by a few months

Spent a bit of time figuring out what was wrong:

In fact, the bug described in the removed function doc-string is still there: when initializing the MySQL data directory within the charm, the /var/lib/mysql folder belongs to root, while doing so directly into the rock (by locally building it, copying it to Docker, and SSH-ing into a runner container), makes it belong to mysql.

Therefore, in order to prevent a regression in the charm behavior when initializing the MySQL data directory, such directory needs to be created + changed ownership in the rock. I tested this approach in this PR, and apparently MySQL can initialize the data directory, even if it already exists, as long as it is completely empty.

I will update the PR description accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Libraries: Out of sync The charm libs used are out-of-sync not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants