Skip to content

Commit 3040626

Browse files
committed
docs: import CloudNativePG main
1 parent 3ac32c7 commit 3040626

7 files changed

Lines changed: 351 additions & 17 deletions

website/docs/cloudnative-pg.v1.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,24 @@ _Appears in:_
429429
| `secret` _[LocalObjectReference](https://pkg.go.dev/github.com/cloudnative-pg/machinery/pkg/api#LocalObjectReference)_ | Name of the secret containing the initial credentials for the<br />owner of the user database. If empty a new secret will be<br />created from scratch | | | |
430430

431431

432+
#### CatalogComponentImage
433+
434+
435+
436+
CatalogComponentImage is a named image entry for a non-PostgreSQL component.
437+
438+
439+
440+
_Appears in:_
441+
442+
- [ImageCatalogSpec](#imagecatalogspec)
443+
444+
| Field | Description | Required | Default | Validation |
445+
| --- | --- | --- | --- | --- |
446+
| `key` _string_ | Key is the unique identifier for this image within the catalog. | True | | MaxLength: 63 <br />Pattern: `^[a-z0-9]([-a-z0-9]*[a-z0-9])?$` <br /> |
447+
| `image` _string_ | Image is the container image reference. | True | | |
448+
449+
432450
#### CatalogImage
433451

434452

@@ -1150,6 +1168,27 @@ ImageCatalog is the Schema for the imagecatalogs API
11501168
| `spec` _[ImageCatalogSpec](#imagecatalogspec)_ | Specification of the desired behavior of the ImageCatalog.<br />More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status | True | | |
11511169

11521170

1171+
#### ImageCatalogComponentRef
1172+
1173+
1174+
1175+
ImageCatalogComponentRef identifies a named image within the componentImages list of an
1176+
ImageCatalog or ClusterImageCatalog.
1177+
1178+
1179+
1180+
_Appears in:_
1181+
1182+
- [PgBouncerSpec](#pgbouncerspec)
1183+
1184+
| Field | Description | Required | Default | Validation |
1185+
| --- | --- | --- | --- | --- |
1186+
| `apiGroup` _string_ | APIGroup is the group for the resource being referenced.<br />If APIGroup is not specified, the specified Kind must be in the core API group.<br />For any other third-party types, APIGroup is required. | | | |
1187+
| `kind` _string_ | Kind is the type of resource being referenced | True | | |
1188+
| `name` _string_ | Name is the name of resource being referenced | True | | |
1189+
| `key` _string_ | Key identifies the entry within the catalog's componentImages list. | True | | MaxLength: 63 <br />Pattern: `^[a-z0-9]([-a-z0-9]*[a-z0-9])?$` <br /> |
1190+
1191+
11531192
#### ImageCatalogRef
11541193

11551194

@@ -1186,6 +1225,7 @@ _Appears in:_
11861225
| Field | Description | Required | Default | Validation |
11871226
| --- | --- | --- | --- | --- |
11881227
| `images` _[CatalogImage](#catalogimage) array_ | List of CatalogImages available in the catalog | True | | MaxItems: 8 <br />MinItems: 1 <br /> |
1228+
| `componentImages` _[CatalogComponentImage](#catalogcomponentimage) array_ | ComponentImages is a list of named images for components other than PostgreSQL<br />(e.g. pgbouncer). Keys must be unique within a catalog. | | | MaxItems: 32 <br /> |
11891229

11901230

11911231
#### ImageInfo
@@ -1697,6 +1737,8 @@ _Appears in:_
16971737
| `parameters` _object (keys:string, values:string)_ | Additional parameters to be passed to PgBouncer - please check<br />the CNPG documentation for a list of options you can configure | | | |
16981738
| `pg_hba` _string array_ | PostgreSQL Host Based Authentication rules (lines to be appended<br />to the pg_hba.conf file) | | | |
16991739
| `paused` _boolean_ | When set to `true`, PgBouncer will disconnect from the PostgreSQL<br />server, first waiting for all queries to complete, and pause all new<br />client connections until this value is set to `false` (default). Internally,<br />the operator calls PgBouncer's `PAUSE` and `RESUME` commands. | | false | |
1740+
| `image` _string_ | Image is the pgbouncer container image to use. When set, it takes<br />precedence over ImageCatalogRef and the operator default, but is<br />overridden by an explicit image set in the pod template. | | | |
1741+
| `imageCatalogRef` _[ImageCatalogComponentRef](#imagecatalogcomponentref)_ | ImageCatalogRef points to an entry in an ImageCatalog or ClusterImageCatalog.<br />Mutually exclusive with Image. | | | |
17001742

17011743

17021744
#### PluginConfiguration
@@ -1933,6 +1975,28 @@ _Appears in:_
19331975
| `enabled` _boolean_ | Enable TLS for the monitoring endpoint.<br />Changing this option will force a rollout of all instances. | | false | |
19341976

19351977

1978+
#### PoolerPhase
1979+
1980+
_Underlying type:_ _string_
1981+
1982+
PoolerPhase represents the lifecycle phase of a Pooler.
1983+
1984+
_Validation:_
1985+
1986+
- Enum: [active paused inactive failed]
1987+
1988+
_Appears in:_
1989+
1990+
- [PoolerStatus](#poolerstatus)
1991+
1992+
| Field | Description |
1993+
| --- | --- |
1994+
| `active` | PoolerPhaseActive means the pooler is running normally and serving traffic.<br /> |
1995+
| `paused` | PoolerPhasePaused means PgBouncer is up and running but holding new client<br />connections in the queue because spec.pgbouncer.paused is true. The Deployment<br />keeps reconciling; lifting the pause transitions back to Active.<br /> |
1996+
| `inactive` | PoolerPhaseInactive means the pooler cannot make progress because a<br />prerequisite resource is missing (cluster, secret, certificate). The<br />controller retries periodically until the prerequisite shows up. Check<br />status.phaseReason for the specific cause.<br /> |
1997+
| `failed` | PoolerPhaseFailed means the pooler cannot be reconciled due to a<br />configuration error. Check status.phaseReason for details.<br /> |
1998+
1999+
19362000
#### PoolerSecrets
19372001

19382002

@@ -1995,6 +2059,9 @@ _Appears in:_
19952059
| --- | --- | --- | --- | --- |
19962060
| `secrets` _[PoolerSecrets](#poolersecrets)_ | The resource version of the config object | | | |
19972061
| `instances` _integer_ | The number of pods trying to be scheduled | | | |
2062+
| `phase` _[PoolerPhase](#poolerphase)_ | Phase summarizes the overall lifecycle state of the Pooler. | | | Enum: [active paused inactive failed] <br /> |
2063+
| `phaseReason` _string_ | PhaseReason is a human-readable explanation of the current Phase. | | | |
2064+
| `image` _string_ | Image is the resolved pgbouncer container image that the operator is<br />using for this Pooler, including any override coming from spec.template.<br />While Phase is Active or Paused this field reflects what the Deployment<br />actually runs; while Phase is Inactive or Failed it may carry the last<br />successfully resolved value (or be empty if the Pooler has never reconciled<br />successfully). | | | |
19982065

19992066

20002067
#### PoolerType

website/docs/connection_pooling.md

Lines changed: 133 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,63 @@ spec:
283283
topologyKey: "kubernetes.io/hostname"
284284
```
285285

286-
#### Custom image and resource limits
286+
#### Resource limits
287287

288-
You can specify a custom image and define resource requests/limits. Note that
289-
the container name is explicitly set to `pgbouncer`.
288+
You can define resource requests and limits by adding a container named
289+
`pgbouncer` to the `template` section:
290+
291+
```yaml
292+
# ...
293+
template:
294+
metadata:
295+
# ...
296+
spec:
297+
containers:
298+
# This name MUST be "pgbouncer"
299+
- name: pgbouncer
300+
resources:
301+
requests:
302+
cpu: "0.1"
303+
memory: 100Mi
304+
limits:
305+
cpu: "0.5"
306+
memory: 500Mi
307+
```
308+
309+
## PgBouncer image
310+
311+
By default, CloudNativePG deploys the
312+
[latest stable PgBouncer image](https://ghcr.io/cloudnative-pg/pgbouncer)
313+
the operator was built against. You can override that default in three ways.
314+
When more than one is set, the sources are evaluated top-down — the first
315+
match in the list below is used; if none match, the operator's built-in
316+
default applies:
317+
318+
1. An explicit image set on the `pgbouncer` container inside
319+
`spec.template.spec.containers` (escape hatch — see
320+
[Pod-template override](#pod-template-override) below).
321+
2. `spec.pgbouncer.image` — an image reference set directly on the `Pooler`.
322+
3. `spec.pgbouncer.imageCatalogRef` — a reference to an entry in an
323+
`ImageCatalog` or `ClusterImageCatalog`.
324+
325+
`spec.pgbouncer.image` and `spec.pgbouncer.imageCatalogRef` are mutually
326+
exclusive — set at most one.
327+
328+
:::warning[Policy gating]
329+
If you enforce admission policies that restrict which PgBouncer images
330+
may run, those policies **must gate all three** image sources:
331+
`spec.pgbouncer.image`, `spec.pgbouncer.imageCatalogRef`, and the
332+
`image` field on a `pgbouncer` container inside
333+
`spec.template.spec.containers`. A policy that covers only the first
334+
two leaves the pod-template override as an unguarded escape hatch.
335+
The same consideration applies to `Cluster.spec.imageName` and
336+
`Cluster.spec.imageCatalogRef`.
337+
:::
338+
339+
### Setting an explicit image
340+
341+
Use `spec.pgbouncer.image` to pin a specific PgBouncer version or pull from
342+
a private registry:
290343

291344
```yaml
292345
apiVersion: postgresql.cnpg.io/v1
@@ -298,29 +351,92 @@ spec:
298351
name: cluster-example
299352
instances: 3
300353
type: rw
354+
pgbouncer:
355+
poolMode: session
356+
image: ghcr.io/cloudnative-pg/pgbouncer:1.25.1
357+
```
358+
359+
### Using an image catalog
360+
361+
The `Pooler` resource can manage the PgBouncer container image centrally via
362+
an `ImageCatalog` or `ClusterImageCatalog`, following the same pattern as
363+
`Cluster` resources (see [Image Catalog](image_catalog.md)). The catalog
364+
entry is selected by the `key` defined in the catalog's `componentImages`
365+
list.
301366

367+
Reference a catalog entry with `spec.pgbouncer.imageCatalogRef`:
368+
369+
```yaml
370+
apiVersion: postgresql.cnpg.io/v1
371+
kind: Pooler
372+
metadata:
373+
name: pooler-example-rw
374+
spec:
375+
cluster:
376+
name: cluster-example
377+
instances: 3
378+
type: rw
379+
pgbouncer:
380+
poolMode: session
381+
imageCatalogRef:
382+
apiGroup: postgresql.cnpg.io
383+
kind: ImageCatalog
384+
name: my-catalog
385+
key: pgbouncer
386+
```
387+
388+
To use a cluster-wide catalog instead, set `kind: ClusterImageCatalog` and
389+
point `name` at the corresponding resource — the rest of the spec is
390+
identical.
391+
392+
When a catalog entry is updated, the operator automatically reconciles all
393+
poolers referencing it and rolls out the new image without any change to the
394+
`Pooler` spec.
395+
396+
### Pod-template override
397+
398+
The pod template can also carry an `image` on the `pgbouncer` container, in
399+
which case it overrides every other source (including `spec.pgbouncer.image`
400+
and `spec.pgbouncer.imageCatalogRef`). Treat this as an **escape hatch** —
401+
use it only when you need to customize other container-level settings
402+
(resources, environment, security context) and happen to want to pin the
403+
image in the same place. For routine image changes, prefer
404+
`spec.pgbouncer.image` or an image catalog: those fields are validated,
405+
mutually exclusive, and visible to admission policies that gate the
406+
PgBouncer image (see [Pod templates](#pod-templates) for the broader
407+
template mechanics):
408+
409+
```yaml
410+
# ...
302411
template:
303-
metadata:
304-
labels:
305-
app: pooler
306412
spec:
307413
containers:
308-
# This name MUST be "pgbouncer"
309414
- name: pgbouncer
310415
image: my-pgbouncer:latest
311-
resources:
312-
requests:
313-
cpu: "0.1"
314-
memory: 100Mi
315-
limits:
316-
cpu: "0.5"
317-
memory: 500Mi
318416
```
319417

418+
### Monitoring the resolved image
419+
420+
The operator stores the resolved image in `status.image` and reflects the
421+
outcome in `status.phase`, one of `active`, `paused`, `inactive`, or
422+
`failed`. On `failed`, `status.phaseReason` describes the cause (for
423+
example, if the catalog or key does not exist). You can inspect the
424+
current state with:
425+
426+
```shell
427+
kubectl get pooler pooler-example-rw -o jsonpath='{.status.image}'
428+
```
429+
430+
:::note[API reference]
431+
For details, see [`PgBouncerSpec`](cloudnative-pg.v1.md#pgbouncerspec)
432+
in the API reference.
433+
:::
434+
320435
## Service Template
321436

322-
Sometimes, your pooler will require some different labels, annotations, or even change
323-
the type of the service, you can achieve that by using the `serviceTemplate` field:
437+
Sometimes, your pooler will require some different labels, annotations, or
438+
even a different Service type. You can achieve that by using the
439+
`serviceTemplate` field:
324440

325441
```yaml
326442
apiVersion: postgresql.cnpg.io/v1
@@ -740,7 +856,7 @@ following example:
740856
## Pausing connections
741857

742858
The `Pooler` specification allows you to take advantage of PgBouncer's `PAUSE`
743-
and `RESUME` commands, using only declarative configuration. You can ado this
859+
and `RESUME` commands, using only declarative configuration. You can do this
744860
using the `paused` option, which by default is set to `false`. When set to
745861
`true`, the operator internally invokes the `PAUSE` command in PgBouncer,
746862
which:

website/docs/image_catalog.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ Both resources share a common schema:
3434
- **Uniqueness**: The `major` field must be unique within a single catalog.
3535
- **Extensions**: Support for certified extension container images (available for
3636
PostgreSQL 18+ via `extension_control_path`).
37+
- **Component images**: An optional list of named images for non-PostgreSQL
38+
components such as PgBouncer (see
39+
[Component images](#component-images)).
3740

3841
:::warning
3942
While the operator trusts the user-defined `major` version without performing
@@ -44,6 +47,45 @@ must ensure the declared major version matches the actual PostgreSQL images to
4447
maintain compatibility.
4548
:::
4649

50+
## Component images
51+
52+
In addition to PostgreSQL images, a catalog can store images for other
53+
components via the `componentImages` field. Each entry is identified by a string
54+
**key** — a lowercase alphanumeric identifier (hyphens allowed, 1–63
55+
characters) that must be unique within the catalog.
56+
57+
Currently, the only consumer of component images is the `Pooler` resource,
58+
which can reference a component image entry to centrally manage the PgBouncer
59+
container image (see
60+
[Using an image catalog](connection_pooling.md#using-an-image-catalog)).
61+
62+
The following example defines a namespaced `ImageCatalog` with a PgBouncer
63+
component image:
64+
65+
```yaml
66+
apiVersion: postgresql.cnpg.io/v1
67+
kind: ImageCatalog
68+
metadata:
69+
name: my-catalog
70+
namespace: default
71+
spec:
72+
images:
73+
- major: 18
74+
image: ghcr.io/cloudnative-pg/postgresql:18.4-system-trixie
75+
componentImages:
76+
- key: pgbouncer
77+
image: ghcr.io/cloudnative-pg/pgbouncer:1.25.1
78+
```
79+
80+
For a cluster-wide catalog, use `kind: ClusterImageCatalog` and drop the
81+
`metadata.namespace` field (the `spec` is otherwise identical).
82+
83+
:::info
84+
A catalog may contain up to 32 component image entries. Keys are lowercase
85+
alphanumeric characters or hyphens, starting and ending with an alphanumeric
86+
character, up to 63 characters long.
87+
:::
88+
4789
## Configuration examples
4890

4991
### Defining a catalog

website/docs/operator_capability_levels.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ Beyond just the core PostgreSQL engine, image catalogs now allow you to define
8585
ensuring that the database and its associated modules are always compatible,
8686
version-aligned, and treated as a single cohesive unit across your entire
8787
infrastructure.
88+
The same catalog mechanism also governs [PgBouncer](connection_pooling.md)
89+
pooler images, making image catalogs a unified supply-chain primitive across
90+
the entire PostgreSQL stack managed by the operator.
8891

8992
### Labels and annotations
9093

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apiVersion: postgresql.cnpg.io/v1
2+
kind: ClusterImageCatalog
3+
metadata:
4+
name: cluster-image-catalog-example
5+
spec:
6+
images:
7+
- image: ghcr.io/cloudnative-pg/postgresql:18.4-system-trixie
8+
major: 18
9+
componentImages:
10+
- key: pgbouncer
11+
image: ghcr.io/cloudnative-pg/pgbouncer:1.25.1
12+
---
13+
apiVersion: postgresql.cnpg.io/v1
14+
kind: Cluster
15+
metadata:
16+
name: cluster-example
17+
spec:
18+
instances: 1
19+
imageCatalogRef:
20+
apiGroup: postgresql.cnpg.io
21+
kind: ClusterImageCatalog
22+
name: cluster-image-catalog-example
23+
major: 18
24+
storage:
25+
size: 1Gi
26+
---
27+
apiVersion: postgresql.cnpg.io/v1
28+
kind: Pooler
29+
metadata:
30+
name: pooler-example-rw
31+
spec:
32+
cluster:
33+
name: cluster-example
34+
instances: 1
35+
type: rw
36+
pgbouncer:
37+
poolMode: session
38+
imageCatalogRef:
39+
apiGroup: postgresql.cnpg.io
40+
kind: ClusterImageCatalog
41+
name: cluster-image-catalog-example
42+
key: pgbouncer

0 commit comments

Comments
 (0)