Skip to content
Install the CLI

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.

StabilityExperimental
package valuepackages.experimental.stackgres-cluster
Default aliasespostgres

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.

DependencyRequirement
stackgresOperatorRequired
backupIdentityOptional
cloudIdentityOptional
prometheusOptional
sgObjectStorageOptional
storageClassesOptional

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:

    [
    {
    cronSchedule = "0 1 * * *";
    retention = 7;
    }
    ]

Backup compression. Null takes StackGres’s default.

  • Type: null or one of "lz4", "lzma", "zstd", "brotli"
  • Default: null

When to take a base backup, in cron syntax (UTC). Null takes StackGres’s default.

  • Type: null or non-empty string
  • Default: null

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

Base backups to keep. Null takes StackGres’s default.

  • Type: null or (positive integer, meaning >0)
  • Default: null

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: [ ]

Extension name in the StackGres extensions repository.

  • Type: non-empty string

Extension publisher. Null takes the repository’s default.

  • Type: null or non-empty string
  • Default: null

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

Extension version. Null takes the repository’s default.

  • Type: null or non-empty string
  • Default: null

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:

    {
    pods = {
    scheduling = {
    nodeSelector = {
    "example.com/database" = "true";
    };
    };
    };
    }

The SGInstanceProfile spec: CPU and memory per instance, and any other SGInstanceProfile field.

  • Type: open submodule of attribute set of anything
  • Default: { }

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"

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"

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; }

Enable metrics endpoint and monitoring resources (ServiceMonitor, PrometheusRules) when prometheus is available.

  • Type: boolean
  • Default: true

Scrape interval (e.g. ”30s”). Null = use Prometheus default.

  • Type: null or string
  • Default: null

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"

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"

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

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:

    {
    pgBouncer = {
    "pgbouncer.ini" = {
    pgbouncer = {
    pool_mode = "transaction";
    };
    };
    };
    }

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"

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:

    {
    max_connections = "200";
    work_mem = "16MB";
    }

Entries of the SGScript the cluster runs once each (spec.scripts).

  • Type: list of (open submodule of attribute set of anything)
  • Default: [ ]

Database the script runs in. Null runs it in postgres.

  • Type: null or non-empty string
  • Default: null

Script name, shown in the SGCluster status.

  • Type: null or non-empty string
  • Default: null

SQL to run. Set this or scriptFrom.

  • Type: null or string
  • Default: null

A secretKeyRef or configMapKeyRef holding the SQL. Set this or script.

  • Type: null or (attribute set of anything)
  • Default: null