go-sql-proxy

by mattmattox503

Helm chartv0.3.21App 0.3.21

This project implements a SQL proxy server in Golang that acts as an intermediary between a client and a MySQL server. The proxy server can handle protocol decoding and data transfer while measuring and updating metrics for monitoring purposes.

About this chart

go-sql-proxy Helm Chart

This Helm chart deploys the go-sql-proxy MySQL proxy server on Kubernetes.

Installation

helm install my-proxy ./charts/go-sql-proxy

Configuration

The following table lists the configurable parameters of the go-sql-proxy chart and their default values.

ParameterDescriptionDefault
settings.bind.hostBind address for proxy0.0.0.0
settings.bind.portBind port for proxy3306
settings.debugEnable debug loggingfalse
settings.metrics.enabledEnable metrics endpointtrue
settings.metrics.portMetrics port9090
settings.source.hostTarget MySQL server hostnameexample.db.ondigitalocean.com
settings.source.portTarget MySQL server port25060
settings.source.userMySQL usernamedoadmin
settings.source.passwordMySQL passwordpassword
settings.source.databaseDefault database namedefaultdb
settings.ssl.enabledEnable SSL/TLS connectionfalse
settings.ssl.skipVerifySkip SSL certificate verificationfalse
settings.ssl.caFilePath to CA certificate file""
settings.ssl.certFilePath to client certificate file""
settings.ssl.keyFilePath to client key file""

SSL/TLS Configuration

To connect to SSL-enabled MySQL servers (like PlanetScale), enable SSL:

settings:
  source:
    host: your-database.planetscale.com
    port: 3306
  ssl:
    enabled: true
    skipVerify: true  # For self-signed certificates

For proper certificate verification, provide CA certificate:

settings:
  ssl:
    enabled: true
    skipVerify: false
    caFile: /path/to/ca.pem

For mutual TLS authentication:

settings:
  ssl:
    enabled: true
    certFile: /path/to/client-cert.pem
    keyFile: /path/to/client-key.pem

Monitoring

The proxy exposes Prometheus metrics on the configured metrics port:

  • /metrics - Prometheus metrics
  • /healthz - Liveness probe
  • /readyz - Readiness probe
  • /version - Version information

Deploy go-sql-proxy with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has go-sql-proxy on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartgo-sql-proxy is pinned at v0.3.21 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply