Skip to content

Commit

Permalink
feat: use pg4k subchart in pg4k-pgd
Browse files Browse the repository at this point in the history
Signed-off-by: Tao Li <[email protected]>
  • Loading branch information
litaocdl committed Nov 14, 2024
1 parent 2f2f85b commit 730e70a
Show file tree
Hide file tree
Showing 21 changed files with 16,446 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
*~

# Charts Dependency files
/charts/*/charts/
/charts/*/charts/*.tgz
/charts/*/Chart.lock
59 changes: 49 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ operator and operand images. Make sure to replace USERNAME and PASSWORD with
your own credentials in the command below, which uses the `k8s_enterprise_pgd`
image registry by default:

**Note:** As of release v1.0.3, the `edb-postgres-distributed-for-kubernetes` chart
will now depend on PG4K LTS release helm chart, `edb-postgres-for-kubernetes-lts`,
which is a subchart of `edb-postgres-distributed-for-kubernetes`. The PG4K LTS
release helm chart includes only the LTS release of PG4K, the document is updated
accordingly.

```console
helm upgrade --dependency-update \
--install edb-pg4k-pgd \
Expand All @@ -138,7 +144,7 @@ edb-pg4k-pgd-cert-manager 1/1 1 1
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-edb-postgres-distributed-for-kubernetes 1/1 1 1 7m46s
edb-pg4k-pgd-edb-postgres-for-kubernetes 1/1 1 1 7m46s
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
Expand All @@ -162,9 +168,15 @@ invocations of `helm`.
If you would like to install the operators in separate namespaces, please follow
the below steps.

#### Setup PG4K
#### Setup PG4K with LTS release

First, deploy the [PG4K helm chart](#deployment-of-the-edb-postgres-for-kubernetes-operator-pg4k).
EDB Postgres Distributed for Kubernetes requires PG4K operator, with the LTS release
of PG4K operator is recommended. As of release v1.0.3, the helm chart
`edb-postgres-for-kubernetes-lts` has been created as a subchart of
`edb-postgres-distributed-for-kubernetes`. The subchart can be installed seperately.
To deploy the subchart `edb-postgres-for-kubernetes-lts`, you can follow the
[PG4K helm chart](#deployment-of-the-edb-postgres-for-kubernetes-operator-pg4k) with
the chart name modified accordingly.

#### Setup cert-manager

Expand Down Expand Up @@ -213,9 +225,8 @@ helm upgrade --dependency-update \
--namespace pgd-operator-system \
--create-namespace \
edb/edb-postgres-distributed-for-kubernetes \
--set edb-postgres-for-kubernetes.enabled=false \
--set edb-postgres-for-kubernetes-lts.enabled=false \
--set image.repository=docker.enterprisedb.com/k8s_standard_pgd/pg4k-pgd \
--set edb-postgres-for-kubernetes.image.repository=docker.enterprisedb.com/k8s_standard_pgd/edb-postgres-for-kubernetes \
--set config.data.PGD_IMAGE_NAME=docker.enterprisedb.com/k8s_standard_pgd/postgresql-pgd:15.6-5.4.0-1 \
--set config.data.PGD_PROXY_IMAGE_NAME=docker.enterprisedb.com/k8s_standard_pgd/edb-pgd-proxy:5.4.0
```
Expand Down Expand Up @@ -249,8 +260,12 @@ The following example uses the `k8s_standard_pgd` registry in
`docker.enterprisedb.com`.
Note the multiple `--set` options, for the `image.repository`,
`PGD_IMAGE_NAME` and `PGD_PROXY_IMAGE_NAME` in addition to the
`edb-postgres-for-kubernetes.image.repository` where the PGD operator
is pulled from. 4 in total.
`edb-postgres-for-kubernetes-lts.image.repository` where the PGD operator
is pulled from. There are 4 in total
- `image.repository` where the PG4K-PGD operator image is pulled from.
- `edb-postgres-for-kubernetes-lts.image.repository` where the PG4K operator image is pulled from.
- `PGD_IMAGE_NAME` and `PGD_PROXY_IMAGE_NAME` where the PGD and PGD Proxy image are pulled from.

Assuming that you have your necessary credentials, please fill in the USERNAME
and PASSWORD below.

Expand All @@ -263,13 +278,15 @@ helm upgrade --dependency-update \
--set image.imageCredentials.username=${USERNAME} \
--set image.imageCredentials.password=${PASSWORD} \
--set image.repository=docker.enterprisedb.com/k8s_standard_pgd/pg4k-pgd \
--set edb-postgres-for-kubernetes.image.repository=docker.enterprisedb.com/k8s_standard_pgd/edb-postgres-for-kubernetes \
--set config.data.PGD_IMAGE_NAME=docker.enterprisedb.com/k8s_standard_pgd/postgresql-pgd:15.6-5.4.0-1 \
--set config.data.PGD_PROXY_IMAGE_NAME=docker.enterprisedb.com/k8s_standard_pgd/edb-pgd-proxy:5.4.0
--set edb-postgres-for-kubernetes-lts.image.repository=docker.enterprisedb.com/k8s_standard_pgd/edb-postgres-for-kubernetes \
--set config.data.PGD_IMAGE_NAME=docker.enterprisedb.com/k8s_standard_pgd/postgresql-pgd:15.6-5.5.1-1 \
--set config.data.PGD_PROXY_IMAGE_NAME=docker.enterprisedb.com/k8s_standard_pgd/edb-pgd-proxy:5.5.0
```

## Deployment using local chart

### Deployment PG4K using local chart

To deploy an operator from source, first clone the current repository
locally and then run the following command: (Example for EDB-PG4K)

Expand All @@ -280,6 +297,28 @@ helm upgrade --install edb-pg4k \
charts/edb-postgres-for-kubernetes
```


### Deployment PG4K-PGD using local chart

To deploy PG4K-PGD alone with PG4K LTS subchart together, use the following. To skip PG4K install
`--set edb-postgres-for-kubernetes-lts.enabled=false`

```console
helm upgrade --install edb-pg4k-pgd \
--namespace pgd-operator-system \
--create-namespace \
charts/edb-postgres-distributed-for-kubernetes
```

or you can deploy the PG4K LTS subchart separately in a different namespace.

```console
helm upgrade --install edb-pg4k-lts \
--namespace postgresql-operator-system \
--create-namespace \
charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts
```

Note that the image locations and the credentials are elided. Please refer to
the sections above for directions.

Expand Down
10 changes: 5 additions & 5 deletions charts/edb-postgres-distributed-for-kubernetes/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ name: edb-postgres-distributed-for-kubernetes
description: EDB Postgres Distributed for Kubernetes Helm Chart
icon: https://www.enterprisedb.com/themes/custom/edb_bootstrap_sass/edb-logo-disc-dark-2.svg
type: application
version: "1.0.1"
version: "1.0.2"
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand All @@ -29,10 +29,10 @@ dependencies:
condition: cert-manager.enabled
version: "1.16.1"
repository: "https://charts.jetstack.io"
- name: "edb-postgres-for-kubernetes"
condition: edb-postgres-for-kubernetes.enabled
version: "0.20.3"
repository: "https://enterprisedb.github.io/edb-postgres-for-kubernetes-charts/"
- name: "edb-postgres-for-kubernetes-lts"
condition: edb-postgres-for-kubernetes-lts.enabled
version: "0.22.1"
repository: file://charts/edb-postgres-for-kubernetes-lts

sources:
- https://github.com/EnterpriseDB/edb-postgres-for-kubernetes-charts
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2021 EnterpriseDB Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
apiVersion: v2
name: edb-postgres-for-kubernetes-lts
description: EDB Postgres for Kubernetes lts release Helm Chart
icon: https://www.enterprisedb.com/themes/custom/edb_bootstrap_sass/edb-logo-disc-dark-2.svg
type: application
version: "0.22.1"
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.22.7"
sources:
- https://github.com/EnterpriseDB/edb-postgres-for-kubernetes-charts/tree/main/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts
keywords:
- postgresql
- postgres
- database
- edb
- enterprisedb
home: https://www.enterprisedb.com/products/postgresql-on-kubernetes-ha-clusters-k8s-containers-scalable
maintainers:
- name: gbartolini
email: [email protected]
- name: jsilvela
email: [email protected]
- name: litaocdl
email: [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

EDB Postgres for Kubernetes Operator should be installed in namespace "{{ .Release.Namespace }}".
You can now create a PostgreSQL cluster with 3 nodes as follows:

cat <<EOF | kubectl apply -f -
# Example of PostgreSQL cluster
apiVersion: postgresql.k8s.enterprisedb.io/v1
kind: Cluster
metadata:
name: cluster-example
{{if not .Values.config.clusterWide -}}
namespace: {{ .Release.Namespace }}
{{- end }}
spec:
instances: 3
storage:
size: 1Gi
EOF

kubectl get -A cluster

Loading

0 comments on commit 730e70a

Please sign in to comment.