castai-db-optimizer

by Cast AI

Helm chartv0.80.2Verified publisher

CAST AI database cache deployment.

About this chart

castai-db-optimizer

CAST AI database 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"]}]}]}},"podAntiAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":[{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/name","operator":"In","values":["APP_NAME"]}]},"topologyKey":"kubernetes.io/hostname"}]}}Pod affinity rules. Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
apiKeystring""Token to be used for authorizing access to the CAST AI API.
apiKeySecretRefstring""Name of secret with Token to be used for authorizing DBO access to the API apiKey and apiKeySecretRef are mutually exclusive The referenced secret must provide the token in .data["API_KEY"].
apiURLstring"api.cast.ai"URL to the CAST AI API server.
cacheGroupIDstring""ID of the cache group for which cache configuration should be pulled.
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
cloudSqlProxy.privateIpboolfalseHave the proxy connect over private IP if connecting from a VPC-native GKE cluster
cloudSqlProxyImage.pullPolicystring"IfNotPresent"
cloudSqlProxyImage.repositorystring"gcr.io/cloud-sql-connectors/cloud-sql-proxy"
cloudSqlProxyImage.tagstring""
commonAnnotationsobject{}Annotations to add to all resources.
commonLabelsobject{}Labels to add to all resources.
dnsConfigobject{}Pod DNS configuration. Ref: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config
dnsPolicystring""Pod DNS policy. WARNING: If using dnsPolicy "None" with custom nameservers, ensure they can resolve cluster-internal DNS names (*.svc.cluster.local) for peer discovery to work correctly with the headless service. Ref: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy
endpointslist[{"hostname":"sample-db-hostname","name":null,"port":5433,"serviceDiscovery":{"dns_lookup_family":"ALL","dns_refresh_rate":"5s","respect_dns_ttl":true,"type":"LOGICAL_DNS"},"servicePort":5432,"targetPort":5432}]A list of upstream database endpoints
endpoints[0].hostnamestring"sample-db-hostname"Hostname of the upstream database instance.
endpoints[0].namestringnilName of the service. If this value is not empty, then additional cluster IP service will be deployed, using provided name as a suffix
endpoints[0].portint5433Port for the endpoint on DBO pod.
endpoints[0].serviceDiscoveryobject{"dns_lookup_family":"ALL","dns_refresh_rate":"5s","respect_dns_ttl":true,"type":"LOGICAL_DNS"}Envoy service discovery settings. Ref: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/cluster/v3/cluster.proto.html
endpoints[0].serviceDiscovery.dns_refresh_ratestring"5s"DNS refresh rate (must be specified in seconds, e.g., 5s).
endpoints[0].serviceDiscovery.typestring"LOGICAL_DNS"The service discovery type to use for resolving the cluster. Available options: LOGICAL_DNS and STRICT_DNS. Ref: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/service_discovery
endpoints[0].servicePortint5432Port of the named service
endpoints[0].targetPortint5432Port of the upstream database instance.
nodeSelectorobject{}Pod node selector rules. Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
organizationIDstring""ID of the organization
pgdog.configobject{"checkout_timeout":10000,"connect_timeout":5000,"default_pool_size":500,"healthcheck_interval":30000,"healthcheck_timeout":5000,"idle_healthcheck_delay":5000,"idle_healthcheck_interval":30000,"log_connections":false,"log_disconnections":false,"passthrough_auth":"enabled_plain","pooler_mode":"transaction","prepared_statements":"extended_anonymous","query_cache_limit":500,"query_parser":"on","rollback_timeout":5000,"shutdown_timeout":60000,"tls_certificate":"/etc/ssl/certs/ssl-cert-snakeoil.pem","tls_private_key":"/etc/ssl/private/ssl-cert-snakeoil.key","tls_verify":"prefer","workers":10}Pgdog general configuration settings. Corresponds to [general] section in pgdog.toml: https://docs.pgdog.dev/configuration/pgdog.toml/general/.
pgdog.config.checkout_timeoutint10000Maximum amount of time a client is allowed to wait for a connection from the pool (in milliseconds)
pgdog.config.connect_timeoutint5000Maximum amount of time to allow for PgDog to create a connection to Postgres (in milliseconds)
pgdog.config.default_pool_sizeint500Default maximum number of server connections per database pool
pgdog.config.healthcheck_intervalint30000Frequency of healthchecks performed by PgDog to ensure connections provided to clients from the pool are working (in milliseconds)
pgdog.config.healthcheck_timeoutint5000Health check timeout in milliseconds (custom field, not in official pgdog docs)
pgdog.config.idle_healthcheck_delayint5000Delay running idle healthchecks at PgDog startup to give databases (and pools) time to spin up (in milliseconds)
pgdog.config.idle_healthcheck_intervalint30000Frequency of healthchecks performed by PgDog on idle connections (in milliseconds)
pgdog.config.log_connectionsboolfalseIf enabled, log every time a user creates a new connection to PgDog
pgdog.config.log_disconnectionsboolfalseIf enabled, log every time a user disconnects from PgDog
pgdog.config.passthrough_authstring"enabled_plain"Enables/disable passthrough authentication. Option: "enabled_plain", "disabled". Although PgDog supports just "enabled", we do not as communication is container-container and using TLS would only add unnecessary overhead
pgdog.config.pooler_modestring"transaction"Default pooler mode to use for database pools. Options: "session", "transaction", "statement"
pgdog.config.prepared_statementsstring"extended_anonymous"Enables prepared statement support with varying levels of rewriting capability. Options: "disabled", "extended", "extended_anonymous", "full"
pgdog.config.query_cache_limitint500Maximum number of entries in the query cache
pgdog.config.query_parserstring"on"Force-enable query parsing for advanced features like advisory locks in non-sharded databases
pgdog.config.rollback_timeoutint5000How long to allow for ROLLBACK queries to run on server connections with unfinished transactions (in milliseconds)
pgdog.config.shutdown_timeoutint60000How long to wait for active clients to finish transactions when shutting down (in milliseconds)
pgdog.config.tls_certificatestring"/etc/ssl/certs/ssl-cert-snakeoil.pem"Path to the TLS certificate PgDog will use to setup TLS connections with clients
pgdog.config.tls_private_keystring"/etc/ssl/private/ssl-cert-snakeoil.key"Path to the TLS private key PgDog will use to setup TLS connections with clients
pgdog.config.tls_verifystring"prefer"Determines how TLS connections to Postgres servers are handled. Options: "none", "prefer", "verify_ca", "verify_full"
pgdog.config.workersint10Count of Tokio threads spawned at startup; recommended setting is two per virtual CPU
pgdog.enabledboolfalseEnable pgdog connection pooler sidecar
pgdog.logLevelstring"warn"Log level for PgDog
pgdog.passwordstring""Pgdog password (plain string). Mutually exclusive with usersSecretRef
pgdog.resources.cpustring"500m"
pgdog.resources.memorystring"256Mi"
pgdog.userstring""Pgdog user (plain string). Mutually exclusive with usersSecretRef
pgdog.usersSecretRefstring""Reference to existing secret containing users.toml file. Mutually exclusive with user/password The secret must contain a key named "users.toml" with the pgdog users configuration
pgdogImage.pullPolicystring"IfNotPresent"
pgdogImage.repositorystring"ghcr.io/pgdogdev/pgdog"
pgdogImage.tagstring""
podAnnotationsobject{}Extra annotations to add to the pod.
podLabelsobject{}Extra labels to add to the pod.
protocolstring"PostgreSQL"Specifies database protocol to be used for communication and query parsing.
proxy.cacheobject{"cacheShards":0,"cacheSizeBytes":2147483648,"pendingShards":0,"pendingSizeBytes":134217728}Cache configuration
proxy.cache.cacheShardsint0Number of cache shards must be power of 2. Use 0 to auto-calculate based on concurrency.
proxy.cache.cacheSizeBytesint2147483648Maximum cache size in bytes, should be divisible by cacheShards
proxy.cache.pendingShardsint0Number of in-flight cache shards must be power of 2. Use 0 to auto-calculate based on concurrency.
proxy.cache.pendingSizeBytesint134217728Maximum size of in-flight cache entries, should be divisible by pendingShards
proxy.concurrencyint0Number of parallel processing streams. Use 0 to auto-calculate based on CPU limits.
proxy.connectionLimitsobject{"maxConnections":10000,"maxPendingRequests":1024,"maxRequests":1024,"maxRetries":3}Envoy upstream connection limits, numbers given are the envoy defaults.
proxy.coredumpCollectionModestring"None"Disable core dump collection by default
proxy.dataStorageMediumstring"Memory"Defines "emptyDir.medium" value for data storage volume. Set to "Memory" for tmpfs disk
proxy.dnsLookupFamilystring"V4_PREFERRED"DNS lookup mode when communicating to outside. will prioritize IPV4 addresses. change to V6_ONLY to use v6 addresses instead.
proxy.drainingobject{"enabled":false,"gracePeriodSeconds":30}Graceful draining configuration.
proxy.draining.enabledboolfalseEnable graceful draining of connections before pod termination.
proxy.draining.gracePeriodSecondsint30How long to actively attempt draining existing connections.
proxy.logLevelstring"filter:info"Default proxy log level.
proxy.networkDebugboolfalseExtra network debug logging.
proxy.tlsSecretNamestringnilName of a Kubernetes TLS Secret that contains the key pair to use for configuring TLS in the proxy. If not set, defaults to using a built-in key pair.
proxyImage.pullPolicystring"IfNotPresent"
proxyImage.repositorystring"us-docker.pkg.dev/castai-hub/library/dbo-proxy"
proxyImage.tagstring""
proxySql.basePortint6033Starting port from which ProxySQL internal listening ports are sequentially assigned per endpoint. These ports are pod-internal (Envoy → ProxySQL) and must not conflict with endpoint.port values.
proxySql.config.auto_increment_delay_multiplexint5Delay multiplexing for N queries after auto-increment INSERT
proxySql.config.connect_timeout_serverint5000Backend connection timeout in milliseconds
proxySql.config.default_query_timeoutint36000000Default query timeout in milliseconds
proxySql.config.free_connections_pctint5Percentage of free connections to keep in pool
proxySql.config.have_compressbooltrueEnable have_compress
proxySql.config.max_backend_connectionsint100Maximum connections per backend server
proxySql.config.max_connectionsint2048Maximum client connections ProxySQL accepts
proxySql.config.multiplexingbooltrueEnable connection multiplexing
proxySql.config.stacksizeint1048576Stacksize for ProxySQL threads
proxySql.config.threadsint4Number of ProxySQL threads
proxySql.enabledboolfalseEnable ProxySQL pooler sidecar (MySQL only)
proxySql.passwordstring""Single ProxySQL upstream DB password (plain string). Mutually exclusive with users/usersSecretRef.
proxySql.resources.cpustring"500m"
proxySql.resources.memorystring"256Mi"
proxySql.userstring""Single ProxySQL upstream DB user (plain string). Mutually exclusive with users/usersSecretRef.
proxySql.userslist[]Multiple ProxySQL upstream DB users (inline list). Mutually exclusive with user/usersSecretRef. Example: [{username: "u1", password: "p1"}, {username: "u2", password: "p2"}]
proxySql.usersSecretRefstring""Reference to existing secret containing a users.json key with a JSON array of {username, password} objects. Mutually exclusive with user/users.
proxySqlImage.pullPolicystring"IfNotPresent"
proxySqlImage.repositorystring"docker.io/proxysql/proxysql"
proxySq

Deploy castai-db-optimizer 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-optimizer 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-optimizer is pinned at v0.80.2 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