Reference / experimental
stackgres-cluster
These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.
PostgreSQL cluster run by the StackGres operator (SGCluster)
This page is generated from kix/packages/experimental/stackgres-cluster.
| Stability | Experimental |
package value | packages.experimental.stackgres-cluster |
| Default aliases | postgres |
How-to guides
Section titled “How-to guides”Dependencies
Section titled “Dependencies”Kix matches each dependency below to another package instance by instance name, alias, or role. To bind a specific instance, set deps.<name> in your cluster definition. See Declaring dependencies for how required and optional dependencies work.
| Dependency | Requirement |
|---|---|
stackgresOperator | Required |
backupIdentity | Optional |
cloudIdentity | Optional |
prometheus | Optional |
sgObjectStorage | Optional |
storageClasses | Optional |
Options
Section titled “Options”backups
Section titled “backups”Entries of spec.configurations.backups, each wired to the
sgObjectStorage dependency’s SGObjectStorage. Requires that
dependency in this namespace when non-null. Takes at most one entry,
because StackGres schedules backups only from the first entry.
-
Type:
null or (list of (open submodule of attribute set of anything)) -
Default:
null -
Example:
1[2{3cronSchedule = "0 1 * * *";4retention = 7;5}6]
backups.*.compression
Section titled “backups.*.compression”Backup compression. Null takes StackGres’s default.
- Type:
null or one of "lz4", "lzma", "zstd", "brotli" - Default:
null
backups.*.cronSchedule
Section titled “backups.*.cronSchedule”When to take a base backup, in cron syntax (UTC). Null takes StackGres’s default.
- Type:
null or non-empty string - Default:
null
backups.*.reconciliationTimeout
Section titled “backups.*.reconciliationTimeout”Seconds StackGres allows, after each backup, for deleting the base backups and WAL that retention no longer keeps. StackGres’s own default is 300. A database that archives tens of thousands of WAL segments a day cannot delete them in that time: the delete is cut off, the backup still succeeds, and the bucket grows without limit. Null takes StackGres’s default.
- Type:
null or (positive integer, meaning >0) - Default:
3600
backups.*.retention
Section titled “backups.*.retention”Base backups to keep. Null takes StackGres’s default.
- Type:
null or (positive integer, meaning >0) - Default:
null
extensions
Section titled “extensions”Extensions the operator installs (spec.postgres.extensions). A
stackgres-database instance on this cluster injects the extensions it
requests, so list here only extensions no database requests. Entries
with the same name are merged; vchord adds vector and is preloaded.
- Type:
list of (submodule) - Default:
[ ]
extensions.*.name
Section titled “extensions.*.name”Extension name in the StackGres extensions repository.
- Type:
non-empty string
extensions.*.publisher
Section titled “extensions.*.publisher”Extension publisher. Null takes the repository’s default.
- Type:
null or non-empty string - Default:
null
extensions.*.repository
Section titled “extensions.*.repository”Base URL of the extensions repository to install from. Null lets the operator choose from its SGConfig.
- Type:
null or non-empty string - Default:
null
extensions.*.version
Section titled “extensions.*.version”Extension version. Null takes the repository’s default.
- Type:
null or non-empty string - Default:
null
extraSpec
Section titled “extraSpec”Merged over the SGCluster spec. Refused: instances,
postgres.version, postgres.extensions, postgres.flavor,
sgInstanceProfile, configurations.sgPostgresConfig,
configurations.sgPoolingConfig, configurations.backups,
managedSql.scripts, pods.persistentVolume.size,
pods.persistentVolume.storageClass, pods.disableConnectionPooling,
and pods.disableEnvoy = false. pods.scheduling.topologySpreadConstraints
replaces the spread derived from the availability level. A
non-production profile or
nonProductionOptions.disableClusterPodAntiAffinity = true is refused
at availability node or zone with more than one instance.
-
Type:
attribute set of anything -
Default:
{ } -
Example:
1{2pods = {3scheduling = {4nodeSelector = {5"example.com/database" = "true";6};7};8};9}
instanceProfile
Section titled “instanceProfile”The SGInstanceProfile spec: CPU and memory per instance, and any other SGInstanceProfile field.
- Type:
open submodule of attribute set of anything - Default:
{ }
instanceProfile.cpu
Section titled “instanceProfile.cpu”CPU per instance, for the PostgreSQL container and the sidecars StackGres sizes from it.
- Type:
Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei) - Default:
"1"
instanceProfile.memory
Section titled “instanceProfile.memory”Memory per instance.
- Type:
Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei) - Default:
"2Gi"
instances
Section titled “instances”PostgreSQL instances (spec.instances): one primary, the rest streaming replicas that Patroni fails over to.
- Type:
positive integer, meaning >0 - Default:
kix.availability.pick availability { none = 1; pod = 2; node = 2; zone = 2; }
metrics.enabled
Section titled “metrics.enabled”Enable metrics endpoint and monitoring resources (ServiceMonitor, PrometheusRules) when prometheus is available.
- Type:
boolean - Default:
true
metrics.interval
Section titled “metrics.interval”Scrape interval (e.g. ”30s”). Null = use Prometheus default.
- Type:
null or string - Default:
null
metrics.maxReplicationLag
Section titled “metrics.maxReplicationLag”Maximum replay lag before StackGresReplicationLagHigh fires, as a Prometheus duration.
- Type:
string matching the pattern ([0-9]+(ms|s|m|h|d|w|y))+ - Default:
"5m" - Example:
"30s"
persistentVolume.size
Section titled “persistentVolume.size”Size of each instance’s data volume.
- Type:
Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei) - Default:
"20Gi"
persistentVolume.storageClass
Section titled “persistentVolume.storageClass”StorageClass of the data volumes. Null takes the storageClasses dependency’s class, or the cluster’s default class without one.
- Type:
null or non-empty string - Default:
null
pooling
Section titled “pooling”SGPoolingConfig spec. Non-null creates it and enables the PgBouncer
sidecar ({ } uses StackGres’s defaults). Null runs no pooler, so
clients connect to PostgreSQL directly.
-
Type:
null or (attribute set of anything) -
Default:
null -
Example:
1{2pgBouncer = {3"pgbouncer.ini" = {4pgbouncer = {5pool_mode = "transaction";6};7};8};9}
postgres.version
Section titled “postgres.version”PostgreSQL major ("17") or minor ("17.11"), checked against the
versions the operator’s release ships. A major selects its newest minor
when the cluster is created. Changing the major requires an SGDbOps of
type majorVersionUpgrade.
- Type:
string - Default:
"17"
postgresqlConf
Section titled “postgresqlConf”postgresql.conf parameters, merged over StackGres’s defaults and the
keys the package sets (archive_timeout when backups is set, and
shared_preload_libraries when an extension needs preloading). Null
removes a package key.
-
Type:
attribute set of (null or string) -
Default:
{ } -
Example:
1{2max_connections = "200";3work_mem = "16MB";4}
scripts
Section titled “scripts”Entries of the SGScript the cluster runs once each (spec.scripts).
- Type:
list of (open submodule of attribute set of anything) - Default:
[ ]
scripts.*.database
Section titled “scripts.*.database”Database the script runs in. Null runs it in postgres.
- Type:
null or non-empty string - Default:
null
scripts.*.name
Section titled “scripts.*.name”Script name, shown in the SGCluster status.
- Type:
null or non-empty string - Default:
null
scripts.*.script
Section titled “scripts.*.script”SQL to run. Set this or scriptFrom.
- Type:
null or string - Default:
null
scripts.*.scriptFrom
Section titled “scripts.*.scriptFrom”A secretKeyRef or configMapKeyRef holding the SQL. Set this or script.
- Type:
null or (attribute set of anything) - Default:
null