Skip to content

Commit

Permalink
feat: use single path for PGD and PGD proxy image
Browse files Browse the repository at this point in the history
Signed-off-by: Tao Li <[email protected]>
  • Loading branch information
litaocdl committed Dec 3, 2024
1 parent d806a14 commit cb7a7ca
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 30 deletions.
50 changes: 34 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ helm upgrade --install edb-pg4k \
This will create a deployment in the `postgresql-operator-system` namespace.
You can check it's ready:

``` sh
```sh
$ kubectl get deployments -n postgresql-operator-system
NAME READY UP-TO-DATE AVAILABLE AGE
edb-pg4k-edb-postgres-for-kubernetes 1/1 1 1 11s
Expand Down Expand Up @@ -126,7 +126,7 @@ helm upgrade --dependency-update \
Once the above runs, a new namespace `pgd-operator-system` will be
created, with several deployments, including the two operators.

``` sh
```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
Expand Down Expand Up @@ -166,9 +166,8 @@ in your K8S setup, you can skip this section and go directly to the setup of [PG

To deploy cert-manager in its own namespace

``` sh
$ helm repo add jetstack https://charts.jetstack.io
$ helm upgrade --install cert-manager jetstack/cert-manager \
```console
$ helm repo add jetstack https://charts.jetstack.io && helm upgrade --install cert-manager jetstack/cert-manager \
--create-namespace \
--namespace cert-manager \
--version "v1.16.1" \
Expand All @@ -189,7 +188,7 @@ to set `cert-manager.enabled` to false if cert-manager is installed separately.
to put the focus on the `enabled=false` condition. The flags may still be
necessary, unless the credentials are provided in the `values.yaml` file.

``` sh
```console
helm upgrade --dependency-update \
--install edb-pg4k-pgd \
--namespace pgd-operator-system \
Expand All @@ -200,7 +199,7 @@ helm upgrade --dependency-update \

You should now have a seperate namespace for each operator:

``` sh
```sh
$ kubectl get ns
NAME STATUS AGE
Expand All @@ -219,11 +218,8 @@ invocation.

The following example uses the `k8s_standard_pgd` registry in
`docker.enterprisedb.com`. Following is the description of set options.
- `global.repository`: The repository where the PG4K-PGD and PG4K operator image are downloaded from.
This is a global setting, which is shared for both PG4K-PGD and PG4K operators.
- `PGD_IMAGE_NAME`: The location where the PGD image are pulled from.
- `PGD_PROXY_IMAGE_NAME`: The location where PGD Proxy image are pulled from, usually
the same with `PGD_IMAGE_NAME`.
- `global.repository`: The repository where the operator and operand image are downloaded from.
This is a global setting, which is shared for both PG4K-PGD and PG4K operators and pgd operands.

Assuming that you have your necessary credentials, please fill in the USERNAME
and PASSWORD below.
Expand All @@ -236,11 +232,33 @@ helm upgrade --dependency-update \
edb/edb-postgres-distributed-for-kubernetes \
--set image.imageCredentials.username=${USERNAME} \
--set image.imageCredentials.password=${PASSWORD} \
--set global.repository=docker.enterprisedb.com/k8s_standard_pgd \
--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
--set global.repository=docker.enterprisedb.com/k8s_standard_pgd
```

If we want to use different flavor or different version of PGD image, we can set the following two
global options, for each helm chart release, the PGD and PGD proxy are upgrade to latest well-tested
versions, by default, the PGD image here is using postgresql-pgd.

- `pgdImageName`: The PGD image name to be used by the operator. PGD image with this name will be
pulled from `global.repository`.
- `proxyImageName`: The PGD proxy image name to be used by the operator. PGD proxy image with
this name will be pulled from `global.repository`.

This example uses the `edb-postgres-advanced-pgd` PGD images.

```console
helm upgrade --dependency-update \
--install edb-pg4k-pgd \
--namespace pgd-operator-system \
--create-namespace \
edb/edb-postgres-distributed-for-kubernetes \
--set image.imageCredentials.username=${USERNAME} \
--set image.imageCredentials.password=${PASSWORD} \
--set global.pgdImageName=edb-postgres-advanced-pgd:16.4.1-5.5.1-1 \
--set global.proxyImageName=edb-pgd-proxy:5.5.0
```


## Deployment using local chart

### Deployment PG4K using local chart
Expand Down Expand Up @@ -284,7 +302,7 @@ helm upgrade --install edb-pg4k-lts \
and then deploy the PG4K-PGD chart with `edb-postgres-for-kubernetes-lts.enabled=false`
set.

```
```console
helm upgrade --install edb-pg4k-pgd \
--namespace pgd-operator-system \
--create-namespace \
Expand Down
5 changes: 5 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ follow these steps:
1. update PGD_IMAGE_NAME and PGD_PROXY_IMAGE_NAME defaults inside
`charts/edb-postgres-distributed-for-kubernetes/values.yaml` according to the default
versions present in the release.
1. update the `.appVersion` and `.verions` in subchart
`./charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts`,
and follow the [EPK Release](#how-to-release-the-edb-postgres-for-kubernetes-chart) to update
the subchart to latest PG4K lts release.


From here onward, you can follow the steps of the [EPK Release](#how-to-release-the-edb-postgres-for-kubernetes-chart), starting from `point 6`.

Expand Down
10 changes: 7 additions & 3 deletions charts/edb-postgres-distributed-for-kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ EDB Postgres Distributed for Kubernetes Helm Chart
| cert-manager.installCRDs | bool | `true` | |
| commonAnnotations | object | `{}` | Annotations to be added to all other resources |
| config.create | bool | `true` | Specifies whether the secret should be created |
| config.data.PGD_IMAGE_NAME | string | `"docker.enterprisedb.com/k8s_enterprise_pgd/postgresql-pgd:16.4-5.5.1-1"` | Specifies the location of the pgd image to be used for the operator docker.enterprisedb.com/k8s_standard_pgd/postgresql-pgd:16.4-5.5.1-1 |
| config.data.PGD_PROXY_IMAGE_NAME | string | `"docker.enterprisedb.com/k8s_enterprise_pgd/edb-pgd-proxy:5.5.0"` | Specifies the location of the pgd-proxy image to be used for the operator docker.enterprisedb.com/k8s_standard_pgd/edb-pgd-proxy:5.5.0 |
| config.data.PGD_IMAGE_NAME | string | `""` | Specifies the location of the pgd image (include path) to be used for the operator, this will overwrite the global repository/pgdImageName |
| config.data.PGD_PROXY_IMAGE_NAME | string | `""` | Specifies the location of the pgd image (include path) to be used for the operator, this will overwrite the global repository/pgdImageName|
| config.data.PULL_SECRET_NAME | string | `"edb-pull-secret"` | |
| config.name | string | `"pgd-operator-controller-manager-config"` | |
| config.secret | bool | `false` | Specifies whether it should be stored in a secret, instead of a configmap |
Expand All @@ -48,7 +48,11 @@ EDB Postgres Distributed for Kubernetes Helm Chart
| edb-postgres-for-kubernetes-lts.image.repository | string | `""` | |
| fullnameOverride | string | `""` | |
| global | object | `{"repository":"docker.enterprisedb.com/k8s_enterprise_pgd"}` | Global values |
| global.repository | string | `"docker.enterprisedb.com/k8s_enterprise_pgd"` | Specifies the repository where the operator image to be downloaded from repository: docker.enterprisedb.com/k8s_standard_pgd |
| global.repository | string | `"docker.enterprisedb.com/k8s_enterprise_pgd"` | Specifies the repository where the operator image to be downloaded from. Another repository is: docker.enterprisedb.com/k8s_standard_pgd |
| global.pgdImageName | string | `"postgresql-pgd:16.4-5.5.1-1"` | Specifies the name of pgd image to be used for the operator, this image will be downloaded from
global repository |
| global.proxyImageName | string | `"edb-pgd-proxy:5.5.0"` | Specifies the name of pgd-proxy image to be used for the operator, this image will be downloaded from
global repository |
| image.imageCredentials.create | bool | `true` | Specifies if an imagePullSecret should be created |
| image.imageCredentials.name | string | `"edb-pull-secret"` | |
| image.imageCredentials.password | string | `""` | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ Create the pg4k-pgd operator image name
{{- end }}
{{- end }}


{{/*
Create the pgd and pgd proxy operand image name in configmap
*/}}
{{- define "edb-postgres-distributed-for-kubernetes.configData" }}
{{- if not .Values.config.data.PGD_IMAGE_NAME }}
{{- $_ := set .Values.config.data "PGD_IMAGE_NAME" (printf "%s/%s" .Values.global.repository .Values.global.pgdImageName) }}
{{- end }}
{{- if not .Values.config.data.PGD_PROXY_IMAGE_NAME }}
{{- $_ := set .Values.config.data "PGD_PROXY_IMAGE_NAME" (printf "%s/%s" .Values.global.repository .Values.global.proxyImageName) }}
{{- end }}
{{- with .Values.config.data }}
{{- toYaml . }}
{{- end }}
{{- end }}


{{/*
Common labels
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
data:
{{- toYaml .Values.config.data | nindent 2 }}
{{- include "edb-postgres-distributed-for-kubernetes.configData" . | nindent 2 }}
{{- else }}
apiVersion: v1
kind: Secret
Expand All @@ -39,6 +39,6 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
stringData:
{{- toYaml .Values.config.data | nindent 2 }}
{{- include "edb-postgres-distributed-for-kubernetes.configData" . | nindent 2 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@
"properties": {
"repository": {
"type": "string"
},
"pgdImageName": {
"type": "string"
},
"proxyImageName": {
"type": "string"
}
}
},
Expand Down
26 changes: 17 additions & 9 deletions charts/edb-postgres-distributed-for-kubernetes/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,19 @@ replicaCount: 1

# -- Global values
global:
# -- Specifies the repository where the operator image to be downloaded from
# -- Specifies the repository where the operator and operand image to be downloaded from
# repository: docker.enterprisedb.com/k8s_standard_pgd
repository: docker.enterprisedb.com/k8s_enterprise_pgd

# -- Specifies the pgd image name to be used for the operator, the image will be downloaded from
# global repository
pgdImageName: postgresql-pgd:16.4-5.5.1-1
# -- Specifies the pgd-proxy image name to be used for the operator, the image will be downloaded from
# global repository
proxyImageName: edb-pgd-proxy:5.5.0

# -- operator image configuration
image:
# -- Specifies the repository of the pgd operator image, this will overwrite the global repository
repository: ""
# -- Specifies the name of the operator image to be pulled from repository
imageName: pg4k-pgd
Expand Down Expand Up @@ -84,15 +92,14 @@ config:
create: true
# -- Specifies whether it should be stored in a secret, instead of a configmap
secret: false

data:
PULL_SECRET_NAME: edb-pull-secret
# -- Specifies the location of the pgd image to be used for the operator
# docker.enterprisedb.com/k8s_standard_pgd/postgresql-pgd:16.4-5.5.1-1
PGD_IMAGE_NAME: docker.enterprisedb.com/k8s_enterprise_pgd/postgresql-pgd:16.4-5.5.1-1
# -- Specifies the location of the pgd-proxy image to be used for the operator
# docker.enterprisedb.com/k8s_standard_pgd/edb-pgd-proxy:5.5.0
PGD_PROXY_IMAGE_NAME: docker.enterprisedb.com/k8s_enterprise_pgd/edb-pgd-proxy:5.5.0
# -- Specifies the location of the pgd image (include path) to be used for the operator
# this will overwrite the global repository/pgdImageName
PGD_IMAGE_NAME: ""
# -- Specifies the location of the pgd-proxy image (include path) to be used for the operator
# this will overwrite the global repository/proxyImageName
PGD_PROXY_IMAGE_NAME: ""
name: pgd-operator-controller-manager-config

# -- Additional arguments to be added to the operator's args list
Expand Down Expand Up @@ -170,6 +177,7 @@ cert-manager:
edb-postgres-for-kubernetes-lts:
enabled: true
image:
# -- Specifies the repository of the pg4k operator image, this will overwrite the global repository
repository: ""
crds:
create: true

0 comments on commit cb7a7ca

Please sign in to comment.