Kinds: PostgreSQL and CloudNativePG
Each kind below has the same sections: Properties, Outputs, Validation and Example. Its implementation, history and tests are on the contributor page.
cnpg-imagecatalog, cnpg-clusterimagecatalog, cnpg-backup, cnpg-scheduledbackup, cnpg-databaserole, cnpg-publication, cnpg-subscription
cnpg-imagecatalog, cnpg-clusterimagecatalog, cnpg-backup,
cnpg-scheduledbackup, cnpg-databaserole, cnpg-publication,
cnpg-subscription are the kind-named projections of seven objects of the
CloudNativePG API, postgresql.cnpg.io/v1, beyond those of cnpg-cluster and
cnpg-pooler, below: an ImageCatalog, a ClusterImageCatalog, a Backup, a
ScheduledBackup, a DatabaseRole, a Publication and a Subscription. Each emits
that one object, named after the component unless objectName names it; the
handler adds no label, no annotation and no default of its own.
Properties
Authored. The properties are the top-level json fields of the spec type, decoded strictly at every depth: an unknown key is refused wherever it sits (an image, an extension, a plugin configuration, a target’s object).
cnpg-imagecatalogandcnpg-clusterimagecatalog(ImageCatalogSpec, which the two objects share):images, each animage, amajorand itsextensions(aname, animagevolume source with itsreferenceandpullPolicy, the four path lists andenv), andcomponentImages, each akeyand animage.cnpg-backup(BackupSpec):cluster,target,method,pluginConfiguration(name,parameters),onlineandonlineConfiguration.cnpg-scheduledbackup(ScheduledBackupSpec): the six of a Backup, andschedule,suspend,immediateandbackupOwnerReference.cnpg-databaserole(DatabaseRoleSpec):cluster,databaseRoleReclaimPolicy,clientCertificate, and the fields of the role configuration the type embeds:name,comment,ensure,passwordSecret,disablePassword,connectionLimit,validUntil,inRoles,inherit,superuser,createdb,createrole,login,replicationandbypassrls.cnpg-publication(PublicationSpec):cluster,name,dbname,parameters,target(allTables, orobjects, each atablesInSchemaor atablewith itsname,schema,onlyandcolumns) andpublicationReclaimPolicy.cnpg-subscription(SubscriptionSpec):cluster,name,dbname,parameters,publicationName,publicationDBName,externalClusterNameandsubscriptionReclaimPolicy.
Labels and annotations are the labels and annotations properties, and
the object also carries the component label (see “Component label and ownership”
in the OAM model).
Outputs
The ClusterImageCatalog is cluster-scoped: the object carries no namespace,
whatever namespace the application is built for, and its name is claimed
cluster-wide. The other six are namespaced and are written in the build
namespace. One rule lowers onto one of them: postgresql emits a
cnpg-scheduledbackup for each backup.schedules entry (below); it emits none
of the other six.
- No default is filled. An unauthored
method,ensure,inherit,backupOwnerReferenceor reclaim policy is left out and the API server fills its own.
A Backup is a one-shot request. The operator takes the backup once, when the
object is created, and the API refuses every later change of its spec. A
cnpg-backup kept in a repository and applied again is the same object: nothing
runs, and a change to its properties is refused at apply. Where the repository
is applied continuously, the API refuses the changed document at every apply, so
the delivery fails on it each time until the change is taken back, or the
request is authored as a new object (another objectName), which is a new
Backup and a new backup taken. What a delivery tool set to replace an object it
cannot update does with that refusal is the tool’s, and is not read here. It
suits a backup that is asked for once, under a name of its own (before an
upgrade, say), and is then left as the record of that backup. A backup that
recurs is a cnpg-scheduledbackup, whose Backups the operator creates and
names.
Validation
No capability is required, and none gates these kinds: where the
CloudNativePG CRDs are not installed the component builds. Whoever may author a
component may author these, and with them the images the Clusters of a namespace
or of the whole cluster may run, a role with any attribute PostgreSQL has
(superuser, bypassrls, replication), and what a database publishes or
subscribes to. A policy can keep the kinds out of a build through the object
kind policy (oam.ObjectKindPolicy).
- A role’s
connectionLimit: 0is refused (connectionLimit: 0 cannot be carried by the CloudNativePG API types): the field is no pointer and is omitted when zero, and the CRD’s default,-1(no limit), would apply in its place, so a role authored to accept no connection would accept any number. - An empty string is refused on the seven string fields the CRDs default
(
method: "" cannot be carried by the CloudNativePG API types (the field is omitted when zero, so the operator would apply its default "barmanObjectStore")):methodon a Backup and a ScheduledBackup (barmanObjectStore), a ScheduledBackup’sbackupOwnerReference(none), a role’sensure(present) anddatabaseRoleReclaimPolicy(retain), andpublicationReclaimPolicyandsubscriptionReclaimPolicy(retain). The type omits an empty string, so the default would replace the authored value. - A role’s
validUntilis written in UTC. The API type holds an instant:2030-01-01T02:00:00+02:00is written2030-01-01T00:00:00Z. It writes the instant to the second and the zero time as null, which the API server drops, so avalidUntilwith a fraction of a second other than zero is refused (validUntil "2030-01-01T00:00:00.5Z": a fraction of a second cannot be carried by the CloudNativePG API types), after a period or a comma, read from the authored string, since the decode keeps only nine digits of a fraction; and so is0001-01-01T00:00:00Z(validUntil: the zero time cannot be carried by the CloudNativePG API types), which would leave a password that never expires. The time as the API type writes it is held to the CRD’sdate-timeformat and to the decoded instant, so an instant outside the four-digit years in UTC is refused whatever its authored offset:9999-12-31T23:00:00-02:00(validUntil: the CloudNativePG API types write it as 10000-01-01T01:00:00Z, which the DatabaseRole CRD's date-time format refuses).
Required follows the rule of the other kinds built on policyFreeKind: a
field the API requires that the Go type writes whether or not it was authored.
Each must be authored (images[1].major: required (…)):
- a catalog’s
images; an image’simageandmajor; an extension’sname, and thenameand thevalueof each of itsenventries; a component image’skeyandimage; cluster, on the five kinds that refer to a Cluster, and itsnameon acnpg-backupand acnpg-scheduledbackup. The DatabaseRole, Publication and Subscription CRDs default thenameto an empty string, which no Cluster has, so the other three refuse a reference with no name on launcher’s own account, with the samecluster.name: required;- a plugin configuration’s
name, on acnpg-backupand acnpg-scheduledbackupthat author one; - a
cnpg-scheduledbackup’sschedule; - a
cnpg-databaserole’sname, and thenameof an authoredpasswordSecret; - a
cnpg-publication’sname,dbnameandtarget, and thenameof a target’stable; - a
cnpg-subscription’sname,dbname,publicationNameandexternalClusterName.
These lists are generated from the fields the linked module’s CRDs require and
the types write unauthored (see “Required fields a kind writes unauthored and
does not
refuse”),
so a dependency bump that adds, drops or moves one fails until they are
regenerated; TestCnpgFurtherKinds_RequiredMatchCRD holds them to those CRDs as
well. They are read where the hand-kept lists were, before the kinds’ own
checks, so every refusal reads as it did. An authored empty value satisfies the
rule and is the API server’s to refuse (schedule: ""), with three exceptions
the build refuses itself: a cluster.name must be a name CloudNativePG admits
for a Cluster (a DNS-1035 label of at most 50 characters), as on cnpg-pooler
and cnpg-database; a role’s name: "" breaks a rule of its CRD (below); and a
catalog’s image: "", on an image or a component image, is no image reference
and is refused by the tag rule (below).
The CRDs’ expression rules. The seven CRDs declare 26. The build checks the 15 that read one document, each a comparison of authored fields with each other or with a string the CRD itself states, so a document that breaks one could never be admitted:
- a catalog (two rules, on each of the two CRDs): no two images of one
major(images[1].major: 17 is also the major version of images[0]; the API takes each major version once), and no two component images of onekey. The component images are a list keyed onkey, so the API server refuses a key held twice by its schema as well as by the rule; - a role (eight): a
namethat is empty,postgresorstreaming_replica, or that starts withpg_orcnpg_(name "postgres": reserved, the DatabaseRole CRD refuses it);ensure: absent, which the API does not take on a DatabaseRole (a role is removed by deleting the object withdatabaseRoleReclaimPolicy: delete);passwordSecretbesidedisablePassword: true; and a client certificate that is enabled withoutlogin: true. A certificate is enabled where its block is authored andenabledis notfalse: the API fillstrueinto an omitted one before it evaluates the rule. It fills nothing intologin, which the rule reads without asking whether it is there: an enabled certificate with nologinauthored is refused by the API server as a rule it cannot evaluate (no such key: login), and one besidelogin: falseby the rule’s own message. The build gives both the one refusal; - a publication (three): a
targetthat publishes neither or both ofallTables: trueandobjects(target: one of allTables: true and objects is required); an object that is neither or both oftablesInSchemaandtable; and a table that lists itscolumnswhere another object publishestablesInSchema. The Go type leaves out a falseallTablesand an emptyobjects,tablesInSchemaorcolumns, so each is read as the object will hold it:allTables: falsebeside a list of objects builds, and is a list of objects. The API server reads the document it is sent, so the two differ on a document that authors one of the four, and agree on the object: sent as authored,allTables: falsebeside a list of objects is refused, and the object the build writes for it is accepted;allTables: falsealone is accepted as authored and refused by the build, since the object written holds neither.
The other eleven refuse a change of the stored object, which a build does not
have, and stay the API server’s: a Backup’s whole spec; the cluster of a
ScheduledBackup, a DatabaseRole, a Publication and a Subscription; the name of
a role; the name and the dbname of a publication and of a subscription; and
a publication’s target.allTables, from one authored value to another. Such a
change builds here and is refused at apply, until the object is deleted and
created again. The rule on allTables sits on that optional field, and the API
server does not evaluate it where the field is absent from the stored object or
from the new one: a target moved from allTables to objects, or back, is not
refused by it.
Not checked, and the API server’s or the operator’s to refuse:
- the number of a catalog’s images (one to eight) and of its component images
(at most 32), a
majorbelow 10, and the forms of akey, of an extension’snameand of anenvname; - a
schedule: launcher does not parse it. The operator reads a cron expression of six fields, the first of which is the seconds; its webhook refuses a schedule that does not parse and only warns of one that parses with another number of fields; - what the operator’s webhook holds a Backup and a ScheduledBackup to: that
onlineandonlineConfigurationdo not come with thebarmanObjectStoremethod, which is also the method of a document that authors none, and, on a Backup only, that thepluginmethod comes with apluginConfiguration; parameterson a publication, a subscription and a plugin configuration: a free map of strings, written as authored;- every other value rule of the API: the enumerations (
method,target,backupOwnerReference,ensure, the reclaim policies, an image volume’spullPolicy). AvalidUntilis the exception: the strict decode reads an RFC 3339 time and refuses anything else.
The tag rule on a catalog’s images. The three fields of a catalog that name
an image are held to ValidateImageRef (at the policy’s image level, tagged by
default), as a container’s image is, when the
component is read, with or without a policy: an image’s image, a component
image’s image and the reference of an extension’s image volume. One without
a tag or digest, or tagged :latest (with a digest too), or one that is no
image reference, is refused by the field’s path (images[0].image: image "registry.example/team/postgresql" rejected: no tag or digest specified; use an explicit version tag or digest), and the refusal carries no policy class: a
Cluster that takes its image from the catalog runs what the entry names. An
extension that names no reference names no image and is not checked. A reference
by digest alone passes; what CloudNativePG itself requires of a catalog’s image
is the operator’s rule and is left to it. The rule runs at that read and nowhere
else: generation builds the object from what the read decoded and does not
repeat it. cnpg-cluster and cnpg-pooler repeat theirs at generation because
their config is an exported value a caller can change after the read; nothing
but the read can make a catalog’s config.
Policy. The two catalogs are held to the environment policy; the other five
have no field an oam.Policy method speaks to, and build the same under every
policy and under none.
- Every image a catalog names is held to the allowed registries. A catalog
runs no pod, but an image a Cluster takes from it is one the operator runs.
ApplyPolicychecks the three fields that name one, and refuses by the field’s path with the classoam.RefusalRegistry: an image’simage(images[0].image), a component image’simage(componentImages[0].image) and thereferenceof an extension’s image volume (images[0].extensions[0].image.reference). An extension that names no reference names no image, and nothing is checked for it. - A Cluster’s reference to a catalog is a name. A
cnpg-cluster’simageCatalogRefnames a catalog and a major version, and holds no image: the host is read where the image is authored, on the catalog. A catalog that is not built with launcher is not seen. - No field holds a literal secret. A role’s
passwordSecretis the name of a Secret in the role’s namespace, and launcher emits no Secret for it; a subscription’s credentials are those of the external cluster the subscriber Cluster defines. A plugin’sparametersand an extension’senvare free text: a value written there is written into the object as authored and is not checked.
Not covered. Whether what is referred to exists: the Cluster, the Secret,
the database, the publication, the external cluster of a subscription, the
plugin, the schema and the tables a publication names. A status of any of the
seven is the operator’s and is not written. The Backups a ScheduledBackup
creates, and the Secret a role’s client certificate is issued into (<object name>-client-cert), are the operator’s too.
Example
cnpg-imagecatalog: The component inpkg/cmd/kurel/testdata/cnpg-imagecatalog-component/app.yaml, built against thecluster.yamlbeside it, gives theexpected.yamlbeside it. The fixture test compares the two.cnpg-clusterimagecatalog: The component inpkg/cmd/kurel/testdata/cnpg-clusterimagecatalog-component/app.yaml, built against thecluster.yamlbeside it, gives theexpected.yamlbeside it. The fixture test compares the two.cnpg-backup: The component inpkg/cmd/kurel/testdata/cnpg-backup-component/app.yaml, built against thecluster.yamlbeside it, gives theexpected.yamlbeside it. The fixture test compares the two.cnpg-scheduledbackup: The component inpkg/cmd/kurel/testdata/cnpg-scheduledbackup-component/app.yaml, built against thecluster.yamlbeside it, gives theexpected.yamlbeside it. The fixture test compares the two.cnpg-databaserole: The component inpkg/cmd/kurel/testdata/cnpg-databaserole-component/app.yaml, built against thecluster.yamlbeside it, gives theexpected.yamlbeside it. The fixture test compares the two.cnpg-publication: The component inpkg/cmd/kurel/testdata/cnpg-publication-component/app.yaml, built against thecluster.yamlbeside it, gives theexpected.yamlbeside it. The fixture test compares the two.cnpg-subscription: The component inpkg/cmd/kurel/testdata/cnpg-subscription-component/app.yaml, built against thecluster.yamlbeside it, gives theexpected.yamlbeside it. The fixture test compares the two.
postgresql
postgresql — provider: cnpg, version (default 16), storageSize
(precedence: authored > policy default storageSize > 1Gi), replicas,
backup (objectStore, objectStoreObjectName, retentionPolicy,
serverName, schedules; see “Backup” below), monitoring.enabled,
pooler.enabled, poolerName, managedRoles, databases (each with an
optional objectName), clusterObjectName.
Properties
clusterObjectName names the Cluster in place of the component name.
CloudNativePG derives the Cluster’s Services and Secrets from the Cluster’s
name, the default backup path moves with it, and renaming an existing Cluster
creates a new one: the old one is pruned with its data unless it is protected
(see “The Cluster’s and the ObjectStore’s names” below).
resources forwards every name the shared parser admits — cpu, memory,
ephemeral-storage, hugepages-<size> and qualified extended resources such as
nvidia.com/gpu, under the same validation as the reshaped workload kinds —
onto the Cluster’s spec.resources requests/limits unchanged
(go-kure/launcher#484; until then any name other than cpu/memory was
rejected, so this is an additive change). Only cpu/memory carry a policy
default and maximum; CNPG-specific sizing such as ephemeralVolumesSizeLimit is
not derived from these entries. CNPG copies this block onto the instance pods
unchanged and nothing defaults cpu/memory into it except a policy, so generation
refuses a block that names hugepages-<size> without cpu or memory on
either side after policy defaults (resources: hugepages require cpu or memory in requests or limits) — admission would refuse every instance pod. affinity
takes the same four keys as the shared affinity property
(enablePodAntiAffinity, topologyKey, podAntiAffinityType, nodeSelector)
with the same defaults — kubernetes.io/hostname and preferred — but the
handler parses it itself into the CNPG AffinityConfiguration instead of
calling parseAffinity, because CNPG carries its own affinity shape rather than
a corev1.Affinity. The block and each of its four sub-fields are read with the
presence-reporting helpers, so a value authored with the wrong type is rejected
by name (affinity.topologyKey: must be a string, got float64) rather than
discarded while a default reaches the emitted cluster, and podAntiAffinityType
must be preferred or required — an explicit empty string is an error here,
not a fallback to the default. Rejection reaches the nodeSelector values,
not just its envelope: nodeSelector: {rack: 3} is refused by key rather than
dropped, so a selector cannot silently reach the cluster narrower than authored.
When more than one entry is wrong, the alphabetically first offending key is
the one reported: Go randomises map iteration order, so without an explicit sort
the same document names a different key run to run and its diagnostic cannot be
reproduced or asserted in a test. The same ordering rule applies to the other
three parsers in this package that report a bad map entry by key —
parseResourceList, rejectUnknownKeys and parseManifestSource. An explicit
null affinity is absence — Launcher supplies no explicit affinity
settings, exactly as when the property is omitted — matching what pkg/oam’s
own property validation already does with a null under an optional property;
without that, affinity: with no value validated against the published schema
and then failed to convert, while the same value built in Go turned pod
anti-affinity on with every default. A null on a sub-field inside a present
block is also absence — it takes the same default an omitted sub-field takes
(go-kure/launcher#444 established this nested-null contract in the shared
presence primitive authoredValue, which this block’s four sub-fields go
through; a nested key read raw elsewhere, such as a probe handler key, does not
follow it); a non-null wrong-typed sub-field, and an explicitly empty
podAntiAffinityType, remain errors. The shared parseAffinity (common.go)
applies the same rules to its four sub-fields since go-kure/launcher#452, so the
two readers agree; a change to one belongs in the other. The handler’s other
string→string maps — inheritedMetadata.labels,
inheritedMetadata.annotations, postgresql.parameters, pooler.parameters
and externalClusters[].connectionParameters — take string values only: a
non-string value (tier: 3, max_connections: 100, enabled: true) is refused
by field and key (postgresql.parameters["max_connections"]: must be a string, got int) instead of being dropped from the emitted resources, with the same
alphabetically-first rule as nodeSelector when several are wrong. Quote such a
value to keep it (max_connections: "100"), and declare a Package parameter
substituted as a whole value there as type: string, since whole-value
substitution keeps the parameter’s type; a number is not converted to its string
form, because YAML’s rendering of a number is not always the text the author
typed (1.10 decodes to 1.1). An explicit null value is absence, per “The
null contract”: the key is left out,
not refused. The same holds for nodeSelector values in both affinity readers,
which share the helper.
bootstrapis declared key by key, and a key under it that the component does not read is refused naming it (bootstrap: unrecognized key "…"), where it used to be dropped. It readsinitdbandpg_basebackup(whosesourceis its only key; another was dropped before and is refused now), at most one of them and neither withrecovery, and refuses the formerbootstrap.recoverywith its replacement.bootstrap.initdbcreates the Cluster with an application database and its owner in place of the operator’s default,app: bothdatabaseandownerare required, not empty (the CloudNativePG webhook refuses one without the other), and they are written to the Cluster’sspec.bootstrap.initdb. An emptyinitdbis refused the same way; to get the operator’s default (databaseapp, owned byapp), leavebootstrapout. Any other CloudNativePG initdb key (secret,encoding,postInitSQL,import, …) is refused (bootstrap.initdb: unrecognized key "…"), never dropped; each can be modelled later. The owner’s connection Secret is the operator’s, named after the Cluster, and this component creates none. A bootstrap is read only when the Cluster is created; set on a component whose Cluster exists already, it changes nothing.cnpg-clustertakes the whole CloudNativePGbootstrap.initdb, strictly decoded.
externalClusters keeps its name and connectionParameters, the source of
bootstrap.pg_basebackup.
An authored pooler.instances is written as authored, a 0 or a negative
count included. The Pooler CRD gives instances a default of 1 and no minimum,
and a count of 0 or less used to be left out of the Pooler, so the operator ran
the one pod the author had switched off. The upstream type carries a 0, so it is
written; the CRD does not bound the count, so a negative one is written too and
refusing it is left to the cluster. A count that is not authored is still 3
(TestPostgresqlRule_PoolerInstances). Behavior-changing for a document with
pooler.instances: 0 or less: its Pooler now holds that count. A document with
instances: 0 got one pod before and gets none now (the
postgresql-bootstrap-external fixture shows it).
Outputs
A component lowering rule (PostgresqlRule, postgresql_lowering.go), not
a dispatchable handler: it reads the properties as before (Parse; the
published schema is pinned byte for byte,
testdata/postgresql-property-schema.json: the former handler’s, with
poolerName and clusterObjectName added and, since go-kure/launcher#1001,
backup typed and the top-level objectStore and objectStoreObjectName
removed, the store’s name now backup.objectStoreObjectName) and emits the CNPG
kind components that build the same objects — a cnpg-cluster under the
component’s name, a cnpg-objectstore under the same name (one same-name
sibling group) when backup is set, a cnpg-pooler <name>-pooler when
pooler.enabled, a cnpg-database <name>-<db> per databases entry (a
Database given the Pooler’s name, by default the one named pooler beside an
enabled pooler, joins its same-name sibling group, as two objects of different
kinds), and a cnpg-scheduledbackup <name>-<schedule> per backup.schedules
entry, in that order. replicas and storageSize are written to the Cluster
only when authored, so the policy applies to them exactly as before. The two
values postgresql derived from the policy are set after it by a post-policy step
the rule attaches to the Cluster (oam.Component.AfterPolicy), which runs
before the authored traits: enablePDB (instances > 1) and the 1Gi storage
fallback, under the policy maximum with postgresql’s text (storageSize "1Gi" exceeds enforced maximum "512Mi"). Authored traits go to the Cluster, and those
that covered every object postgresql generated are forwarded to the other
members so they still do: prune-protection and force-replace to each member,
and fluxcd-patches and fluxcd-postbuild (not built in; a consumer that
delivers through Flux registers them) to the first member that is ordered after
the Cluster (below): the members share one group, so one of them carries the
trait for that group’s bundle. For that reason a document that authors one of
these two traits on the postgresql component may not order or place a member on
its own (a dependency rule or a placement whose component is the Pooler’s, a
Database’s or a ScheduledBackup’s generated name): the member could leave the
group the trait reaches, so the rule refuses it and asks for the postgresql
component’s name instead (the rule for every lowering rule, and the message, are
under “Traits a lowering rule
forwards”).
Policies that name the postgresql component are extended to the members the same
way. A placement of it is repeated for each member, so they stay in the
Cluster’s tier and, without a dependency policy, in its bundle. When the
document orders its components with a dependency policy that has a rule, the
rule adds one making the Pooler, the Databases and the ScheduledBackups depend
on the Cluster, and every component the document makes depend on the postgresql
component depend on them too: the members are then in a later group than the
Cluster’s. Without one it adds no edge, since a dependency edge would order a
document that never asked for ordering. The policies it adds are named
<name>-dependencies and <name>-placement-<i> (one per member), or, when a
policy of the document already uses the name, the first free one with -<n>
appended. Behavior-changing under launcher.gokure.dev/v1alpha1: with both
objectStore (now backup) and pooler, the objects now come in the order
Cluster, ObjectStore, Pooler (was Cluster, Pooler, ObjectStore; the objects are
the same), and a Database named pooler comes right after the Pooler, ahead of
the other Databases. Under a dependency policy the Pooler, the Databases and
the ScheduledBackups are deployed from one bundle they share, after the
Cluster’s, unless the document orders or places a generated member on its own
(was one bundle for all of postgresql’s objects).
Backup. backup takes backups and archives WAL to an S3-compatible object
store through the Barman Cloud plugin, the one path CloudNativePG keeps once its
in-tree Barman support is removed. It lowers into the base kinds and adds
nothing to them:
backup.objectStore(required) is the configuration of a barman-cloudObjectStorethe component emits, named after the component (or bybackup.objectStoreObjectNameor theNaminghook, below). It readsdestinationPath(required, not empty),endpointURL,endpointCA({name, key}of a Secret),s3Credentials(required:accessKeyIdandsecretAccessKey, each{name, key}of a Secret, with an optionalregionandsessionTokenalike, orinheritFromIAMRole: true; exactly one of the two ways),wal(compression,encryption,maxParallel) anddata(compression,encryption,jobs,immediateCheckpoint). It is decoded strictly into the vendored Barman Cloud type, and the values the ObjectStore CRD bounds are checked at build, since the Go type alone does not hold them: acompressionorencryptionoutside the CRD’s enum (datatakes noxzorzstd), and amaxParallelorjobsunder 1, an authored0included (backup.objectStore.wal.compression "brotli": must be one of …). A Secret reference without itsnameorkeyis refused.serverNamethere is refused (the ObjectStore CRD forbids it; usebackup.serverName), and so areazureCredentialsandgoogleCredentials(S3-compatible storage only; thecnpg-objectstorekind takes them), with that reason also where nos3Credentialsis written: the schema does not mark the store’s required keys Required, so the document check gives a refused key’s reason first.backup.retentionPolicyis the ObjectStore’s, a positive count of days, weeks or months (30d,4w,6m); anything else is refused (backup.retentionPolicy "30 days": must be a positive count …).- The Cluster gets one plugin entry,
barman-cloud.cloudnative-pg.iowithisWALArchiver: true, whosebarmanObjectNameparameter names the store by the name it took.backup.serverNamebecomes itsserverNameparameter, the folder the plugin writes under (it defaults to the Cluster name). The Cluster has no in-treespec.backup. - Each
backup.schedulesentry emits acnpg-scheduledbackupof the Cluster,method: pluginthrough the same plugin (no parameters: the plugin reads the store from the Cluster’s entry).name(required, unique among the schedules) makes its name,<component>-<name>;schedule(required) is a cron expression of six fields, seconds first (0 0 3 * * *), refused unless it parses as CloudNativePG’s webhook parses it (robfig/cronat the version the vendored CloudNativePG requires). Five fields parse there too, seconds first, with only a warning at the webhook that Flux does not show: a crontab line0 3 * * *would back up at minute 3 of every hour. It is refused, naming each six-field form that parses, read as a crontab line and as the operator reads it (backup.schedules[0].schedule "0 3 * * *": five fields, … write six fields, seconds first ("0 0 3 * * *" as a crontab line, or "0 3 * * * *" as the operator reads it)). A descriptor (@daily) is accepted. A schedule must also find a time within the operator’s look-ahead from every instant: the operator asks for the next time after now, searching through the end of the year five years on, and on none records NoSchedule and takes no further backup for that ScheduledBackup, not even the immediate one, with no retry. The search is computed in UTC, exactly, over one 400-year Gregorian cycle (fixed years, so a build does not depend on the clock): February the 30th (0 0 3 30 2 *) is refused as a time that never comes, and February the 29th (0 0 3 29 2 *) is refused too, since 2100 is no leap year (… no time from the end of 2096 through the end of 2101 (UTC), longer than the five years the operator looks ahead …). A seconds, minutes, hours or months field that selects no value (,) is refused outright, naming the field. An empty day of month or day of week can still fire:0 0 3 , * MON(ORed with Mondays) is accepted,0 0 0 , * *(ANDed with a starred day of week) is refused.@everyis accepted, however long its delay; how often a backup is taken is not judged.immediatedefaults totrue(a new Cluster gets a base backup at once),backupOwnerReferencetoself(none,selforcluster),targetisprimaryorprefer-standbyandsuspendis written only when authored.
Prerequisites, and what happens at apply. backup needs, in the cluster:
the CloudNativePG operator 1.26 or later (the emitted objects follow the
vendored 1.30.1 API), the Barman Cloud plugin v0.15.x with its ObjectStore
CRD, and cert-manager, which the plugin’s install recommends. The bucket, and
the Secrets s3Credentials and endpointCA name, must exist beforehand:
launcher neither creates nor checks them. The build cannot see the cluster: a
missing CRD fails the apply, while an older CRD can prune a field it does not
know without an error. Check the installed versions, and read the applied object
back. The backup and recovery guide (docs/postgresql-backup-recovery.md) walks
through both, with the checks that show a backup and a recovery working. The
rule’s contract metadata carries the same list for a tool to read
(ContractMetadata.Prerequisites; the oam package README, “Contract metadata”),
each entry with the use that needs it, plus the ObjectStore a recovery’s
source.objectStoreName names and the Secret its secret.name names, with the
owner’s credentials. cert-manager is not an entry: what launcher writes does not
depend on it, as the plugin’s TLS certificates can come from elsewhere. The
operator’s and the plugin’s APIs are also published as platform needs
(ContractMetadata.PlatformNeeds, and PolicyResult.PlatformNeeds for what an
application emits: the plugin’s barmancloud.cnpg.io only when an ObjectStore is
emitted or the emitted Cluster archives WAL or recovers through the plugin).
Recovery. recovery bootstraps a new Cluster from the base backups and WAL
another cluster wrote to an object store through the Barman Cloud plugin, to the
end of the WAL or to a target (point-in-time recovery). It lowers into the base
kinds and adds nothing to them. A bootstrap is read only when the Cluster is
created: recover into a new component beside the source one; set on a component
whose Cluster exists already, it changes nothing. Recovering by renaming the
source component’s Cluster instead (clusterObjectName) creates a new Cluster
and prunes the original with its data unless it is protected. It is not combined
with bootstrap.pg_basebackup (recovery: not with bootstrap.pg_basebackup …)
or bootstrap.initdb (recovery: not with bootstrap.initdb …). The schema
publishes the rules below that the parser enforces: recovery.source is
required, objectStoreName and objectStore are an exactly-one group, and
recovery.target’s selectors and bootstrap’s initdb and pg_basebackup are
at-most-one groups. A document that breaks one is refused by the document check,
in the schema’s words ("source" is required, "time" and "lsn" are mutually exclusive), before the parser’s.
recovery.source(required) is where the backups are read from:serverName(required, not empty), the folder the source cluster wrote within the store (itsbackup.serverName, else its Cluster’s name), and exactly one ofobjectStoreName, an existing ObjectStore in the namespace, andobjectStore, one defined here. The inline store reads asbackup.objectStoredoes, with the same checks and refusals under its own path (recovery.source.objectStore.serverName: not allowed …; use recovery.source.serverName), and the component emits it as acnpg-objectstorenamed<component>-recovery-source(or by theNaminghook, below).- The Cluster gets
bootstrap.recoverywhosesourceis oneexternalClustersentry the rule writes,<component>-recovery-source: the pluginbarman-cloud.cloudnative-pg.iowith the parametersbarmanObjectName, the store by the name it took, andserverName, always written, since the plugin would otherwise read the new Cluster’s own folder. An authoredexternalClustersentry of that name is refused. recovery.targetis where the recovery stops, the vendoredRecoveryTarget:time,lsn,xid,nameandimmediate, at most one of them;backupID;timeline(latestor a positive integer, written as a string, and emitted in plain decimal: the plugin matches it against the backups’ timelines as text, so"01"is written"1");exclusive. What CloudNativePG’s webhook refuses without looking at a cluster is refused at build: two targets (an authoredimmediate,falseincluded, counts), atimeorlsnthat does not parse as the operator parses it, anxidthat is no 32-bit integer, anameof 64 bytes or more or with a control character, anxid,nameorimmediatewithoutbackupID(the plugin finds the base backup from the catalog by time or LSN only), and atimelinethat is neither. An authored""in a target,databaseorowneris refused: the Cluster omits an empty value, which would recover to the end of the WAL, or take the operator’s default.recovery.database,recovery.ownerandrecovery.secret.name(the owner’s credentials) are the Cluster’s, written only when authored.- A cluster that would archive its WAL into the folder it is recovered from is
refused where launcher sees both (
recovery.source: the cluster would archive its WAL into the folder it is recovered from …): the endpoint, the destination path (one trailing/aside, as Barman joins it with the server name) and the server name ofbackup(itsserverName, else the Cluster’s name) against those of the source, read from the inline store, from the component’s own backup store, or from the store another component of the document emits (apostgresqlcomponent’s backup store or acnpg-objectstore, itslabelsandannotationsaside, known by the name its author wrote, else by its component name; or apostgresqlcomponent’s inline recovery store, by its default name<component>-recovery-source, shortened as every generated name is), an unauthored name only where noNaminghook is set. A store outside the document, or another component’s store the author did not name while a hook is set (its name may be the hook’s answer, asked by that component’s lowering), is left to the plugin’s own check before it archives. - Ordering. The recovering Cluster reads its source store before it can
become ready, so the store never waits for the Cluster as the other members
do. Where the document orders its components (a
dependencypolicy), the Cluster waits for the store: the store is in a group before the Cluster’s, with the placements and the bundle traits the members get, and waits for what the document’s dependency rules make the component wait for, as all of its objects do (Component.WaitsAs). That includes the rules another component’s lowering adds: made to wait for anotherpostgresqlcomponent, the store waits for its Pooler, Databases and ScheduledBackups too. Where it does not, nothing is ordered, and the store is applied with the Cluster.
Its rule implements the optional oam.EndpointProvider: it declares the CNPG
cluster’s data-plane endpoint (cnpg.io/cluster: <Cluster name>, the component
name unless the Cluster is named apart, on port 5432) so a downstream platform
can synthesize the target-side ingress allow ({comp}-allow-endpoint-ingress)
without hardcoding the operator selector. When pooler.enabled is set it
declares a second endpoint for the pooler (PgBouncer) pods
(cnpg.io/poolerName: <pooler name> on port 5432), so a consumer that dials
the pooler — whose pods carry a different label set and are not matched by the
direct-cluster selector — also gets its connection synthesized. The pooler name
there is the authored poolerName, else <component-name>-pooler, and the
Cluster name the authored clusterObjectName, else the component name:
Transformer.ComponentEndpoints asks no naming hook. The rule also implements
oam.NamedEndpointProvider, through which Transformer.ComponentEndpointsNamed
resolves each name with the consumer’s hook, asked the request the transform
asks, so a consumer that names the Pooler or the Cluster through the hook gets a
selector for the name the object has.
Validation
A Pooler, Database or ScheduledBackup name, generated or chosen, that is already
the name of another component in the document is refused, naming both. A
database name repeated in databases is refused, naming both entries: each
entry is one Database object, so the Flux build already failed on it, and the
plain manifest output carried duplicate Database documents (kubectl kept the
last). The Cluster kind’s policy checks now apply, under its field names: the
registry allowlist on the image (imageName, derived or authored), and
instances/storage.size in the policy messages. Refusals the API server or
the operator gave at apply now come at build: a resource request above its
limit, a database named postgres, template0, template1 or not a DNS-1123
subdomain, and an authored storageSize: "" (storageSize: must not be empty; omit it to take the policy default or 1Gi), which built a Cluster
CloudNativePG’s webhook refuses (“Size not configured”). The component name
becomes the Cluster’s name and its cnpg.io/cluster endpoint selector unless
the Cluster is named apart (clusterObjectName or the Naming hook, below), so
it carries cnpg-cluster’s name rule: a DNS-1035 label (no leading digit, no dot)
of at most 50 characters. Any other name is refused when the rule lowers it and
when endpoints are collected (postgresql name "db.main": must be a DNS-1035 label of at most 50 characters …). The cap also keeps both endpoint selector
values, the name and the pooler’s default <name>-pooler, within the
63-character label-value limit (a poolerName or a hook-given name is held to
it as a DNS-1123 label, and so is the default where the Cluster is named apart
and the component name is not bounded by the Cluster’s rule).
Behavior-changing under launcher.gokure.dev/v1alpha1: such a name used to
build and was then refused by CloudNativePG at apply, or, over 63 characters (56
with the pooler), gave a network-policy selector the API server refuses; it is
now refused at build. An authored version: "" is refused by name (version: must not be empty; omit it to default to "16"), with or without imageName: it
used to be kept as a value, so without imageName the cluster image was
ghcr.io/cloudnative-pg/postgresql: — an empty tag that only the image pull
rejected. Only an omitted or null version takes the default. storageSize: ""
is refused (above). The image is held to the tag rule (ValidateImageRef), with
or without a policy (breaking). Without imageName the image is
ghcr.io/cloudnative-pg/postgresql:<version>, so a version that makes a
:latest reference, or none that parses, is refused under the property the
author wrote, with the image it made: version: "latest" is refused as the tag of the default image: image "ghcr.io/cloudnative-pg/postgresql:latest" rejected: :latest tag not allowed; use an explicit version tag or digest. An authored
imageName is refused under imageName; version is read for the default
image only and is not checked beside one. The default version builds.
pooler.image is the PgBouncer image, written to the Pooler’s pgbouncer.image
and held to the tag rule under its own name (pooler.image: image "…" rejected: …) and, by the cnpg-pooler the pooler lowers to, to the registry allowlist.
Like the other pooler settings it needs pooler.enabled. Without it the
CloudNativePG operator chooses the PgBouncer image, so under a non-empty
allowlist an enabled pooler without pooler.image is refused (breaking: it
built before), reported under the Pooler’s component name: pgbouncer.image (pooler.image on a postgresql component): unset, so the CloudNativePG operator chooses the image the pods run, which the allowed registries [...] cannot hold; name an image from one of them. Set pooler.image to an image from the list.
With no allowlist nothing changes. Any other storage size the Cluster would
carry, authored or from the policy default, must parse and be positive
(storageSize: quantity must be positive, got "0"): CloudNativePG’s webhook
parses only the size, so a zero or negative one was admitted and its claims
failed the API server’s positive storage-request check. A policy storage-size
default is checked when it is applied (policy default for storage.size: invalid quantity "lots"), as the cpu/memory defaults are. The instance count must be at
least 1, the CRD’s minimum: a replicas policy default of 0 is refused
(instances: must be >= 1, got 0 from the policy default), and so is an
authored replicas: 0 when the rule lowers it (replicas: must be >= 1, got 0). Behavior-changing under launcher.gokure.dev/v1alpha1: an authored
replicas: 0 or a non-positive storageSize used to build and was then refused
at apply; it is now refused at build.
Behavior-changing: the former backup keys destinationPath, endpointURL
and secretName, which built the Cluster’s in-tree barmanObjectStore, and the
top-level objectStore and objectStoreObjectName are refused, whatever their
value, naming where each went (objectStore: moved to backup.objectStore (…),
backup.secretName: removed; use backup.objectStore.s3Credentials (…)), by the
document check and by the lowering alike. backup.retentionPolicy stays, and
now sets the ObjectStore’s retention. backup: {} is refused too
(backup.objectStore: required (…)). For a library consumer that registers
handlers itself: the rule now also lowers into cnpg-scheduledbackup, so a
registry with PostgresqlRule and without a cnpg-scheduledbackup handler
fails every transform at Seal, whatever the document (registry incomplete: … lowers into component type "cnpg-scheduledbackup", which is not registered);
the built-in set registers it. Until go-kure/launcher#643 the plugin entry named
a plugin CloudNativePG does not register (barman-cloud.barmancloud.cnpg.io)
under a key the plugin does not read (objectStoreName), and serverName went
on the ObjectStore, which the API server refused. Every other optional property
the handler reads goes through the same presence-reporting helpers: provider,
version, storageSize, imageName, the backup, monitoring, pooler,
bootstrap and replication.synchronous blocks and their fields, and each
entry of managedRoles, databases (with its extensions), externalClusters
and monitoring.customQueries. A value of the wrong type is refused by its path
(managedRoles[0].login: must be a boolean, got string,
databases[0].extensions[1]: must be an object, got string) where it used to be
dropped, so pooler.enabled: "true" no longer builds a cluster with no pooler
and backup: "s3" no longer builds one with no backup; an explicit null is
absence, typed or untyped, so a typed-nil storageSize takes the policy default
and a typed-nil pooler.instances or replication.synchronous.number takes the
handler default rather than being refused as a bad number. Two further shapes
that used to vanish are now errors: a non-string managedRoles[].inRoles entry,
and an externalClusters entry without a name. So is a managed role’s
connectionLimit: 0, as cnpg-cluster refuses it: CloudNativePG omits a zero
connectionLimit from the Cluster and applies its default -1, so the role
would deploy with no limit. A role that must not connect sets login: false
instead. The lowering repeats the refusal for a PostgresqlConfig built
directly rather than parsed. Endpoints runs the rule’s lowering on the
component, so what the lowering refuses of it has no endpoint, in the same
words. What a kind it lowers into refuses of a member (a database named
postgres) is not seen there: one of the four things an endpoint entry does not
see (pkg/oam, “Name roles and the Naming hook”).
Behavior-changing: the former bootstrap.recovery is refused, whatever its
value (bootstrap.recovery: moved to recovery (…)), and so is an external
cluster’s in-tree barmanObjectStore (externalClusters[0].barmanObjectStore: removed (in-tree Barman Cloud, gone in CloudNativePG 1.31); use recovery.source).
Two object store paths are required: backup.objectStore.destinationPath
(go-kure/launcher#1001; until then backup.destinationPath, where another value
of backup was set), and recovery.source.objectStore.destinationPath for an
inline recovery store (backup.objectStore.destinationPath: required (…)). The
ObjectStore CRD requires it. An authored empty path is refused in each (must not be empty (…)). Until go-kure/launcher#1001 the second was the path of an
external cluster’s in-tree barmanObjectStore, now refused (above). Of the
strings cnpg-cluster refuses unauthored, the lowering fills the parent of two,
bootstrap.pg_basebackup.source and the Cluster’s
postgresql.synchronous.method (authored here as
replication.synchronous.method), only from the string itself, and of the other
nine (the Cluster’s backup.barmanObjectStore.destinationPath and
externalClusters[].barmanObjectStore.destinationPath among them, since
backup and recovery write no in-tree Barman configuration, only plugin
entries) never.
A block that would not be built is refused, not dropped. Five blocks are built only when one field of theirs is set, and a document that authored other values of such a block without that field used to build with none of them in the result. It is refused by the name of the missing field:
backup: built fromobjectStore, so anybackup, an empty one included, without one is refused (backup.objectStore: required (…)); the store itself needs adestinationPaththat is not empty ands3Credentials(go-kure/launcher#1001, above; until then the Cluster’s backup was built frombackup.destinationPath).bootstrap.pg_basebackup: the bootstrap is built from a non-emptysource, so the block without one is refused (bootstrap.pg_basebackup.source: required (…), ormust not be empty (…)for an authored"").recovery, which replacedbootstrap.recovery, is refused without itssourcelikewise (recovery.source: required (…)).bootstrap.initdbis built fromdatabaseandownertogether, so the block without either is refused by that field’s name (bootstrap.initdb.owner: required (…)).replication.synchronous: built frommethod, so the block without one is refused (replication.synchronous.method: required (any or first)), after a wrongly typednumberordataDurability, which is still refused by its own path.monitoring: built whenenabledis true, socustomQueriesbeside anenabledthat is not authored is refused (monitoring.enabled: required where monitoring.customQueries is set (…)).pooler: the Pooler is emitted whenenabledis true, soinstances,type,poolMode,parametersorimagebeside anenabledthat is not authored is refused (pooler.enabled: required where pooler.instances is set (…)).
An authored enabled: false keeps building, in pooler and in
monitoring: enabled is the block’s own switch, the author wrote “off”, and
the settings beside it are kept in the document for when it is switched on.
poolerName differs (refused whenever pooler.enabled is not true, an authored
false included) because it is a property outside the block that names an object
which does not exist while the pooler is off. A block with nothing in it
(bootstrap: {}, replication: {}, monitoring: {}, pooler: {}), or with an
empty customQueries list or parameters map only, authors no value and builds
as before; backup: {} is the exception, refused since go-kure/launcher#1001
(above).
Breaking for a document that authored one of these blocks without its field,
among them a backup with an endpointURL or an empty retentionPolicy and no
path, a bootstrap.pg_basebackup: {} and a replication.synchronous with a
number only. Such a document built, without what the author wrote.
An additional Service’s name is the serviceTemplate.metadata.name of a
managed.services.additional[] entry, and CloudNativePG creates the Service
under it: a name with a leading digit is refused when spec.kubernetesVersion
is below 1.36, RelaxedServiceNameValidation, unless spec.featureGates sets
that gate on, naming the entry by its index (docs/delivery-scope.md §3.5).
The Pooler’s and the Databases’ names are resolved in the order of every
name role (see “Name roles and the Naming hook” in
site/content/api-reference/oam/names-and-overrides.md): the author’s property,
else the consumer’s Naming hook, else the default. poolerName names the
Pooler (role pooler, default <name>-pooler) and must be a DNS-1123 label,
since CloudNativePG names the pooler’s Service after it (a leading digit is
refused when spec.kubernetesVersion is below 1.36,
RelaxedServiceNameValidation, unless spec.featureGates sets that gate on, the
default <name>-pooler included; docs/delivery-scope.md §3.5); it is refused
when pooler.enabled is not true. databases[].objectName names that entry’s
Database object (role database, default <name>-<db>) and must be a DNS-1123
subdomain; the entry’s name stays the database created in PostgreSQL. A
database whose name cannot be part of an object name (app_data) has no
default and needs an objectName: without one it is refused, and the hook is
not asked for it. A name is used as written or refused, never shortened. Each is
also the name of the component the rule emits, so one that is already a
component of the document, the postgresql component’s own name included, is
refused, naming both; two Databases given one name are refused, naming both
entries; a Database given the Pooler’s name is its sibling, as above. The hook
is asked only inside Transform: a rule driven directly keeps the author’s
names and the defaults. With neither an authored name nor a hook the output is
what it was. The Cluster’s and the ObjectStore’s names are resolved in the
same order. clusterObjectName names the Cluster (role postgresql-cluster)
and backup.objectStoreObjectName the ObjectStore (role
postgresql-objectstore; a top-level property until go-kure/launcher#1001); the
default of each is the component name. The two end in ObjectName as
objectName does on a kind component, while poolerName, the older property,
keeps the name it has. Without backup there is no store, and the hook is not
asked for one. The Cluster’s name is held to the Cluster’s rule whoever chose
it, a DNS-1035 label of at most 50 characters: a name that is no label is
refused as every role’s is, and a label over 50 characters by the rule, naming
both places it can come from (clusterObjectName (or the Naming hook's answer for role "postgresql-cluster"): postgresql Cluster name "…": must be a DNS-1035 label of at most 50 characters …). A component whose own name is no such label
is accepted once its Cluster is named apart. The ObjectStore’s name is a
DNS-1123 subdomain. Each is used as written or refused, never shortened. Each
names its object alone: the two member components, their same-name sibling
group, the policies the rule adds and the component label keep the component
name. What the rule writes to the two objects follows the names they took: the
Pooler’s cluster.name, each Database’s and each ScheduledBackup’s
cluster.name, the cnpg.io/cluster endpoint selector, and the
barmanObjectName parameter of the Cluster’s backup plugin. The default names
of the Pooler, the Databases and the ScheduledBackups keep deriving from the
component name (<name>-pooler, <name>-<db>, <name>-<schedule>), whatever
the Cluster is named. The recovery ObjectStore’s name is the Naming hook’s
answer for role postgresql-recovery-objectstore, else
<name>-recovery-source, with no property of its own; the hook is not asked
where recovery.source.objectStoreName names an existing store. It is a
DNS-1123 subdomain, a component of its own, and the Cluster’s recovery source
names the store by it; a name another component of the document holds is
refused, naming both. The ScheduledBackups’ names are resolved the same way,
with no property of their own: the Naming hook’s answer for role
postgresql-scheduledbackup, else <name>-<schedule>, where the schedule’s
name is the suffix. Whichever it is, it is held to 63 characters, since
CloudNativePG copies it into a label of each Backup it creates
(backup.schedules[0] "nightly": ScheduledBackup name "…" is 64 characters long, …; shorten the component or the schedule name, or, for the hook’s answer, …; shorten the Naming hook's answer for role "postgresql-scheduledbackup"), and,
as every member’s, a name another component of the document or another member
already holds is refused, naming both. With the Cluster named apart the
component name is no longer bounded by the Cluster’s rule, so the Pooler’s
default is held to the Pooler’s own, by the lowering and where endpoints are
collected alike, and the refusal says what settles it (pooler: cnpg-pooler name "db.main-pooler": must be a DNS-1123 label of at most 63 characters (CloudNativePG names the pooler's Service after it); the default derives from the component name: set poolerName to name the Pooler otherwise). A Pooler
cannot carry its Cluster’s name, and with the Cluster named apart the two can
meet (a clusterObjectName of db-pooler on component db): it is refused
where the Pooler is built, and where endpoints are collected in the same words
(cluster.name "db-pooler": a pooler cannot have the same name as its cluster).
A Pooler or a Database named like the postgresql component itself (a
poolerName of db on component db, a database’s objectName, or the hook’s
answer) is a name the document already holds: it is refused by the lowering, and
where endpoints are collected in the same words (pooler: generates component "db", which is already the name of component "db" (type "postgresql") in the document; rename one of them). One named like another component of the document
is refused by the lowering only: endpoints are collected for one component
(pkg/oam, “Name roles and the Naming hook”). CloudNativePG derives the
Cluster’s Services (<cluster>-rw, <cluster>-ro, <cluster>-r) and Secrets
(<cluster>-app and the others) from the Cluster’s name, and the default backup
path moves with it: the server name a backup is stored under is the Cluster’s
name unless backup.serverName sets it. Renaming an existing Cluster creates a
new one: the old one is pruned with its data unless it is protected. Every
address or Secret reference written with the old name is the author’s to
change. A model part that reads this component writes no name by hand:
parts.<part>.app_secret.name gives the name of the Secret <cluster>-app, and
parts.<part>.cluster.name gives the Cluster’s name, and
parts.<part>.rw_service.name gives the name of the read-write Service
<cluster>-rw, which a reader uses as the database host. A part that sets
recovery.secret.name declares no app_secret, because CloudNativePG does not
generate that Secret then, and a read of it fails. The name follows
clusterObjectName and the Naming hook, like the name of the Cluster the
build makes. The Secret is of type kubernetes.io/basic-auth. CloudNativePG
writes these keys into it (cloudnative-pg v1.30.1, pkg/specs/secrets.go):
username, user, password, dbname, host, port, pgpass, uri,
jdbc-uri, fqdn-uri and fqdn-jdbc-uri. A consumer reads one of these as the
key of a secretKeyRef. Only a part later in the document reads the output.
Example
The component in pkg/cmd/kurel/testdata/postgresql-full/app.yaml, built
against the cluster.yaml beside it, gives the expected.yaml beside it. The
fixture test compares the two.
cnpg-cluster
cnpg-cluster — the operator-CR kind component for a CloudNativePG Cluster
(design: docs/oam/design-operator-cr-components.md).
Properties
The component name becomes the Cluster’s name and its cnpg.io/cluster endpoint
selector, so it must be what CloudNativePG’s admission webhook admits: a
DNS-1035 label (no leading digit, no dot) of at most 50 characters. Any other
name is refused at parse time, when endpoints are collected and by Generate
(cnpg-cluster name "db.main": must be a DNS-1035 label of at most 50 characters …), although other kinds accept DNS-1123 subdomains of up to 253. Its
properties are the spec of a postgresql.cnpg.io/v1 Cluster, one schema key
per ClusterSpec json field: scalars are typed, and every structured field is
an open object or an array of open objects whose description points at the
upstream type. ToApplicationConfig decodes the whole property map into
cnpgv1.ClusterSpec with builtin.DecodeStrictJSON, so a key the linked CNPG
version does not declare, at any depth (storage.sise,
bootstrap.initdb.databse), and a value of the wrong type (storage.size: 5)
are refused rather than dropped. Two limits come from encoding/json itself:
the unknown-field error names the key but not its path, and a key differing from
a declared one only in letter case is accepted as that field (two spellings of
one field in the same object are refused, since the decoder would keep only one:
storage.size: sets the same field as storage.Size …). The policy defaults
below read what was authored from the decoded spec as well as from the property
map, where every spelling the decoder accepts is consulted, so such a key still
counts as authored and is not overwritten by a default — including an empty
storage.size, which the decoded spec cannot tell from absence.
Outputs
It carries no launcher opinions: Generate emits the Cluster named after
the component in the build namespace with exactly the authored spec, so an
unauthored field is left for the operator’s own default. postgresql’s choices
— an image from version, primaryUpdateStrategy: unsupervised, enablePDB
from the replica count, a 1Gi storage fallback, pod anti-affinity — are not
made here: its lowering rule writes them as this kind’s properties, and the
trait it attaches sets the two that depend on the policy (see postgresql). The
one value it writes unasked is instances: 1, the CRD default, because
ClusterSpec.Instances has no omitempty and would otherwise serialize as 0.
The non-pointer blocks appear even when unauthored, as they do for postgresql:
affinity and resources as empty objects, and postgresql as
syncReplicaElectionConstraint: {enabled: false}, because that nested field’s
enabled has no omitempty.
Validation
Nulls follow “The null contract”, and
a null is whatever serializes to JSON null: the properties are marshalled with
encoding/json and read back before anything else looks at them, so a null map
value is left out rather than decoded to an empty string, and a null array
element is refused by path (env[0]: null is not a valid array element). The
contract covers declared keys only: a key the CNPG type does not declare is
refused as an unknown field even when its value is null (storage: {sise: null}), not dropped with the null. A lowering rule emits JSON-shaped values
(string-keyed maps, slices, scalars) as for every component; that is the
supported contract, and the engine’s schema check refuses a typed API struct
where it checks an object or array item (for example an env entry), though not
inside an open object’s undeclared keys. Because the reading is the
serialization itself, a direct caller of the handler additionally has a value
built in Go read exactly as encoding/json writes it — a concrete collection
type, a nil behind a pointer, a json.RawMessage and a custom encoder included.
A value that does not serialize is refused. An instances below 1, in any
spelling, is refused before policy runs (instances: must be >= 1, got 0): the
CRD’s minimum is 1, so the API server would refuse the Cluster. A policy
instance-count default below 1 is refused the same way. Generate repeats the
name and instance-count refusals on what it emits, the count’s upper bound
(instances: must be <= 2147483647, got …) included, so a CnpgClusterConfig
built in Go without ToApplicationConfig cannot produce a Cluster the operator
or the API server rejects for either. It also refuses any storage request the
Cluster carries that does not parse or is not positive, authored or from a
policy default, on every claim the storage maximum below covers (storage.size: quantity must be positive, got "0";
walStorage.pvcTemplate.resources.requests.storage: …): CloudNativePG’s webhook
parses only storage.size, so such a Cluster was admitted and its claims then
failed the API server’s positive storage-request check. An unset size is still
left to the operator. An authored 0 or false that the typed spec cannot
carry, on a field whose CRD default is not zero, is refused by path
(managed.roles[0].connectionLimit: 0 cannot be carried by the CloudNativePG API types (the field is omitted when zero, so the operator would apply its default -1)). These fields are non-pointer and omitempty, so the value is omitted
when the Cluster is encoded and the operator applies its CRD default instead.
For the linked CNPG version they are managed.roles[].connectionLimit (default
-1, unlimited), postgresUID and postgresGID (26), startDelay (3600),
stopDelay (1800), switchoverDelay (3600),
probes.liveness.isolationCheck.requestTimeout and .connectionTimeout
(1000) and replicationSlots.updateInterval (30); a test derives the set
from the CNPG module’s CRD and Go types, so a CNPG bump that changes it fails
CI. An explicit zero default on any other such field, such as
managed.roles[].login: false, superuser: false, minSyncReplicas: 0 or
monitoring.enablePodMonitor: false, is accepted: it is omitted too, and the
field’s absence means the same value. Two fields the Cluster CRD requires, which
the Go type leaves out when they are empty, are refused when unauthored or
empty: the signerName and the keyType of a pod certificate source of the
projected volume template
(projectedVolumeTemplate.sources[0].podCertificate.signerName: required (…)).
The object would show the omission and the API server refuse it. Two more that
the CRD requires, which the Go type writes as null when they are unauthored,
are refused when unauthored: the nodeSelectorTerms of a required node affinity
(affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms: required (…)) and the databases of an import
(bootstrap.initdb.import.databases: required (…)). The API server drops a null
of a field that is not nullable before it validates, so the required field is
then missing. An authored empty list is written as one and is not refused here.
A third such field is not refused:
replicationSlots.synchronizeReplicas.enabled, which the CRD defaults, so the
API server puts the default (true) in the place of the null.
TestKindComponents_NullRequired derives the three from the CRD and shows each
answer by running the CRD’s schema validator on the object. The barman-cloud
fields s3Credentials.sseCustomerKey (with its name and key) and
s3AddressingStyle, under backup.barmanObjectStore and under each
externalClusters[].barmanObjectStore, are in the Cluster CRD of cloudnative-pg
v1.30.2, so the kind takes them like any other field, with the CRD’s one
rule on them: an s3AddressingStyle on a store that has no s3Credentials is
refused by its path (backup.barmanObjectStore.s3AddressingStyle: requires s3Credentials (a rule of the Cluster CRD)). The kind’s required list is generated (see “Required
fields a kind writes unauthored and does not
refuse”):
every field the Cluster CRD requires that the Go type writes whether or not it
was authored ("", 0, {} or null) is refused when unauthored, each where
its parent is authored (replica.source: required (…)), the fields of the
Kubernetes types the spec embeds included. Among them are the eleven strings the
kind refused by hand before, which the CRD bounds with a minimum length or an
enumeration: backup.barmanObjectStore.destinationPath,
bootstrap.initdb.import.type (microservice or monolith),
bootstrap.pg_basebackup.source,
externalClusters[].barmanObjectStore.destinationPath,
managed.services.additional[].selectorType (rw, r or ro),
podSelectorRefs[].name, the name of a postgresql.extensions[] entry and
the name and the value of its env[] entries,
postgresql.synchronous.method (any or first) and replica.source; and,
refused since go-kure/launcher#883 (breaking for a document that leaves one
out under an authored parent), the name and key of a Secret or ConfigMap
reference, an imageCatalogRef’s kind, name and major,
postgresql.synchronous.number, an external cluster’s name, a plugin’s
name, a tablespace’s name and storage, a podSelectorRefs entry’s
selector, the topologyKey of a pod affinity term and the weight of a
weighted one, the maxSkew, topologyKey and whenUnsatisfiable of a topology
spread constraint and the type of a seccomp or AppArmor profile. A field the
kind refused by hand keeps its text byte for byte; any other reads the CloudNativePG API requires this field (or requires the name of what this refers to, for a reference’s name). Most such objects the API server refused;
an imageCatalogRef written with name: "" or major: 0 it accepted, and it
reached the operator. An authored empty one is a value: it is written, and
refusing it is left to the API server. The refusal reads the authored
properties, so Generate does not repeat it: a CnpgClusterConfig built in Go
is not held to it. Nor is the component a postgresql component is lowered to,
whose properties are written from a typed spec, so that a string left out there
reaches the kind as an authored "": postgresql refuses the two it could
leave out itself, under the property its author wrote (above). The same test
derives every field the type writes unauthored as a zero value the CRD’s own
rule refuses, and shows each answer with the validator; the twelfth of a Cluster
is instances, which is not refused (below).
TestKindComponents_OmittedRequiredAndWrittenDefaults derives the two from the
CRD and shows the refusals. It also holds the two fields the CRD defaults and
the type writes unauthored to a reason they are harmless: instances, of which
the kind always writes a count (the authored one, the policy’s default, or the
CRD’s own 1), and backup.volumeSnapshot.onlineConfiguration, written {}
under an authored volumeSnapshot. The CRD’s default for the object is
waitForArchive: true and immediateCheckpoint: false; in a {} it fills
waitForArchive with the field’s own default true, and an absent
immediateCheckpoint is false. A false or 0 the type keeps (a pointer
such as enablePDB: false, a quantity cpu: 0) is emitted as authored. An
authored empty string the type omits on a field the CRD defaults
(primaryUpdateStrategy: "", logLevel: "") is refused as a defaulted 0 is
(cnpgClusterDefaultedZeroFields); elsewhere it is not refused — storage.size: "", which the CRD does not default, keeps its meaning above. The two
pod-certificate fields above are refused too: an empty signerName or keyType
is refused as an unauthored one is. A match expression authored in one of the
spec’s label selectors without its key or its operator is refused by path
(podSelectorRefs[0].selector.matchExpressions[0].operator: required (…)): the
CRD requires both, and the type would write them empty; the generated list holds
them with the sentences of every kind’s selectors. Presence only; “A label
selector’s match
expressions” lists the
selectors and says what is left to the API server and to the operator’s webhook.
ApplyPolicy enforces the policy postgresql enforces (postgresql lowers onto
this kind, so it is the same code), in this order: the instance-count default
when instances is not authored (an authored value wins even when it equals the
fallback) and its maximum; the cpu and memory request and limit defaults on
resources, filling only unset entries, and their maxima; and the storage-size
default on storage.size when neither storage.size nor
storage.pvcTemplate’s storage request is authored. With no policy default the
size is left to the operator; the 1Gi fallback is postgresql’s, applied after
the policy by the post-policy step its rule attaches (ApplyPostgresqlDefaults:
the fallback is held to the policy maximum, and enablePDB is set from the
instance count; a fallback over the maximum is the component’s
oam.ViolationError of class oam.RefusalStorageMaximum, as a refusal of
ApplyPolicy is). That method is for that step, not an authoring surface. A
storage-size default that is not a quantity is refused (policy default for storage.size: invalid quantity "lots"), as an invalid cpu or memory default is,
since with no maximum set nothing else would parse it. So is a zero or negative
one (quantity must be positive, got "0"): CloudNativePG’s webhook only parses
the size, and the claims it creates would then fail the API server’s positive
storage-request check. The storage maximum applies to every claim the Cluster
creates — storage, walStorage, each tablespaces[i].storage (either size
or the pvcTemplate request) and ephemeralVolumeSource.volumeClaimTemplate —
and the error names the one that exceeds it. Because this kind exposes the two
security contexts, it also refuses securityContext.privileged and a
securityContext or podSecurityContext windowsOptions.hostProcess unless
the policy allows privileged workloads, and an added capability the policy
forbids or leaves off a non-empty allowlist. The registry allowlist the workload
kinds apply to their image applies to an authored imageName (imageName: image "…" is not from an allowed registry [...]). When imageName is unset, the
operator takes the image from the catalog imageCatalogRef names, which this
kind does not check, or, without one, chooses an image of its own, which no
allowlist can hold: under a non-empty allowlist a Cluster with neither
imageName nor imageCatalogRef is refused, with the registry class
(breaking: it built before): imageName: unset, so the CloudNativePG operator chooses the image the pods run, which the allowed registries [...] cannot hold; name an image from one of them. Set imageName, or
imageCatalogRef to take the image from a catalog. With no allowlist nothing
changes. The operator’s own image, which it runs in the instance pods’ bootstrap
init container, is not covered: no field of the Cluster names it. A postgresql
component always writes imageName (its derived
ghcr.io/cloudnative-pg/postgresql:<version> or the authored one), so the
allowlist applies to its image too. The allowlist applies as well to the image
of each postgresql.extensions[] entry, which the operator mounts into the
instance pods as an image volume (breaking: an extension image from a
registry outside the list built before):
postgresql.extensions[0].image.reference: image "…" is not from an allowed registry [...], with the registry class, the reference read as imageName is
(see Image volumes under pod). An entry without a reference is not
checked: the operator takes that image from the catalog imageCatalogRef names
(and refuses the Cluster without one), and a catalog’s images are not checked by
this kind, as for an unset imageName. A build reads the objects a document
brings, not an object a reference points at: a catalog’s images are held where
the catalog is authored, by the kind that builds it. cnpg-imagecatalog and
cnpg-clusterimagecatalog hold every image of a catalog they build to the same
list (see their entry above). Nothing in this library holds the images of any
other catalog: not of a raw catalog on manifests, passthrough or a chart,
and not of one that already exists in the cluster. A postgresql component
writes no extension entry. imageName and the extension images are every image
a Cluster names today; the test that walks the pod spec for image fields walks
the Cluster and the Pooler spec the same way. Both are also held to the tag rule
(ValidateImageRef) when the component is read and again at generation, with or
without a policy (breaking: an untagged or :latest imageName or
extension reference built before): imageName: image "…" rejected: no tag or digest specified; use an explicit version tag or digest,
postgresql.extensions[0].image.reference: image "…" rejected: …. An unset
imageName and an entry without a reference name no image and are not checked,
as for the allowlist. A digest without a tag passes, here as everywhere the rule
runs; on imageName CloudNativePG’s webhook refuses one, and a tag that is no
PostgreSQL version, and those are the operator’s value rules, left to the
operator. Generation refuses hugepages-<size> in resources without cpu or
memory after policy defaults. It also applies the shared parser’s
request/limit cross-check there (resources: cpu: request 2 must not exceed limit 1; hugepages and extended resources need a limit equal to the request),
so a policy default limit below an authored request is refused as well. The
other resource-name rules of the shared parser are left to the API server.
Endpoints declares the same primary endpoint as postgresql
(cnpg.io/cluster: <Cluster name> on port 5432), and only for a component the
parse accepts: what ToApplicationConfig refuses of the name or of the
properties is refused where endpoints are collected, in the same words
(instances: must be >= 1, got 0). What Generate refuses once the policy is
applied is not repeated there.
Example
The component in pkg/cmd/kurel/testdata/cnpg-cluster-full/app.yaml, built
against the cluster.yaml beside it, gives the expected.yaml beside it. The
fixture test compares the two.
cnpg-pooler, cnpg-database, cnpg-objectstore
Properties
cnpg-pooler, cnpg-database, cnpg-objectstore — the operator-CR kind
components for a CloudNativePG Pooler and Database and a Barman Cloud plugin
ObjectStore (barmancloud.cnpg.io/v1), built on the cnpg-cluster recipe:
one schema key per json field of PoolerSpec, DatabaseSpec or
ObjectStoreSpec, the whole property map decoded strictly into that type under
the same null contract, the same refusal of an authored 0 or false the type
cannot carry (for the linked versions only
instanceSidecarConfiguration.retentionPolicyIntervalSeconds, default 1800,
on the ObjectStore) and of two spellings of one field, and the same reflection
tests pinning the schema and both derived lists to the linked modules.
Outputs
Generate emits one object named after the component in the build namespace
with the authored spec, and repeats the parse-time refusals made on the decoded
spec.
Validation
The fields each CRD requires are refused when unauthored or empty, by path:
cluster.name and pgbouncer on the Pooler (pgbouncer: {} selects
PgBouncer’s defaults); cluster.name, name and owner on the Database;
configuration.destinationPath on the ObjectStore. The published schema marks
the top-level property of each as required: cluster and pgbouncer of a
cnpg-pooler; cluster, name and owner of a cnpg-database;
configuration of a cnpg-objectstore. That refuses no component that built
before, since the kind refused each without it already. The template of a
cnpg-pooler is an open object, so its schema names the gated pod fields in
gatedPaths, as the pod template kinds do: a gated field under template.spec
is refused when the ClusterProfile’s kubernetesVersion is below the release
where its feature gate is on by default, unless the profile’s
spec.featureGates sets that gate on, and refused at any version when it sets
the gate off. A document with no kubernetesVersion is unchanged. The
required lists of the three kinds are generated, as cnpg-cluster’s is: every
field each CRD requires that the Go type writes whether or not it was authored
is refused when unauthored under an authored parent, with the text the kind gave
it by hand where it had one. Breaking for a document that leaves one out
under an authored parent: on the Pooler, among others, the name of a
pgbouncer Secret reference, pgbouncer.imageCatalogRef’s kind and name, a
service port’s port, and under template.spec a container’s name, the
topologyKey of a pod affinity term, a topology spread constraint’s maxSkew,
topologyKey and whenUnsatisfiable and a seccomp profile’s type; on the
Database, the name of a schemas, extensions, fdws or servers entry,
the name and value of an option, the name of a usage and a server’s fdw;
on the ObjectStore, the name and key of a credential’s or endpointCA’s
Secret reference and the fields of the sidecar’s env the pod kinds require.
The texts the kinds refused with before (cluster.name: required (…),
pgbouncer: required (…)) are kept byte for byte. template.spec.containers is
not refused: the kind writes containers: [] itself, which the CRD accepts
(below). A cluster.name must be a name CloudNativePG admits for a Cluster (a
DNS-1035 label of at most 50 characters). On the Pooler, a match expression
authored in a label selector of template.spec without its key or its
operator is refused too, by path, by the generated list; an authored empty one
is not (presence only; see “A label selector’s match
expressions”).
cnpg-pooler writes no type or instance count of its own, so the operator’s
defaults (rw, 1) apply. Its component name is the Pooler’s name and its
Service’s, so it must be a DNS-1123 label of at most 63 characters (a leading
digit is refused when spec.kubernetesVersion is below 1.36,
RelaxedServiceNameValidation, unless spec.featureGates sets that gate on;
CloudNativePG’s Pooler webhook checks no name syntax, go-kure/launcher#959,
docs/delivery-scope.md §3.5), and a pooler named like its cluster is refused,
as CloudNativePG’s webhook does: by the build, and where its endpoint is
collected in the same words (cluster.name "main": a pooler cannot have the same name as its cluster). ApplyPolicy applies the workload kinds’ pod gates to
template.spec (host namespaces, hostPath volumes, privilege, host-process,
capabilities, the registry allowlist on each authored container image, cpu and
memory maxima; errors name the container, as in template.spec.containers[0] "pgbouncer": cpu limit "2" exceeds enforced maximum "1"), caps a generic
ephemeral volume’s claim at the policy storage maximum, holds an image volume’s
reference to the registry allowlist (template.spec: volume "ext" image.reference: image "…" is not from an allowed registry [...]; breaking,
go-kure/launcher#790, see Image volumes under pod), and applies the
registry allowlist to an authored pgbouncer.image. With or without a policy,
when the component is read and again at generation, an authored
pgbouncer.image, the image of each init and regular container of the template
and the reference of each of its image volumes are held to the tag rule
(ValidateImageRef; breaking, go-kure/launcher#790: an untagged or
:latest one built before): pgbouncer.image: image "…" rejected: …,
template.spec.containers[0] "pgbouncer": image "…" rejected: …. A template
container that names no image is not checked: the operator supplies the
PgBouncer image, so that is the ordinary form here, where the pod kinds refuse
it. The operator takes the PgBouncer image, in order, from the template’s
regular container named pgbouncer, from pgbouncer.image, from the catalog
pgbouncer.imageCatalogRef names (not checked by this kind, as for
cnpg-cluster), and otherwise chooses one of its own, which no allowlist can
hold. Under a non-empty allowlist a Pooler that names its image none of these
three ways is refused, with the registry class (breaking: it built before):
pgbouncer.image (pooler.image on a postgresql component): unset, so the CloudNativePG operator chooses the image the pods run, which the allowed registries [...] cannot hold; name an image from one of them. An image on an
init container or on a container of another name does not count. With no
allowlist nothing changes. The operator’s own image, which it runs in the pod’s
bootstrap init container, is not covered: no field of the Pooler names it.
Generation runs the shared parser’s request/limit and hugepages checks on the
template’s pod and container resources (template.spec.containers[0] "pgbouncer": resources: cpu: request 2 must not exceed limit 1), as
cnpg-cluster does on its resources; the other resource-name rules of the
shared parser are left to the API server. A template declaring
ephemeralContainers, activeDeadlineSeconds, priority or overhead is
refused, as the workload kinds refuse them: the operator copies the template
into a Deployment, whose pod template cannot carry the first two and whose pods
get the last two from the default Priority and RuntimeClass admission
controllers, which refuse an authored value that differs from theirs. Four
fields the Pooler CRD requires under template.spec, which the pod spec’s type
leaves out when they are empty, are refused when unauthored or empty: the
action of a restart rule of a container or an init container and the
operator of its exit codes
(template.spec.containers[0].restartPolicyRules[0].action: required (…)), and
the signerName and keyType of a pod certificate source of a projected volume
(template.spec.volumes[0].projected.sources[0].podCertificate.signerName: required (…)). The object would show the omission and the API server refuse it;
the CRD of the linked module settles that, which is what the built-in pod kinds
lack.
Five more that the CRD requires under template.spec, which the pod spec’s type
writes as null when they are unauthored, are refused when unauthored: the
nodeSelectorTerms of a required node affinity, the priority of an eviction
responder, the monitors of a cephfs or an rbd volume, and the secretRef
of a scaleIO volume (template.spec.volumes[0].cephfs.monitors: required (…)). The API server drops a null of a field that is not nullable before it
validates, so the required field is then missing. An authored empty list is
written as one and is not refused here. template.spec.containers is such a
field too and is not refused: the kind writes containers: [] itself (below).
One string the CRD requires and bounds with a pattern, which the type writes as
"" when it is unauthored, is refused when unauthored under an authored
pgbouncer.imageCatalogRef: its key (pgbouncer.imageCatalogRef.key: required (…)). An authored empty one is written, and refusing it is left to the API
server. The refusal reads the authored properties, so Generate does not repeat
it: a CnpgPoolerConfig built in Go is not held to it.
The instance count is deliberately not policed: postgresql, which lowers its
pooler onto this kind, never applied a policy to the pooler’s count, so a
maximum here would refuse a document that built before. Pod-level errors name
the template’s own fields, as in template.spec: resources cpu limit "2" exceeds enforced maximum "1". A template that lists no containers (labels only, say)
is written with containers: []: the Go type cannot omit the template’s spec,
the CRD requires containers once it is present, and the operator adds its
pgbouncer container either way. Endpoints declares the PgBouncer pods
(cnpg.io/poolerName: <Pooler object name> on port 5432: the component name
unless objectName or the naming hook names the Pooler), byte-identical to
postgresql’s pooler endpoint for a pooler of that name
(<component-name>-pooler by default, of the postgresql component), and only
for a component the parse accepts: what ToApplicationConfig refuses is refused
where endpoints are collected, in the same words (pgbouncer: required (an empty object selects PgBouncer's defaults)). cnpg-database also refuses the names
the CRD reserves (postgres, template0, template1). The ensure of each
schema, extension, fdw and server has no omitempty but a CRD default of
present, so Generate writes present where it is unauthored, as the API
server would have; a test derives that list from the CRD too. An authored
ensure: "" there is refused by its path (schemas[0].ensure: "" is refused by the Database CRD, …) rather than written as present, since the CRD’s enum
refuses it as written; an explicit null is absence and takes the default. A
Database runs nothing, so it has no policy and no endpoint. cnpg-objectstore
caps the cpu and memory requests and limits of the plugin sidecar it adds to
every instance pod (instanceSidecarConfiguration.resources) at the policy
maxima, filling no default, and declares no endpoint; generation runs the same
request/limit and hugepages checks on them, leaving the other resource-name
rules to the API server. It refuses configuration.serverName, which the shared
Barman type carries but the plugin’s CRD forbids on an ObjectStore: the server
name is a plugin parameter of the Cluster that uses the store.
Example
cnpg-pooler: The component inpkg/cmd/kurel/testdata/cnpg-pooler-full/app.yaml, built against thecluster.yamlbeside it, gives theexpected.yamlbeside it. The fixture test compares the two.cnpg-database: The component inpkg/cmd/kurel/testdata/cnpg-database-full/app.yaml, built against thecluster.yamlbeside it, gives theexpected.yamlbeside it. The fixture test compares the two.cnpg-objectstore: The component inpkg/cmd/kurel/testdata/cnpg-objectstore-full/app.yaml, built against thecluster.yamlbeside it, gives theexpected.yamlbeside it. The fixture test compares the two.