Skip to content

Repository files navigation

SqlOperator

Last releaseArtifact HubFOSSA Status

Operate sql databases, users and grants.

This is a WIP project and should not at all be used in production at this time. Feel free to validate in CI pipelines.

Engines

Currenty, only MySQL is supported.

Installation

kubectl create namespace sql-operator
helm repo add sql-operator https://stenic.github.io/sql-operator/
helm install sql-operator --namespace sql-operator sql-operator/sql-operator

Objects

SqlHost

The SqlHost object contains information how the operator should connect to the remote server. Note that this information should be protected using rbac.

SqlDatabase

The SqlDatabase object manages a database on the referenced SqlHost.

SqlUser

The SqlUser object manages a user on the referenced SqlHost.

SqlGrant

The SqlGrant object manages the grant for the referenced SqlUser on the referenced SqlDatabase.

Example

The following example registeres a SqlHost pointing to a shared integration host and creates a database, user and grants to run integration tests for the application.

---
# Register a host - Not created by the operatorapiVersion: stenic.io/v1alpha1kind: SqlHostmetadata:
name: integrationspec:
engine: Mysqldsn: sqloperator:xxxxxxxxxxx@tcp(192.168.1.123:3306)/
---
# Create a database on the hostapiVersion: stenic.io/v1alpha1kind: SqlDatabasemetadata:
name: application-int-dbspec:
databaseName: myapp_testinghostRef:
name: integrationcleanupPolicy: Delete
---
# Create a user on the hostapiVersion: stenic.io/v1alpha1kind: SqlUsermetadata:
name: application-int-userspec:
credentials:
username: myapp_usernamepassword: myapp_passwordhostRef:
name: integrationcleanupPolicy: Delete
---
# Add some grant to the userapiVersion: stenic.io/v1alpha1kind: SqlGrantmetadata:
name: application-int-grantspec:
userRef:
name: application-int-userdatabaseRef:
name: application-int-dbgrants:
- INSERT
- SELECT
- UPDATE
- DELETEcleanupPolicy: Delete

License

FOSSA Status

About

Manage SQL databases, users and grant using kubernetes manifests

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages