Repository navigation
Description
Part of #1318 · the largest of the four CRD gaps blocking a Fountain production deployment.
Repo/where. INTENTIUS/chant. All work in the k8s lexicon at lexicons/k8s/. Design rule: spec-true — type the real upstream API, no chant-flavored abstraction.
Goal. Code-generate typed CloudNativePG resources through the existing CRD codegen pipeline (the path that produced KubeRay, Argo, Gateway API, cert-manager, Flux), plus the barman-cloud plugin's ObjectStore.
Why these three kinds
BinaryBourbon/fountain's k8s/ overlay runs its Postgres this way, and all three are load-bearing:
postgresql.cnpg.io/v1Cluster (k8s/postgres.yaml) —instances,imageName,bootstrap.initdb(database/owner/postInitTemplateSQL),storage(storageClass/size),resources, and theplugins[]block that wires WAL archiving (name: barman-cloud.cloudnative-pg.io,isWALArchiver: true,parameters.barmanObjectName).postgresql.cnpg.io/v1ScheduledBackup (k8s/scheduledbackup.yaml) —schedule(six fields, leading seconds, unlike vanilla cron),backupOwnerReference,cluster.name,method: plugin,pluginConfiguration.name.barmancloud.cnpg.io/v1ObjectStore (k8s/objectstore.yaml) —retentionPolicy,configuration.destinationPath/endpointURL/s3Credentials.{accessKeyId,secretAccessKey}/wal.compression/data.compression.
Without these, chant lifecycle diff --live reports the whole database tier as unsupported-kind unobserved. That is the correct behaviour and not a correctness bug — but it is a hole in the estate exactly where the stateful, hardest-to-recover component lives.
Backup and Pooler are cheap to add from the same base URL and worth taking while we are here; Database/Publication/Subscription are not needed by any known consumer, so leave them out rather than dragging in the whole group (see the "do not fetch a whole provider" note in crd-sources.ts).
Files to touch
-
lexicons/k8s/src/crd/crd-sources.ts— add aCNPG_VERSIONconst, aCNPG_CRD_BASE, aBARMAN_PLUGIN_VERSIONconst + URL, a doc comment listing the kinds and the operator-install command (mirror the KubeRay / cert-manager blocks), and the entries inCRD_SOURCES. -
lexicons/k8s/src/crd/parser.ts— add toGROUP_NAMESPACE_OVERRIDES:"postgresql.cnpg.io": "Cnpg""barmancloud.cnpg.io": "Cnpg"
Required. The first-segment rule would otherwise produce
K8s::Postgresql::ClusterandK8s::Barmancloud::ObjectStore. Mapping two groups onto one namespace is the established Flux pattern (five*.toolkit.fluxcd.iogroups all map toFlux); the kinds do not collide. -
lexicons/k8s/src/codegen/patches.ts— only ifnpm run generatefails. The CNPGClusterschema is large and deeply nested (it embeds a full pod template); if it trips the recursion cap, add a targetedSchemaPatchlike the existing JSONSchemaProps one.
Verified sources
All four return 200 as of filing:
https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/v1.29.1/config/crd/bases/postgresql.cnpg.io_clusters.yaml
https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/v1.29.1/config/crd/bases/postgresql.cnpg.io_scheduledbackups.yaml
https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/v1.29.1/config/crd/bases/postgresql.cnpg.io_backups.yaml
https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/v1.29.1/config/crd/bases/postgresql.cnpg.io_poolers.yaml
https://raw.githubusercontent.com/cloudnative-pg/plugin-barman-cloud/v0.7.0/config/crd/bases/barmancloud.cnpg.io_objectstores.yaml
On the pin. Fountain runs operator 1.29.1, so v1.29.1 is the version that matches a real consumer; latest is v1.30.0. Pick one deliberately and record it in the doc comment. Barman plugin latest is v0.14.0; v0.7.0 is verified above — check whether the ObjectStore schema moved between them before pinning.
Steps
- Add the version consts + base URLs near the other version consts in
crd-sources.ts, with the doc comment. - Add the entries to
CRD_SOURCES. - Add the two group→namespace overrides in
parser.ts. - From
lexicons/k8s/:npm run generate, thennpm run build -w @intentius/chant-lexicon-k8s. - If generation errors on schema size/recursion, add a
schemaPatchesentry and re-run.
Definition of done
K8s::Cnpg::Cluster,::ScheduledBackup,::ObjectStore(and::Backup,::Pooler) import from the k8s generated barrel and serialize to valid YAML with the rightapiVersion/kind.- Fountain's
k8s/postgres.yaml,k8s/scheduledbackup.yamlandk8s/objectstore.yamlare reproducible from typed chant source — that is the acceptance test, not a synthetic fixture. - The six-field
ScheduledBackupschedule round-trips (it is a string, so this is really a docs/test note — a five-field cron here silently means something else). - Versions recorded in
crd-sources.tswith the operator-install comment. npm run generate && npm run build -w @intentius/chant-lexicon-k8sclean;lexicons/k8s/src/codegen/{snapshot,typecheck,naming}.test.tspass.
Notes
- fix(k8s): CRD-generated classes have no metadata when the schema declares only spec #1309 does not block this. All three CRDs declare
metadataat the top level ofopenAPIV3Schema.properties(verified), so they behave like cert-manager rather than the Fabric8-generated CRDs in feat(k8s): read CRDs out of a Helm chart, and add KubeMicroVM #1306. fix(k8s): CRD-generated classes have no metadata when the schema declares only spec #1309 would still upgrade the generatedmetadataprop fromRecord<string, unknown>toObjectMeta, which is worth having but is not a prerequisite. src/generated/**andsrc/lint/post-synth/index.tsare generator output — never hand-edit.- Post-generation, a
WK8-series post-synth check on CNPG clusters (backups configured?instances: 1in a prod-labelled namespace?) is a natural follow-up, but out of scope here.
Activity
lex00 commentedon Aug 3, 2026
Pins decided:
v1.29.1— matches the operator fountain actually runs, not latest (v1.30.0). Generating from 1.30 would type fields a 1.29 API server rejects, and the consumer is the point. Same reasoning the existing pins follow (cert-manager is on v1.16.2, not latest).v0.14.0— latest.ObjectStoreis the plugin's whole surface and the fields in use (retentionPolicy,destinationPath,endpointURL,s3Credentials,wal/datacompression) are stable across 0.7 → 0.14.Both verified 200 at filing.
feat(k8s): CloudNativePG and barman-cloud CRDs (#1319) (#1379)
the cnpg, traefik and infisical seams actually emit something
the cnpg, traefik and infisical seams actually emit something (#19)
feat(k8s): k3s bundled-controller CRDs (K8s::K3s::HelmChart/HelmChart…