Skip to content

Commit 9b6f0aa

Browse files
feat: use single path for PGD and PGD proxy image (#179)
Signed-off-by: Tao Li <[email protected]> Signed-off-by: wolfox <[email protected]> Co-authored-by: wolfox <[email protected]>
1 parent d806a14 commit 9b6f0aa

File tree

7 files changed

+98
-36
lines changed

7 files changed

+98
-36
lines changed

README.md

+44-22
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ helm upgrade --install edb-pg4k \
5353
This will create a deployment in the `postgresql-operator-system` namespace.
5454
You can check it's ready:
5555

56-
``` sh
56+
```sh
5757
$ kubectl get deployments -n postgresql-operator-system
5858
NAME READY UP-TO-DATE AVAILABLE AGE
5959
edb-pg4k-edb-postgres-for-kubernetes 1/1 1 1 11s
@@ -118,15 +118,16 @@ image registry by default:
118118
helm upgrade --dependency-update \
119119
--install edb-pg4k-pgd \
120120
--namespace pgd-operator-system \
121-
--create-namespace edb/edb-postgres-distributed-for-kubernetes \
121+
--create-namespace \
122122
--set image.imageCredentials.username=${USERNAME} \
123-
--set image.imageCredentials.password=${PASSWORD}
123+
--set image.imageCredentials.password=${PASSWORD} \
124+
edb/edb-postgres-distributed-for-kubernetes
124125
```
125126

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

129-
``` sh
130+
```sh
130131
$ kubectl get deployments -n pgd-operator-system
131132
NAME READY UP-TO-DATE AVAILABLE AGE
132133
edb-pg4k-pgd-cert-manager 1/1 1 1 7m46s
@@ -166,9 +167,9 @@ in your K8S setup, you can skip this section and go directly to the setup of [PG
166167

167168
To deploy cert-manager in its own namespace
168169

169-
``` sh
170-
$ helm repo add jetstack https://charts.jetstack.io
171-
$ helm upgrade --install cert-manager jetstack/cert-manager \
170+
```console
171+
$ helm repo add jetstack https://charts.jetstack.io &&
172+
helm upgrade --install cert-manager jetstack/cert-manager \
172173
--create-namespace \
173174
--namespace cert-manager \
174175
--version "v1.16.1" \
@@ -189,18 +190,18 @@ to set `cert-manager.enabled` to false if cert-manager is installed separately.
189190
to put the focus on the `enabled=false` condition. The flags may still be
190191
necessary, unless the credentials are provided in the `values.yaml` file.
191192

192-
``` sh
193+
```console
193194
helm upgrade --dependency-update \
194195
--install edb-pg4k-pgd \
195196
--namespace pgd-operator-system \
196197
--create-namespace \
197-
edb/edb-postgres-distributed-for-kubernetes \
198-
--set cert-manager.enabled=false
198+
--set cert-manager.enabled=false \
199+
edb/edb-postgres-distributed-for-kubernetes
199200
```
200201

201202
You should now have a seperate namespace for each operator:
202203

203-
``` sh
204+
```sh
204205
$ kubectl get ns
205206
NAME STATUS AGE
206207
@@ -219,11 +220,8 @@ invocation.
219220

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

228226
Assuming that you have your necessary credentials, please fill in the USERNAME
229227
and PASSWORD below.
@@ -233,14 +231,38 @@ helm upgrade --dependency-update \
233231
--install edb-pg4k-pgd \
234232
--namespace pgd-operator-system \
235233
--create-namespace \
236-
edb/edb-postgres-distributed-for-kubernetes \
237234
--set image.imageCredentials.username=${USERNAME} \
238235
--set image.imageCredentials.password=${PASSWORD} \
239236
--set global.repository=docker.enterprisedb.com/k8s_standard_pgd \
240-
--set config.data.PGD_IMAGE_NAME=docker.enterprisedb.com/k8s_standard_pgd/postgresql-pgd:15.6-5.5.1-1 \
241-
--set config.data.PGD_PROXY_IMAGE_NAME=docker.enterprisedb.com/k8s_standard_pgd/edb-pgd-proxy:5.5.0
237+
edb/edb-postgres-distributed-for-kubernetes
242238
```
243239

240+
If we want to use a different flavor or a different version of PGD image, we can set the following two
241+
global options, for each helm chart release:
242+
243+
- `pgdImageName`: the PGD image name to be used by the operator. PGD image (with this name)
244+
will be pulled from `global.repository`;
245+
- `proxyImageName`: the PGD proxy image name to be used by the operator. PGD proxy image (with this name)
246+
will be pulled from `global.repository`.
247+
248+
PGD and PGD proxy are upgraded to the latest well-tested versions.
249+
By default, the PGD image here is using postgresql-pgd.
250+
251+
This example uses the `edb-postgres-advanced-pgd` PGD images.
252+
253+
```console
254+
helm upgrade --dependency-update \
255+
--install edb-pg4k-pgd \
256+
--namespace pgd-operator-system \
257+
--create-namespace \
258+
--set image.imageCredentials.username=${USERNAME} \
259+
--set image.imageCredentials.password=${PASSWORD} \
260+
--set global.pgdImageName=edb-postgres-advanced-pgd:16.4.1-5.5.1-1 \
261+
--set global.proxyImageName=edb-pgd-proxy:5.5.0 \
262+
edb/edb-postgres-distributed-for-kubernetes
263+
```
264+
265+
244266
## Deployment using local chart
245267

246268
### Deployment PG4K using local chart
@@ -284,14 +306,14 @@ helm upgrade --install edb-pg4k-lts \
284306
and then deploy the PG4K-PGD chart with `edb-postgres-for-kubernetes-lts.enabled=false`
285307
set.
286308

287-
```
309+
```console
288310
helm upgrade --install edb-pg4k-pgd \
289311
--namespace pgd-operator-system \
290312
--create-namespace \
291313
--set image.imageCredentials.username=${USERNAME} \
292314
--set image.imageCredentials.password=${PASSWORD} \
293-
charts/edb-postgres-distributed-for-kubernetes \
294-
--set edb-postgres-for-kubernetes-lts.enabled=false
315+
--set edb-postgres-for-kubernetes-lts.enabled=false \
316+
charts/edb-postgres-distributed-for-kubernetes
295317
```
296318

297319
**Note:** The image locations are elided. Please refer to the sections above

RELEASE.md

+5
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ follow these steps:
8686
1. update PGD_IMAGE_NAME and PGD_PROXY_IMAGE_NAME defaults inside
8787
`charts/edb-postgres-distributed-for-kubernetes/values.yaml` according to the default
8888
versions present in the release.
89+
1. update the `.appVersion` and `.verions` in subchart
90+
`./charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts`,
91+
and follow the [EPK Release](#how-to-release-the-edb-postgres-for-kubernetes-chart) to update
92+
the subchart to latest PG4K lts release.
93+
8994

9095
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`.
9196

charts/edb-postgres-distributed-for-kubernetes/README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ EDB Postgres Distributed for Kubernetes Helm Chart
3636
| cert-manager.installCRDs | bool | `true` | |
3737
| commonAnnotations | object | `{}` | Annotations to be added to all other resources |
3838
| config.create | bool | `true` | Specifies whether the secret should be created |
39-
| 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 |
40-
| 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 |
39+
| 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 |
40+
| 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|
4141
| config.data.PULL_SECRET_NAME | string | `"edb-pull-secret"` | |
4242
| config.name | string | `"pgd-operator-controller-manager-config"` | |
4343
| config.secret | bool | `false` | Specifies whether it should be stored in a secret, instead of a configmap |
@@ -48,7 +48,11 @@ EDB Postgres Distributed for Kubernetes Helm Chart
4848
| edb-postgres-for-kubernetes-lts.image.repository | string | `""` | |
4949
| fullnameOverride | string | `""` | |
5050
| global | object | `{"repository":"docker.enterprisedb.com/k8s_enterprise_pgd"}` | Global values |
51-
| 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 |
51+
| 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 |
52+
| 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
53+
global repository |
54+
| 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
55+
global repository |
5256
| image.imageCredentials.create | bool | `true` | Specifies if an imagePullSecret should be created |
5357
| image.imageCredentials.name | string | `"edb-pull-secret"` | |
5458
| image.imageCredentials.password | string | `""` | |

charts/edb-postgres-distributed-for-kubernetes/templates/_helpers.tpl

+17
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,23 @@ Create the pg4k-pgd operator image name
4141
{{- end }}
4242
{{- end }}
4343

44+
45+
{{/*
46+
Create the pgd and pgd proxy operand image name in configmap
47+
*/}}
48+
{{- define "edb-postgres-distributed-for-kubernetes.configData" }}
49+
{{- if not .Values.config.data.PGD_IMAGE_NAME }}
50+
{{- $_ := set .Values.config.data "PGD_IMAGE_NAME" (printf "%s/%s" .Values.global.repository .Values.global.pgdImageName) }}
51+
{{- end }}
52+
{{- if not .Values.config.data.PGD_PROXY_IMAGE_NAME }}
53+
{{- $_ := set .Values.config.data "PGD_PROXY_IMAGE_NAME" (printf "%s/%s" .Values.global.repository .Values.global.proxyImageName) }}
54+
{{- end }}
55+
{{- with .Values.config.data }}
56+
{{- toYaml . }}
57+
{{- end }}
58+
{{- end }}
59+
60+
4461
{{/*
4562
Common labels
4663
*/}}

charts/edb-postgres-distributed-for-kubernetes/templates/config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ metadata:
2525
{{- toYaml . | nindent 4 }}
2626
{{- end }}
2727
data:
28-
{{- toYaml .Values.config.data | nindent 2 }}
28+
{{- include "edb-postgres-distributed-for-kubernetes.configData" . | nindent 2 }}
2929
{{- else }}
3030
apiVersion: v1
3131
kind: Secret
@@ -39,6 +39,6 @@ metadata:
3939
{{- toYaml . | nindent 4 }}
4040
{{- end }}
4141
stringData:
42-
{{- toYaml .Values.config.data | nindent 2 }}
42+
{{- include "edb-postgres-distributed-for-kubernetes.configData" . | nindent 2 }}
4343
{{- end }}
4444
{{- end }}

charts/edb-postgres-distributed-for-kubernetes/values.schema.json

+6
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@
118118
"properties": {
119119
"repository": {
120120
"type": "string"
121+
},
122+
"pgdImageName": {
123+
"type": "string"
124+
},
125+
"proxyImageName": {
126+
"type": "string"
121127
}
122128
}
123129
},

charts/edb-postgres-distributed-for-kubernetes/values.yaml

+17-9
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,19 @@ replicaCount: 1
2020

2121
# -- Global values
2222
global:
23-
# -- Specifies the repository where the operator image to be downloaded from
23+
# -- Specifies the repository where the operator and operand image to be downloaded from
2424
# repository: docker.enterprisedb.com/k8s_standard_pgd
2525
repository: docker.enterprisedb.com/k8s_enterprise_pgd
26-
26+
# -- Specifies the pgd image name to be used for the operator, the image will be downloaded from
27+
# global repository
28+
pgdImageName: postgresql-pgd:16.4-5.5.1-1
29+
# -- Specifies the pgd-proxy image name to be used for the operator, the image will be downloaded from
30+
# global repository
31+
proxyImageName: edb-pgd-proxy:5.5.0
32+
33+
# -- operator image configuration
2734
image:
35+
# -- Specifies the repository of the pgd operator image, this will overwrite the global repository
2836
repository: ""
2937
# -- Specifies the name of the operator image to be pulled from repository
3038
imageName: pg4k-pgd
@@ -84,15 +92,14 @@ config:
8492
create: true
8593
# -- Specifies whether it should be stored in a secret, instead of a configmap
8694
secret: false
87-
8895
data:
8996
PULL_SECRET_NAME: edb-pull-secret
90-
# -- Specifies the location of the pgd image to be used for the operator
91-
# docker.enterprisedb.com/k8s_standard_pgd/postgresql-pgd:16.4-5.5.1-1
92-
PGD_IMAGE_NAME: docker.enterprisedb.com/k8s_enterprise_pgd/postgresql-pgd:16.4-5.5.1-1
93-
# -- Specifies the location of the pgd-proxy image to be used for the operator
94-
# docker.enterprisedb.com/k8s_standard_pgd/edb-pgd-proxy:5.5.0
95-
PGD_PROXY_IMAGE_NAME: docker.enterprisedb.com/k8s_enterprise_pgd/edb-pgd-proxy:5.5.0
97+
# -- Specifies the location of the pgd image (include path) to be used for the operator
98+
# this will overwrite the global repository/pgdImageName
99+
PGD_IMAGE_NAME: ""
100+
# -- Specifies the location of the pgd-proxy image (include path) to be used for the operator
101+
# this will overwrite the global repository/proxyImageName
102+
PGD_PROXY_IMAGE_NAME: ""
96103
name: pgd-operator-controller-manager-config
97104

98105
# -- Additional arguments to be added to the operator's args list
@@ -170,6 +177,7 @@ cert-manager:
170177
edb-postgres-for-kubernetes-lts:
171178
enabled: true
172179
image:
180+
# -- Specifies the repository of the pg4k operator image, this will overwrite the global repository
173181
repository: ""
174182
crds:
175183
create: true

0 commit comments

Comments
 (0)