sql-operator

command module
v1.13.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

README

SqlOperator

Last release Artifact Hub FOSSA 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 operator
apiVersion: stenic.io/v1alpha1
kind: SqlHost
metadata:
  name: integration
spec:
  engine: Mysql
  dsn: sqloperator:xxxxxxxxxxx@tcp(192.168.1.123:3306)/

---
# Create a database on the host
apiVersion: stenic.io/v1alpha1
kind: SqlDatabase
metadata:
  name: application-int-db
spec:
  databaseName: myapp_testing
  hostRef:
    name: integration
  cleanupPolicy: Delete

---
# Create a user on the host
apiVersion: stenic.io/v1alpha1
kind: SqlUser
metadata:
  name: application-int-user
spec:
  credentials:
    username: myapp_username
    password: myapp_password
  hostRef:
    name: integration
  cleanupPolicy: Delete

---
# Add some grant to the user
apiVersion: stenic.io/v1alpha1
kind: SqlGrant
metadata:
  name: application-int-grant
spec:
  userRef:
    name: application-int-user
  databaseRef:
    name: application-int-db
  grants:
    - INSERT
    - SELECT
    - UPDATE
    - DELETE
  cleanupPolicy: Delete

License

FOSSA Status

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the v1alpha1 API group +kubebuilder:object:generate=true +groupName=stenic.io
Package v1alpha1 contains API Schema definitions for the v1alpha1 API group +kubebuilder:object:generate=true +groupName=stenic.io

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL