Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ jobs:
runs-on: ubuntu-22.04
outputs:
pg4k-pgd-changed: ${{ steps.filter.outputs.pg4k-pgd-changed }}
cnpg-gc-changed: ${{ steps.filter.outputs.cnpg-gc-changed }}
ep4k-changed: ${{ steps.filter.outputs.ep4k-changed }}
ep4k-lts-changed: ${{ steps.filter.outputs.ep4k-lts-changed }}
cnpg-gc-lts-changed: ${{ steps.filter.outputs.cnpg-gc-lts-changed }}
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
Expand All @@ -25,10 +27,14 @@ jobs:
filters: |
pg4k-pgd-changed:
- 'charts/edb-postgres-distributed-for-kubernetes/**'
cnpg-gc-changed:
- 'charts/edb-cloudnativepg-global-cluster/**'
ep4k-changed:
- 'charts/edb-postgres-for-kubernetes/**'
ep4k-lts-changed:
- 'charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/**'
cnpg-gc-lts-changed:
- 'charts/edb-cloudnativepg-global-cluster/charts/edb-postgres-for-kubernetes-lts/**'

deploy-ep4k:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -120,6 +126,68 @@ jobs:
kubectl wait --timeout=8m --for=jsonpath='{.status.phase}'="$PHASE" pgdgroups/region-b
kubectl wait --timeout=8m --for=jsonpath='{.status.phase}'="$PHASE" pgdgroups/region-c

deploy-cnpg-gc:
runs-on: ubuntu-22.04
needs:
- change-triage
if: needs.change-triage.outputs.cnpg-gc-changed == 'true'
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0

- name: Setup kind
uses: ./.github/actions/setup-kind

- name: Deploy using helm chart
run: |
helm dependency build charts/edb-cloudnativepg-global-cluster/charts/edb-postgres-for-kubernetes-lts
helm dependency build charts/edb-cloudnativepg-global-cluster
helm upgrade --install edb-cnpg-gc --namespace pgd-operator-system \
--create-namespace charts/edb-cloudnativepg-global-cluster \
--set image.imageCredentials.password=${{ secrets.CS_PASSWORD }} \
--wait --timeout 10m

- name: Deploy a cluster
run: |
kubectl apply -f hack/samples/issuer-selfsigned.yaml
kubectl apply -f hack/samples/pg4k-pgd-cluster.yaml

PHASE="PGDGroup - Healthy"
kubectl wait --timeout=8m --for=jsonpath='{.status.phase}'="$PHASE" pgdgroups/region-a
kubectl wait --timeout=8m --for=jsonpath='{.status.phase}'="$PHASE" pgdgroups/region-b
kubectl wait --timeout=8m --for=jsonpath='{.status.phase}'="$PHASE" pgdgroups/region-c

deploy-cnpg-gc-subcharts:
runs-on: ubuntu-22.04
needs:
- change-triage
if: needs.change-triage.outputs.cnpg-gc-lts-changed == 'true'
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0

- name: Setup kind
uses: ./.github/actions/setup-kind

- name: Deploy using helm chart
run: |
helm upgrade --install edb-pg4k-lts --namespace postgresql-operator-system \
--create-namespace charts/edb-cloudnativepg-global-cluster/charts/edb-postgres-for-kubernetes-lts \
--set image.imageCredentials.create=true \
--set image.imageCredentials.password=${{ secrets.CS_PASSWORD }} \
--wait --timeout 10m

- name: Deploy a cluster
run: |
kubectl apply -f hack/samples/ep4k-cluster.yaml

PHASE="Cluster in healthy state"
kubectl wait --timeout=5m --for=jsonpath='{.status.phase}'="$PHASE" clusters/cluster-example

deploy-ep4k-single-namespace:
runs-on: ubuntu-22.04
needs:
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ endif
helm schema-gen charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/values.yaml \
> charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/values.schema.json
helm schema-gen charts/edb-postgres-distributed-for-kubernetes/values.yaml > charts/edb-postgres-distributed-for-kubernetes/values.schema.json
helm schema-gen charts/edb-cloudnativepg-global-cluster/charts/edb-postgres-for-kubernetes-lts/values.yaml \
> charts/edb-cloudnativepg-global-cluster/charts/edb-postgres-for-kubernetes-lts/values.schema.json
helm schema-gen charts/edb-cloudnativepg-global-cluster/values.yaml \
> charts/edb-cloudnativepg-global-cluster/values.schema.json
183 changes: 136 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,22 @@ Helm charts to install the following Operators:
supported Kubernetes cluster running in private, public, or hybrid cloud
environments. Derived from CloudNativePG's Helm chart.

- [EDB Postgres Distributed for Kubernetes (PG4K-PGD)](https://docs.enterprisedb.io/edb-postgres-distributed-for-kubernetes/),
- [EDB Postgres Distributed for Kubernetes (PG4K-PGD) version 1.x](https://www.enterprisedb.com/docs/postgres_distributed_for_kubernetes/latest/),
designed by EnterpriseDB to manage EDB Postgres Distributed v5 workloads
on Kubernetes, with traffic routed by PGD Proxy.

- [EDB CloudNativePG Global Cluster (PG4K-PGD version 2.x)](https://www.enterprisedb.com/docs/postgres_distributed_for_kubernetes/latest/),
designed by EnterpriseDB to manage EDB Postgres Distributed v6 workloads
on Kubernete

## Available Charts

| Chart | Operator | Operand | Description |
|-------|----------|---------|-------------|
| `edb-postgres-for-kubernetes` | PG4K | EDB Postgres | Single-cluster PostgreSQL |
| `edb-postgres-distributed-for-kubernetes` | PG4K-PGD 1.x | PGD 5 + PGD Proxy | Multi-region distributed PostgreSQL |
| `edb-cloudnativepg-global-cluster` | PG4K-PGD 2.x | PGD 6 | Multi-region distributed PostgreSQL |

## Usage

Before deploying the charts, add the following repository by running:
Expand Down Expand Up @@ -75,22 +87,92 @@ managing the resources in the namespace watched by the single-namespace
operator.
It is up to the user to ensure there is no collision between operators.

## Deployment of the EDB Postgres Distributed for Kubernetes operator (PG4K-PGD)
## Deployment of the EDB CloudNativePG Global Cluster operator (PG4K-PGD 2.x)

The `edb-cloudnativepg-global-cluster` chart deploys the PG4K-PGD 2.x operator
for managing EDB Postgres Distributed v6 workloads.

Similar to the PG4K helm chart installation, both the operator and the operand images
required by PG4K-PGD are pulled from the `docker.enterprisedb.com/k8s` repository,
are pulled from the `docker.enterprisedb.com/k8s` repository,
access to these images requires an active EDB subscription. See: [obtaining an EDB subscription token](https://www.enterprisedb.com/docs/postgres_distributed_for_kubernetes/latest/installation_upgrade/#obtaining-an-edb-subscription-token)

The PG4K-PGD chart installs both the PG4K-PGD and PG4K operators in the
The chart installs both the PG4K-PGD and PG4K operators in the
same namespace. The PG4K operator installed is a stable version that is
part of the latest long-term support release of PG4K.

The PG4K-PGD chart also install the cert-manager operator as a dependency.
The chart also installs the cert-manager operator as a dependency.
You can avoid this if necessary. See the sub-section
[on deploying individually](#deploying-the-PG4K-PGD-operators-individually).
[on deploying individually](#deploying-the-operators-and-cert-manager-individually).

For example, to deploy the operator:

```console
helm upgrade --dependency-update \
--install edb-pg4k-pgd \
--namespace pgd-operator-system \
--create-namespace \
--set image.imageCredentials.password=<THE-TOKEN> \
edb/edb-cloudnativepg-global-cluster
```

Once the above runs, a new namespace `pgd-operator-system` will be
created, with several deployments, including the two operators.

```sh
$ kubectl get deployments -n pgd-operator-system
NAME READY UP-TO-DATE AVAILABLE AGE
edb-pg4k-pgd-cert-manager 1/1 1 1 7m46s
edb-pg4k-pgd-cert-manager-cainjector 1/1 1 1 7m46s
edb-pg4k-pgd-cert-manager-webhook 1/1 1 1 7m46s
edb-pg4k-pgd-cloudnativepg-global-cluster 1/1 1 1 7m46s
edb-pg4k-pgd-postgres-for-kubernetes-lts 1/1 1 1 7m46s
```

When the deployments are ready, you can verify that the steps suggested by the
helm chart are working:

- set up a cert-manager issuer
- deploy an example 3-region PGD cluster

### Customizing the PGD image

By default, the Helm chart-installed operator adds a default PGD image
name to the configuration file. PGD groups created without `spec.imageName`
will use that default. You can customize the default
by setting it in the Helm values.

- `pgdImageName`: the default PGD image name to be used by the operator.

This example changes the default PGD image:

```console
helm upgrade --dependency-update \
--install edb-pg4k-pgd \
--namespace pgd-operator-system \
--create-namespace \
--set image.imageCredentials.password=<THE-TOKEN> \
--set global.pgdImageName=postgresql-pgd:18.1-pgd620-expanded-ubi9 \
edb/edb-cloudnativepg-global-cluster
```

**Note:** You can find the latest released image catalogs for operand from
[PGD Operand images](https://www.enterprisedb.com/docs/postgres_distributed_for_kubernetes/latest/supported_versions/#pgd-operand-images)

## Deployment of the EDB Postgres Distributed for Kubernetes operator (PG4K-PGD 1.x)

The PG4K-PGD operator helm chart 1.x and 2.x are designed to manage different versions of PGD,
and they can't be installed together in the same cluster. The main difference between the two charts are:

- PG4K-PGD 1.x chart supports PGD Proxy image, which PG4K-PGD 2.x chart does not support.
- Chart name difference
- 1.x: `edb-postgres-distributed-for-kubernetes`
- 2.x: `edb-cloudnativepg-global-cluster`
- The nested PG4K subchart version difference.

So the installation of the PG4K-PGD 1.x is similar to the PG4K-PGD 2.x, but with a different chart name and image names.

For example, to deploy the PG4K-PGD 1.x operator chart:

```console
helm upgrade --dependency-update \
--install edb-pg4k-pgd \
Expand All @@ -113,17 +195,29 @@ edb-pg4k-pgd-edb-postgres-distributed-for-kubernetes 1/1 1 1
edb-pg4k-pgd-edb-postgres-for-kubernetes-lts 1/1 1 1 7m46s
```

When the deployments are ready, you can verify that the steps suggested by the
helm chart are working:
We can also customize default PGD and PGD proxy image names by setting the following values in the Helm chart.
PGD groups created without `spec.imageName` and `spec.pgdProxy.imageName` will use those defaults.

- set up a cert-manager issuer
- deploy an example 3-region PGD cluster
- `pgdImageName`: the default PGD image name to be used by the operator.
- `proxyImageName`: the default PGD proxy image name to be used by the operator.

### Deploying the PG4K-PGD operators and cert-manager individually
This example changes the default PGD and PGD proxy image:

The chart `edb-postgres-distributed-for-kubernetes` is set by default to
also install the cert-manager operator, which it depends on.
When following this route, all operators will be installed in the same
```console
helm upgrade --dependency-update \
--install edb-pg4k-pgd \
--namespace pgd-operator-system \
--create-namespace \
--set image.imageCredentials.password=<THE-TOKEN> \
--set global.pgdImageName=edb-postgres-advanced-pgd:17.6-pgd590-ubi9 \
--set global.proxyImageName=edb-pgd-proxy:5.9.0-ubi9 \
edb/edb-postgres-distributed-for-kubernetes
```

### Deploying the operators and cert-manager individually

The PG4K-PGD charts are set by default to also install the cert-manager operator,
which they depend on. When following this route, all operators will be installed in the same
namespace. This is in contrast with other installation paths, where we
may want the two operators reside in dedicated namespaces.

Expand All @@ -139,7 +233,7 @@ follow the steps below.
EDB Postgres Distributed for Kubernetes requires Cert Manager 1.10 or higher.

**Note:** In case a supported version of the cert-manager operator is already deployed
in your K8S setup, you can skip this section and go directly to the setup of [PG4K-PGD](#setup-pg4k-pgd).
in your K8S setup, you can skip this section and go directly to the operator setup.

To deploy cert-manager in its own namespace

Expand All @@ -157,11 +251,25 @@ In case you choose this option, remember to also specify
`--set cert-manager.enabled=false` during the installation of the PG4K-PGD
helm chart in the next section.

#### 2. Setup PG4K-PGD
#### 2. Setup the PG4K-PGD operator

Once the above deployments are ready, you can deploy the PG4K-PGD
helm chart taking care to set `cert-manager.enabled`
to false if cert-manager is installed separately.
helm chart taking care to set `cert-manager.enabled` to false if cert-manager is
installed separately.


For example, deploy chart `edb-cloudnativepg-global-cluster` for PG4K-PGD 2.x operator:

```console
helm upgrade --dependency-update \
--install edb-pg4k-pgd \
--namespace pgd-operator-system \
--create-namespace \
--set image.imageCredentials.password=<THE-TOKEN> \
--set cert-manager.enabled=false \
edb/edb-cloudnativepg-global-cluster
```
or deploy chart `edb-postgres-distributed-for-kubernetes` for PG4K-PGD 1.x operator:

```console
helm upgrade --dependency-update \
Expand Down Expand Up @@ -198,7 +306,7 @@ helm upgrade --reuse-values \
edb/edb-postgres-for-kubernetes
```

For **EDB Postgres Distributed for Kubernetes (PG4K-PGD)** releases:
For **EDB Postgres Distributed for Kubernetes (PG4K-PGD 1.x)** releases:
```console
helm upgrade --reuse-values \
--set global.repository=docker.enterprisedb.com/k8s \
Expand All @@ -209,33 +317,6 @@ helm upgrade --reuse-values \

For more details, see the [official migration guide](https://www.enterprisedb.com/docs/postgres_for_kubernetes/latest/migrating_edb_registries/).

### Customized the PGD image

By default, the Helm chart-installed operator adds default PGD and PGD proxy image
names to the configuration file. PGD groups created without `spec.imageName` and
`spec.pgdProxy.imageName` will use those defaults. You can customize the defaults
by setting them in the Helm values.

- `pgdImageName`: the default PGD image name to be used by the operator.
- `proxyImageName`: the default PGD proxy image name to be used by the operator.

This example changed the default PGD and PGD proxy image:

```console
helm upgrade --dependency-update \
--install edb-pg4k-pgd \
--namespace pgd-operator-system \
--create-namespace \
--set image.imageCredentials.password=<THE-TOKEN> \
--set global.pgdImageName=edb-postgres-advanced-pgd:17.6-pgd590-ubi9 \
--set global.proxyImageName=edb-pgd-proxy:5.9.0-ubi9 \
edb/edb-postgres-distributed-for-kubernetes
```

**Note:** You can find more latest released image catalogs for operand from
[PGD Operand images](https://www.enterprisedb.com/docs/postgres_distributed_for_kubernetes/latest/supported_versions/#pgd-operand-images)


## Deployment using local chart

### Deployment PG4K using local chart
Expand All @@ -253,7 +334,15 @@ helm upgrade --install edb-pg4k \
### Deployment PG4K-PGD using local chart

Navigate to the charts directory of local chart or source code,
To deploy PG4K-PGD with all dependencies together

```console
helm upgrade --install edb-ecgc \
--namespace pgd-operator-system \
--create-namespace \
--set image.imageCredentials.password=<THE-TOKEN> \
charts/edb-cloudnativepg-global-cluster
```
or

```console
helm upgrade --install edb-pg4k-pgd \
Expand Down
Loading
Loading