Skip to content

Commit

Permalink
Merge pull request #5540 from EnterpriseDB/automatic_docs_update/repo…
Browse files Browse the repository at this point in the history
…_EnterpriseDB/cloud-native-postgres/ref_refs/tags/v1.23.0
  • Loading branch information
josh-heyer authored Apr 25, 2024
2 parents 4c771f1 + 878c147 commit 5945f21
Show file tree
Hide file tree
Showing 38 changed files with 1,140 additions and 774 deletions.
16 changes: 16 additions & 0 deletions product_docs/docs/postgres_for_kubernetes/1/addons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ to be defined as a YAML object having the following keys:

- `electedResourcesDecorators`
- `excludedResourcesDecorators`
- `excludedResourcesSelector`
- `backupInstanceDecorators`
- `preBackupHookConfiguration`
- `postBackupHookConfiguration`
Expand Down Expand Up @@ -107,6 +108,12 @@ will be placed on every excluded pod and PVC.
Each element of the array must have the same fields as the
`electedResourcesDecorators` section above.

#### The `excludedResourcesSelector` section

This section selects Pods and PVCs that are applied to the
`excludedResourcesDecorators`. It accepts a [label selector rule](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors)
as value. When empty, all the Pods and every PVC that is not elected will be excluded.

#### The `backupInstanceDecorators` section

This section allows you to configure an array of labels and/or annotations that
Expand Down Expand Up @@ -188,6 +195,7 @@ data:
- key: "app.example.com/elected"
metadataType: "label"
value: "true"
excludedResourcesSelector: app=xyz,env=prod
excludedResourcesDecorators:
- key: "app.example.com/excluded"
metadataType: "label"
Expand Down Expand Up @@ -239,6 +247,7 @@ metadata:
- key: "app.example.com/elected"
metadataType: "label"
value: "true"
excludedResourcesSelector: app=xyz,env=prod
excludedResourcesDecorators:
- key: "app.example.com/excluded"
metadataType: "label"
Expand Down Expand Up @@ -342,6 +351,13 @@ excludedResourcesDecorators:
metadataType: "annotation"
value: "Not necessary for backup"
# A LabelSelector containing the labels being used to filter Pods
# and PVCs to decorate with excludedResourcesDecorators.
# It accepts a label selector rule as value.
# See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
# When empty, all the Pods and every PVC that is not elected will be excluded.
excludedResourcesSelector: app=xyz,env=prod
# An array of labels and/or annotations that will be placed
# on the instance pod that's been selected for the backup by
# the operator and which contains the hooks.
Expand Down
10 changes: 5 additions & 5 deletions product_docs/docs/postgres_for_kubernetes/1/bootstrap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ file on the source PostgreSQL instance:
host replication streaming_replica all md5
```

The following manifest creates a new PostgreSQL 16.1 cluster,
The following manifest creates a new PostgreSQL 16.2 cluster,
called `target-db`, using the `pg_basebackup` bootstrap method
to clone an external PostgreSQL cluster defined as `source-db`
(in the `externalClusters` array). As you can see, the `source-db`
Expand All @@ -545,7 +545,7 @@ metadata:
name: target-db
spec:
instances: 3
imageName: quay.io/enterprisedb/postgresql:16.1
imageName: quay.io/enterprisedb/postgresql:16.2
bootstrap:
pg_basebackup:
Expand All @@ -565,7 +565,7 @@ spec:
```

All the requirements must be met for the clone operation to work, including
the same PostgreSQL version (in our case 16.1).
the same PostgreSQL version (in our case 16.2).

#### TLS certificate authentication

Expand All @@ -580,7 +580,7 @@ in the same Kubernetes cluster.
This example can be easily adapted to cover an instance that resides
outside the Kubernetes cluster.

The manifest defines a new PostgreSQL 16.1 cluster called `cluster-clone-tls`,
The manifest defines a new PostgreSQL 16.2 cluster called `cluster-clone-tls`,
which is bootstrapped using the `pg_basebackup` method from the `cluster-example`
external cluster. The host is identified by the read/write service
in the same cluster, while the `streaming_replica` user is authenticated
Expand All @@ -595,7 +595,7 @@ metadata:
name: cluster-clone-tls
spec:
instances: 3
imageName: quay.io/enterprisedb/postgresql:16.1
imageName: quay.io/enterprisedb/postgresql:16.2
bootstrap:
pg_basebackup:
Expand Down
28 changes: 28 additions & 0 deletions product_docs/docs/postgres_for_kubernetes/1/connection_pooling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,34 @@ spec:
memory: 500Mi
```
## Service Template
Sometimes, your pooler will require some different labels, annotations, or even change
the type of the service, you can achieve that by using the `serviceTemplate` field:

```yaml
apiVersion: postgresql.k8s.enterprisedb.io/v1
kind: Pooler
metadata:
name: pooler-example-rw
spec:
cluster:
name: cluster-example
instances: 3
type: rw
serviceTemplate:
metadata:
labels:
app: pooler
spec:
type: LoadBalancer
pgbouncer:
poolMode: session
parameters:
max_client_conn: "1000"
default_pool_size: "10"
```

## High availability (HA)

Because of Kubernetes' deployments, you can configure your pooler to run on a
Expand Down
31 changes: 19 additions & 12 deletions product_docs/docs/postgres_for_kubernetes/1/container_images.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,31 @@ for EDB Postgres for Kubernetes, and publishes them on

## Image tag requirements

While the image name can be anything valid for Docker, the EDB Postgres for Kubernetes
operator relies on the *image tag* to detect the Postgres major
version contained in the image.
To ensure the operator makes informed decisions, it must accurately detect the
PostgreSQL major version. This detection can occur in two ways:

The image tag must start with a valid PostgreSQL major version number (e.g.
14.5 or 15) optionally followed by a dot and the patch level.
1. Utilizing the `major` field of the `imageCatalogRef`, if defined.
2. Auto-detecting the major version from the image tag of the `imageName` if
not explicitly specified.

This can be followed by any character combination that is valid and
For auto-detection to work, the image tag must adhere to a specific format. It
should commence with a valid PostgreSQL major version number (e.g., 15.6 or
16), optionally followed by a dot and the patch level.

Following this, the tag can include any character combination valid and
accepted in a Docker tag, preceded by a dot, an underscore, or a minus sign.

Examples of accepted image tags:

- `11.1`
- `12.3.2.1-1`
- `12.4`
- `13`
- `14.5-10`
- `15.0`
- `12.1`
- `13.3.2.1-1`
- `13.4`
- `14`
- `15.5-10`
- `16.0`

!!! Warning
`latest` is not considered a valid tag for the image.

!!! Note
Image tag requirements do no apply for images defined in a catalog.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ $ kubectl cnp status <cluster-name>
Cluster Summary
Name: cluster-example
Namespace: default
PostgreSQL Image: quay.io/enterprisedb/postgresql:16.1
PostgreSQL Image: quay.io/enterprisedb/postgresql:16.2
Primary instance: cluster-example-2
Status: Cluster in healthy state
Instances: 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ data:
description: "Time at which these statistics were last reset"
pg_stat_bgwriter:
runonserver: "<17.0.0"
query: |
SELECT checkpoints_timed
, checkpoints_req
Expand Down
110 changes: 110 additions & 0 deletions product_docs/docs/postgres_for_kubernetes/1/image_catalog.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
title: 'Image Catalog'
originalFilePath: 'src/image_catalog.md'
---

`ImageCatalog` and `ClusterImageCatalog` are essential resources that empower
you to define images for creating a `Cluster`.

The key distinction lies in their scope: an `ImageCatalog` is namespaced, while
a `ClusterImageCatalog` is cluster-scoped.

Both share a common structure, comprising a list of images, each equipped with
a `major` field indicating the major version of the image.

!!! Warning
The operator places trust in the user-defined major version and refrains
from conducting any PostgreSQL version detection. It is the user's
responsibility to ensure alignment between the declared major version in
the catalog and the PostgreSQL image.

The `major` field's value must remain unique within a catalog, preventing
duplication across images. Distinct catalogs, however, may
expose different images under the same `major` value.

**Example of a Namespaced `ImageCatalog`:**

```yaml
apiVersion: postgresql.k8s.enterprisedb.io/v1
kind: ImageCatalog
metadata:
name: postgresql
namespace: default
spec:
images:
- major: 15
image: quay.io/enterprisedb/postgresql:15.6
- major: 16
image: quay.io/enterprisedb/postgresql:16.2
```
**Example of a Cluster-Wide Catalog using `ClusterImageCatalog` Resource:**

```yaml
apiVersion: postgresql.k8s.enterprisedb.io/v1
kind: ClusterImageCatalog
metadata:
name: postgresql
spec:
images:
- major: 15
image: quay.io/enterprisedb/postgresql:15.6
- major: 16
image: quay.io/enterprisedb/postgresql:16.2
```

A `Cluster` resource has the flexibility to reference either an `ImageCatalog`
or a `ClusterImageCatalog` to precisely specify the desired image.

```yaml
apiVersion: postgresql.k8s.enterprisedb.io/v1
kind: Cluster
metadata:
name: cluster-example
spec:
instances: 3
imageCatalogRef:
apiGroup: postgresql.k8s.enterprisedb.io
kind: ImageCatalog
name: postgresql
major: 16
storage:
size: 1Gi
```

Clusters utilizing these catalogs maintain continuous monitoring.
Any alterations to the images within a catalog trigger automatic updates for
**all associated clusters** referencing that specific entry.

## EDB Postgres for Kubernetes Catalogs

The EDB Postgres for Kubernetes project maintains `ClusterImageCatalogs` for the images it
provides. These catalogs are regularly updated with the latest images for each
major version. By applying the `ClusterImageCatalog.yaml` file from the
EDB Postgres for Kubernetes project's GitHub repositories, cluster administrators can ensure
that their clusters are automatically updated to the latest version within the
specified major release.

### PostgreSQL Container Images

You can install the
[latest version of the cluster catalog for the PostgreSQL Container Images](https://raw.githubusercontent.com/cloudnative-pg/postgres-containers/main/Debian/ClusterImageCatalog.yaml)
([cloudnative-pg/postgres-containers](https://github.com/enterprisedb/docker-postgres) repository)
with:

```shell
kubectl apply \
-f https://raw.githubusercontent.com/cloudnative-pg/postgres-containers/main/Debian/ClusterImageCatalog.yaml
```

### PostGIS Container Images

You can install the
[latest version of the cluster catalog for the PostGIS Container Images](https://raw.githubusercontent.com/cloudnative-pg/postgis-containers/main/PostGIS/ClusterImageCatalog.yaml)
([cloudnative-pg/postgis-containers](https://github.com/cloudnative-pg/postgis-containers) repository)
with:

```shell
kubectl apply \
-f https://raw.githubusercontent.com/cloudnative-pg/postgis-containers/main/PostGIS/ClusterImageCatalog.yaml
```
1 change: 0 additions & 1 deletion product_docs/docs/postgres_for_kubernetes/1/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ navigation:
- architecture
- installation_upgrade
- quickstart
- interactive_demo
- '#Configuration'
- postgresql_conf
- operator_conf
Expand Down
Loading

1 comment on commit 5945f21

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.