mysqlprovider

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

pkg/provider/mysql/provider.go

MySQL provider for Orkestra.

Handles the "mysql" block in Katalog declarations. Uses database/sql with the go-sql-driver/mysql driver.

Supported resource kinds:

database — MySQL database / schema (create, drop)
user     — MySQL user (create, update password and privileges, drop)

Installation:

go get github.com/go-sql-driver/mysql

Registration:

p, err := mysqlprovider.NewFromAuth(ctx, auth)
registry.Register(p)

Auth keys (providers[].auth block):

host     — server hostname or IP (default: 127.0.0.1)
port     — server port (default: 3306)
user     — admin user (must have GRANT OPTION)
password — admin password
tls      — false | true | skip-verify | preferred (default: false)

Katalog:

providers:
  - name: mysql
    required: true
    auth:
      host: "$MYSQL_HOST"
      user: "$MYSQL_USER"
      password: "$MYSQL_PASSWORD"

operatorBox:
  providers:
    mysql:
      - database:
          name: "{{ .metadata.name }}"
          charset: utf8mb4
          collation: utf8mb4_unicode_ci

      - user:
          name: "{{ .spec.dbUser }}"
          host: "%"
          database: "{{ .metadata.name }}"
          privileges: "SELECT, INSERT, UPDATE, DELETE"
          credentials:
            secretName: "{{ .metadata.name }}-mysql-creds"   # MYSQL_PASSWORD key

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements orktypes.Provider for the "mysql" block.

func New

func New(dsn string) *Provider

New creates a MySQL provider from a DSN string. DSN format: "user:password@tcp(host:port)/?tls=false&parseTime=true"

func NewFromAuth

func NewFromAuth(ctx context.Context, auth map[string]string) (*Provider, error)

NewFromAuth creates a MySQL provider from a Katalog auth map. Keys: host, port, user, password, tls.

func (*Provider) Delete

func (p *Provider) Delete(ctx context.Context, req orktypes.DeleteRequest) error

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) Reconcile

func (p *Provider) Reconcile(ctx context.Context, req orktypes.ReconcileRequest) error

Jump to

Keyboard shortcuts

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