Skip to content

feat(mysql): support role membership grants - #491

Open
alexjurkiewicz wants to merge 1 commit into
crossplane-contrib:masterfrom
alexjurkiewicz:feat/mysql-role-membership-grants
Open

alexjurkiewicz wants to merge 1 commit into
crossplane-contrib:masterfrom
alexjurkiewicz:feat/mysql-role-membership-grants

Conversation

@alexjurkiewicz

Copy link
Copy Markdown

Description of your changes

Support GRANT <role> TO <user>@<host> for MySQL, following the PostgreSQL model.

apiVersion: mysql.sql.crossplane.io/v1alpha1
kind: Grant
metadata:
  name: appuser-AWS-SELECT-S3-ACCESS
spec:
  forProvider:
    userRef:
      name: appuser
    memberOf: AWS_SELECT_S3_ACCESS

I want this specifically to support granting AWS_SELECT_S3_ACCESS access to users in AWS Aurora.

This implementation works for MySQL and MariaDB, but there are some subtle differences:

  • MySQL supports role and role@host specifiers. The former implies a % host. MariaDB only supports role specifiers
  • MySQL stores role permissions in mysql.role_edges. MariaDB uses mysql.roles_mapping

The implementation papers over these differences (as long as you don't try to grant role@host in MariaDB!).

  • Read and followed Crossplane's contribution process.
  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

  • Tested with MySQL 8.0.46 and MariaDB 12.3.3
  • Ran e2e tests (MariaDB)

Add memberOf to cluster-scoped and namespaced MySQL Grants, following the PostgreSQL membership model. Observe direct memberships through MariaDB or MySQL catalogs and grant or revoke only the requested relationship.

Leave existing privilege grants unchanged. Include API validation, generated manifests, examples, unit tests, opt-in database integration tests, and MariaDB controller E2E coverage.

Signed-off-by: Alex Jurkiewicz <alex@jurkiewi.cz>
@alexjurkiewicz
alexjurkiewicz force-pushed the feat/mysql-role-membership-grants branch from 3a572c7 to d6505de Compare October 30, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant