kadet-hub logokadet-hub

PostgreSQL on Kubernetes without Bitnami, with Kapitan

PostgreSQL with CloudNativePG, in place of Bitnami's postgresql and postgresql-ha charts: three instances with automatic failover, the database "app" owned by "app" (password in the Secret app-db-app) and a PgBouncer pooler in transaction mode. Needs the CloudNativePG operator.

Inventory class

inventory/classes/recipes/postgresql.yml, as on the main branch of kadet-hub/examples. A target includes it next to the pins below.

# PostgreSQL with CloudNativePG, in place of Bitnami's postgresql and
# postgresql-ha charts: three instances with automatic failover, the database
# "app" owned by "app" (password in the Secret app-db-app) and a PgBouncer
# pooler in transaction mode. Needs the CloudNativePG operator.
classes:
  - recipes.lib.kubernetes
  - recipes.lib.cloudnative-pg

parameters:
  generators:
    kubernetes:
      namespaces:
        databases: {}
    cloudnative-pg:
      namespace: databases
      clusters:
        app-db:
          instances: 3
          image_name: ghcr.io/cloudnative-pg/postgresql:18.6-system-trixie
          storage: 10Gi
          bootstrap:
            initdb:
              database: app
              owner: app
      poolers:
        app-db-pooler-rw:
          cluster: app-db
          pool_mode: transaction

Compile classes

The class includes one per generator; each compiles its generator once, so a target can combine several recipes.

inventory/classes/recipes/lib/kubernetes.yml

# Compiles the kubernetes generator; recipes include this class, so a target that
# combines several recipes compiles it once.
parameters:
  kapitan:
    compile:
      - {input_type: kadet, output_type: yml, input_paths: [lib/kubernetes], output_path: kubernetes/}

inventory/classes/recipes/lib/cloudnative-pg.yml

# Compiles the cloudnative-pg generator; recipes include this class, so a target that
# combines several recipes compiles it once.
parameters:
  kapitan:
    compile:
      - {input_type: kadet, output_type: yml, input_paths: [lib/cloudnative-pg], output_path: cloudnative-pg/}

Generator pins

The entries of inventory/classes/generators.yml for these generators, pinned by version and digest.

parameters:
  kapitan:
    dependencies:
    - output_path: lib/cloudnative-pg
      source: ghcr.io/kadet-hub/cloudnative-pg:1.0.1@sha256:281417a421b0053070fbdc552f9032a3f8d564c0ca2047ec500842a0d060a8f7
      type: oci
    - output_path: lib/kubernetes
      source: ghcr.io/kadet-hub/kubernetes:1.2.0@sha256:52017626e77dd5bf7293ce465ff0c3dc7a61dae1ae8353a56a53ffebe1bfb67c
      type: oci

How it is checked

The examples CI verifies the signed index and the attestation of every pinned generator, compiles the target, validates the output against the generators' schemas, deploys it to a new kind cluster with the operators above and fails unless the Cluster is Ready and select 1 runs as the app user through the pooler. The Chainsaw test holds the assertions.

All recipes · Bitnami chart alternatives