castai-db-proxy

by Cast AI

Helm chartv0.39.0Verified publisher

CAST AI database proxy cache deployment.

About this chart

castai-db-proxy

CAST AI database proxy cache deployment.

Values

KeyTypeDefaultDescription
affinityobject{"nodeAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"preference":{"matchExpressions":[{"key":"provisioner.cast.ai/managed-by","operator":"In","values":["cast.ai"]}]},"weight":100}],"requiredDuringSchedulingIgnoredDuringExecution":{"nodeSelectorTerms":[{"matchExpressions":[{"key":"kubernetes.io/os","operator":"NotIn","values":["windows"]},{"key":"kubernetes.io/arch","operator":"In","values":["amd64","arm64"]}]}]}},"podAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["APP_NAME"]},{"key":"app.kubernetes.io/component","operator":"In","values":["pooling"]}]},"topologyKey":"topology.kubernetes.io/zone"},"weight":100}]},"podAntiAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":[{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["APP_NAME"]},{"key":"app.kubernetes.io/component","operator":"In","values":["proxy"]}]},"topologyKey":"kubernetes.io/hostname"}]}}Pod affinity rules.
apiKeystring""Token to be used for authorizing access to the CAST AI API.
apiKeySecretRefstring""Name of secret with Token to be used for authorizing access to the API. apiKey and apiKeySecretRef are mutually exclusive. The referenced secret must provide the token in .data["API_KEY"].
apiURLstring"api-grpc.cast.ai"URL to the CAST AI gRPC API server.
cache.analysisMemoMiBint512Memory in MiB each proxy pod may use to remember how it analyzed each SQL statement, so repeated statements skip parsing. Also caps the largest statement it can remember. Raise it if the pod has spare memory and the workload sends many distinct or very large statements.
cache.defaultTTLSecsint300Default TTL for cached results in seconds.
cloudSqlProxy.autoIamAuthnboolfalseHave the proxy connect with Automatic IAM authentication.
cloudSqlProxy.basePortint10000Starting number from which unique ports are sequentially assigned to each upstream Cloud SQL instance.
cloudSqlProxy.enabledboolfalseEnable Cloud SQL Proxy sidecar for GCP Cloud SQL connections.
cloudSqlProxy.privateIpboolfalseHave the proxy connect over private IP if connecting from a VPC-native GKE cluster.
cloudSqlProxy.resources.requests.cpustring"1"
cloudSqlProxy.resources.requests.memorystring"2Gi"
cloudSqlProxyImage.pullPolicystring"IfNotPresent"
cloudSqlProxyImage.repositorystring"gcr.io/cloud-sql-connectors/cloud-sql-proxy"
cloudSqlProxyImage.tagstring""Overrides the image tag. Defaults to the chart's default Cloud SQL Proxy version.
cluster.connectionsPerPeerstring""Connections each pod opens to every peer. Leave empty to use one per worker thread (see serverThreads), which lets peer traffic grow with resources.cpu. Set explicitly only to override that.
cluster.enabledbooltrueEnable distributed cache cluster mode.
cluster.refresh_interval_secondsint10Refresh interval of DNS for peer discovery in seconds.
commonAnnotationsobject{}Annotations to add to all resources.
commonLabelsobject{}Labels to add to all resources.
connection_drainingobject{"grace_period_seconds":55,"graceful_shutdown_timeout_seconds":5,"pre_stop_sleep_seconds":10}Connection draining configuration
connection_draining.grace_period_secondsint55How long existing connections have to finish after SIGTERM. Must be > 0
connection_draining.graceful_shutdown_timeout_secondsint5How long the server waits for runtimes to shut down after the grace period. Must be > 0
connection_draining.pre_stop_sleep_secondsint10How long the pod's preStop hook sleeps before SIGTERM is delivered to the proxy (and to the pooler containers, when pooling is enabled). This gives the service endpoint propagation time to complete cluster-wide so no new traffic is routed to the pod while it drains existing connections. Pooler pods get this preStop time plus 65s (pgdog shutdown_timeout 60s + 5s margin) to terminate. Set to 0 to disable.
dnsConfigobject{}Pod DNS configuration.
dnsPolicystring""Pod DNS policy.
endpointslist[]Upstream database endpoints. Each entry needs address (host:port) and readonly (bool).
image.pullPolicystring"IfNotPresent"
image.repositorystring"ghcr.io/castai/images/db-proxy"
image.tagstring""Overrides the image tag. Defaults to Chart.appVersion.
keepaliveobject{"count":3,"idle_seconds":60,"interval_seconds":10}TCP keepalive for client and database connections. Probing is the only way to tell a connection whose far end vanished without closing (an evicted pod, a lost node, a killed database instance etc.) from one that is merely idle. Without it the proxy would wait on a read that will never complete, holding the connection and the database session behind it until the pod restarts.
keepalive.countint3Unanswered probes before the connection is dropped.
keepalive.idle_secondsint60How long a connection may sit idle before the first probe.
keepalive.interval_secondsint10Gap between probes once they start.
logLevelstring"info"Application log level. Supports "trace", "debug", "info", "warn", "error"
nodeSelectorobject{}Pod node selector rules.
operationalMetricsFlushIntervalSecondsint15Interval in seconds to flush operational metrics. Must be greater than 0.
organizationIDstring""ID of the organization.
podAnnotationsobject{}Extra annotations to add to the pod.
podLabelsobject{}Extra labels to add to the pod.
pooling.affinityobject{"podAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["APP_NAME"]},{"key":"app.kubernetes.io/component","operator":"In","values":["proxy"]}]},"topologyKey":"topology.kubernetes.io/zone"},"weight":100}]},"podAntiAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":[{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["APP_NAME"]},{"key":"app.kubernetes.io/component","operator":"In","values":["pooling"]}]},"topologyKey":"kubernetes.io/hostname"}]}}Affinity rules for the pooler pods. The default prefers co-locating pooler pods in the same availability zones as the proxy pods, so proxy-to-pooler traffic stays in-zone, and never schedules two pooler pods on the same node, so a single node failure cannot take down every pooler. The APP_NAME placeholder is replaced with the release name at render time.
pooling.configManagerobject{"discovery":{"refresh_interval_seconds":10},"image":{"pullPolicy":"IfNotPresent","repository":"ghcr.io/castai/images/db-pooling","tag":""},"port":50051,"report_metrics_frequency_seconds":15,"resources":{"cpu":"10m","memoryLimit":"32Mi","memoryRequest":"32Mi"}}Configuration for the pooling configuration manager.
pooling.configManager.discoveryobject{"refresh_interval_seconds":10}Peer discovery settings.
pooling.configManager.discovery.refresh_interval_secondsint10Refresh interval of DNS for peer discovery in seconds.
pooling.configManager.portint50051gRPC listen port for the config manager.
pooling.configManager.report_metrics_frequency_secondsint15Frequency in which pooling metrics are reported in seconds.
pooling.databaseslist["postgres"]Pre-configured database names.
pooling.directConnectobject{"enabled":false,"ports":{"readOnly":6144,"readWrite":6143}}Ports that bypass the pooler and route straight to configured endpoints.
pooling.directConnect.enabledboolfalseServe the direct ports alongside the pooled ones.
pooling.directConnect.ports.readOnlyint6144Port the proxy listens on for direct read-only connections. Only used when a read-only endpoint is configured.
pooling.directConnect.ports.readWriteint6143Port the proxy listens on for direct read-write connections.
pooling.enabledboolfalseDeploy the pooling config manager.
pooling.metricsPortint9090Pooler metrics port.
pooling.pgdogobject{"admin":{"name":"pgdog_admin","password":"admin","user":"admin"},"config":{},"image":{"pullPolicy":"IfNotPresent","repository":"ghcr.io/castai/images/pgdogdev/pgdog","tag":""},"logLevel":"warn","port":5432,"resources":{"cpu":"1","memoryLimit":"1Gi","memoryRequest":"1Gi"}}Configure the PgDog section to deploy PgDog as the pooler.
pooling.pgdog.configobject{}PgDog [general] config overrides. Merged on top of template defaults (health checks, timeouts, passthrough_auth, log settings). Any key-value pair added here will be rendered into pgdog.toml. See https://docs.pgdog.dev/configuration/pgdog.toml/general/
pooling.pgdog.logLevelstring"warn"Log level for PgDog.
pooling.pgdog.portint5432Pooler listen port. Proxy connects to the pooler on this port.
pooling.podAnnotationsobject{}Extra annotations to add to the pooler pods.
pooling.podLabelsobject{}Extra labels to add to the pooler pods.
pooling.proxySqlobject{"config":{"auto_increment_delay_multiplex":5,"connect_timeout_server":5000,"default_query_timeout":36000000,"free_connections_pct":5,"have_compress":true,"max_backend_connections":100,"max_connections":2048,"multiplexing":true,"stacksize":1048576,"threads":4},"image":{"pullPolicy":"IfNotPresent","repository":"ghcr.io/castai/images/proxysql/proxysql","tag":""},"ports":{"readOnly":6402,"readWrite":6401},"resources":{"cpu":"1","memoryLimit":"1Gi","memoryRequest":"1Gi"},"userSecretRef":"","usersSecretRef":""}Configure the ProxySQL section to deploy ProxySQL as the pooler (MySQL only). Mutually exclusive with pgdog. Requires protocol: "MySQL".
pooling.proxySql.ports.readOnlyint6402Listening port for read-only connections.
pooling.proxySql.ports.readWriteint6401Listening port for read-write connections.
pooling.proxySql.userSecretRefstring""Deprecated: use usersSecretRef. Name of an existing Secret holding a single user's credentials in the DATABASE_USERNAME and DATABASE_PASSWORD data keys. May be combined with usersSecretRef.
pooling.proxySql.usersSecretRefstring""Name of an existing Secret listing the upstream DB users that clients may log in to ProxySQL as. ProxySQL authenticates client connections against these users and opens backend connections with the same credentials, so every application user connecting through the pooler must be listed. The Secret must have a users.json key holding a JSON array of {"username": ..., "password": ...} objects. Pooler pods read it at startup: run kubectl rollout restart deployment/<release>-pooler after changing it. Example: cat > users.json <<'EOF' [ {"username": "orders_app", "password": ""}, {"username": "billing_app", "password": ""} ] EOF kubectl create secret generic db-proxy-users --from-file=users.json
pooling.replicasint2Number of pooler replicas.
pooling.rollingUpdateobject{"maxSurge":1,"maxUnavailable":0}Rolling update strategy configuration for the pooler deployment.
pooling.rollingUpdate.maxSurgeint1Maximum number of pooler pods that can be created above the desired number during an update.
pooling.rollingUpdate.maxUnavailableint0Maximum number of pooler pods that can be unavailable during an update.
pooling.topologySpreadConstraintslist[{"labelSelector":{"matchLabels":{"app.kubernetes.io/component":"pooling","app.kubernetes.io/name":"APP_NAME"}},"maxSkew":1,"topologyKey":"topology.kubernetes.io/zone","whenUnsatisfiable":"ScheduleAnyway"}]Pod topology spread constraints for the pooler pods. The APP_NAME placeholder is replaced with the release name at render time.
ports.clusterint9050Cluster peer communication port.
ports.metricsint9090Prometheus metrics port.
ports.readOnlyint6142Port the proxy listens on for read-only connections. Only used when a read-only upstream endpoint is configured: clients then connect through the <release>-ro service, which exposes the protocol's default port targeting this port.
ports.readWriteint6141Port the proxy listens on for read-write connections. Clients connect through the release service, which exposes the protocol's default port (5432 PostgreSQL, 3306 MySQL) targeting this port.
priorityClass.createbooltrueWhether the chart creates the PriorityClass. Set to false to reference a PriorityClass that already exists in the cluster.
priorityClass.namestring"castai-db-proxy"Name of the PriorityClass assigned to the proxy and pooler pods. When installing multiple releases into one cluster, set a unique name per release to avoid collisions over the shared cluster-scoped resource. Set to "" to disable entirely: pods then keep the cluster default priority.
priorityClass.valueint1000000000Priority value of the created class (only used with create: true). 1,000,000,000 is the maximum us

Deploy castai-db-proxy with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has castai-db-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 chartcastai-db-proxy is pinned at v0.39.0 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