Skip to content

Commit e700c04

Browse files
committed
use global value for operator repository
Signed-off-by: Tao Li <tao.li@enterprisedb.com>
1 parent 77c4250 commit e700c04

File tree

7 files changed

+79
-58
lines changed

7 files changed

+79
-58
lines changed

README.md

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,9 @@ Like PG4K install, both the operator and the operand images required by PG4K-PGD
9494
may be pulled from the `k8s_enterprise` or `k8s_standard` repositories at
9595
`docker.enterprisedb.com`, please obtaining an EDB subscription token before setup.
9696

97-
The `edb-postgres-distributed-for-kubernetes` chart will by default install PG4K
98-
operator defined by sub-chart in the same namespace, the PG4K operator installed
99-
in the sub-chart is PG4K LTS release operator, which is upgraded along with the
100-
parent chart version release.
97+
The `edb-postgres-distributed-for-kubernetes` chart will install the operator for
98+
both PG4K-PGD and PG4K in the same namespace. The PG4K operator used for PG4K-PGD
99+
is well-tested and belongs to latest long term support release of PG4K.
101100

102101
The `edb-postgres-distributed-for-kubernetes` chart also install the cert-manager
103102
operators as dependency. You can avoid this if necessary. See the sub-section
@@ -145,7 +144,7 @@ helm chart are working:
145144
### Deploying the PG4K-PGD operators and cert-manager individually
146145

147146
The chart `edb-postgres-distributed-for-kubernetes` is set by default to
148-
also install PG4K and cert-manager operators, which it depends on.
147+
also install cert-manager operators, which it depends on.
149148
When following this route, all operators will be installed in the same
150149
namespace. This is in contrast with other installation paths, where the
151150
operators reside in dedicated namespaces.
@@ -154,7 +153,7 @@ Installing all dependencies in the same namespace is a design limitation of
154153
Helm, but we can get around it by installing dependencies with separate
155154
invocations of `helm`.
156155

157-
If you would like to install the cert-manager in separate namespaces, please
156+
If you would like to install the cert-manager in a separate namespaces, please
158157
follow the below steps.
159158

160159
#### 1. Setup cert-manager
@@ -184,23 +183,10 @@ In case you choose this option, remember to also specify
184183
`--set cert-manager.enabled=false` during the installation of the PG4K-PGD
185184
helm chart in the next section.
186185

187-
#### 2. Setup PG4K
188-
189-
By default, a PG4K operator with LTS release is installed alongside with PG4K-PGD
190-
deploy. You can follow [PG4K helm chart](#deployment-of-the-edb-postgres-for-kubernetes-operator-pg4k)
191-
to deploy the PG4K operator in its own namespace. But it is highly recommended to use
192-
the PG4K operator installed as dependency of PG4K-PGD chart, which contains the well tested PG4K
193-
operator version.
194-
195-
In case you choose to use existing PG4K operator, remember to also specify
196-
`--set edb-postgres-for-kubernetes-lts.enabled=false` during the installation of the PG4K-PGD
197-
helm chart in the next section.
198-
199-
#### 3. Setup PG4K-PGD
186+
#### 2. Setup PG4K-PGD
200187

201188
Once the above deployments are ready, you can deploy the PG4K-PGD helm chart. taking care
202-
to set `edb-postgres-for-kubernetes-lts.enabled` to false if you PG4K already deployed,
203-
and set `cert-manager.enabled` to false if cert-manager is installed separately.
189+
to set `cert-manager.enabled` to false if cert-manager is installed separately.
204190

205191
**Note:** in the following example, the flags setting the credentials were elided
206192
to put the focus on the `enabled=false` condition. The flags may still be
@@ -213,19 +199,17 @@ helm upgrade --dependency-update \
213199
--create-namespace \
214200
edb/edb-postgres-distributed-for-kubernetes \
215201
--set cert-manager.enabled=false
216-
--set edb-postgres-for-kubernetes-lts.enabled=false
217202
```
218203

219-
You can see the three separate namespaces, the same that would be created if
220-
installing manually without Helm charts.
204+
You can see two seperate namespaces where cert-manager is installed in `cert-manager`
205+
namespaces.
221206

222207
``` sh
223208
$ kubectl get ns
224209
NAME STATUS AGE
225210
226211
cert-manager Active 24m
227212
pgd-operator-system Active 55s
228-
postgresql-operator-system Active 5m33s
229213
```
230214

231215
### Controlling the image repositories
@@ -238,14 +222,13 @@ subscription plan. This needs to be done in several places in the command-line
238222
invocation.
239223

240224
The following example uses the `k8s_standard_pgd` registry in
241-
`docker.enterprisedb.com`.
242-
Note the multiple `--set` options, for the `image.repository`,
243-
`PGD_IMAGE_NAME` and `PGD_PROXY_IMAGE_NAME` in addition to the
244-
`edb-postgres-for-kubernetes-lts.image.repository` where the PGD operator
245-
is pulled from. There are 4 in total
246-
- `image.repository` where the PG4K-PGD operator image is pulled from.
247-
- `edb-postgres-for-kubernetes-lts.image.repository` where the PG4K operator image is pulled from.
248-
- `PGD_IMAGE_NAME` and `PGD_PROXY_IMAGE_NAME` where the PGD and PGD Proxy image are pulled from.
225+
`docker.enterprisedb.com`. Following is the description of multiple
226+
set options.
227+
- `image.repository` where the PG4K-PGD and PG4K operator image is pulled from, this is the repository without imageName, the default
228+
operator image name is defined in the value file.
229+
- `PGD_IMAGE_NAME` where the PGD image are pulled from.
230+
- `PGD_PROXY_IMAGE_NAME` where PGD Proxy image are pulled from, usually
231+
the same with `PGD_IMAGE_NAME`.
249232

250233
Assuming that you have your necessary credentials, please fill in the USERNAME
251234
and PASSWORD below.
@@ -258,8 +241,7 @@ helm upgrade --dependency-update \
258241
edb/edb-postgres-distributed-for-kubernetes \
259242
--set image.imageCredentials.username=${USERNAME} \
260243
--set image.imageCredentials.password=${PASSWORD} \
261-
--set image.repository=docker.enterprisedb.com/k8s_standard_pgd/pg4k-pgd \
262-
--set edb-postgres-for-kubernetes-lts.image.repository=docker.enterprisedb.com/k8s_standard_pgd/edb-postgres-for-kubernetes \
244+
--set image.repository=docker.enterprisedb.com/k8s_standard_pgd \
263245
--set config.data.PGD_IMAGE_NAME=docker.enterprisedb.com/k8s_standard_pgd/postgresql-pgd:15.6-5.5.1-1 \
264246
--set config.data.PGD_PROXY_IMAGE_NAME=docker.enterprisedb.com/k8s_standard_pgd/edb-pgd-proxy:5.5.0
265247
```

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,32 @@ Create the imagePullSecret
7272
{{- end }}
7373
{{- end }}
7474

75+
{{/*
76+
Create the pg4k operator image name
77+
*/}}
78+
{{- define "edb-postgres-for-kubernetes-lts.operatorImageName" }}
79+
{{- if not .Values.global }}
80+
{{- if .Values.image.repository }}
81+
{{- printf "%s/%s:%s" .Values.image.repository .Values.image.imageName | default "edb-postgres-for-kubernetes" .Values.image.tag | default .Chart.AppVersion }}
82+
{{- end }}
83+
{{- else }}
84+
{{- if .Values.global.repository }}
85+
{{- printf "%s/%s:%s" .Values.global.repository .Values.global.imageName | default "edb-postgres-for-kubernetes" .Values.image.tag | default .Chart.AppVersion }}
86+
{{- end }}
87+
{{- end }}
88+
{{- end }}
89+
90+
{{/*
91+
Create image pullPolicy
92+
*/}}
93+
{{- define "edb-postgres-for-kubernetes-lts.operatorImagePullPolicy" -}}
94+
{{- if not .Values.global }}
95+
{{- printf .Values.image.pullPolicy }}
96+
{{- else }}
97+
{{- printf .Values.global.imagePullPolicy }}
98+
{{- end }}
99+
{{- end }}
100+
75101
{{/*
76102
Define the common set of rules that can be applied either with
77103
namespace scope or clusterwide

charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/templates/deployment.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ spec:
7070
- /manager
7171
env:
7272
- name: OPERATOR_IMAGE_NAME
73-
value: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
73+
value: "{{- include "edb-postgres-for-kubernetes-lts.operatorImageName" . }}"
7474
- name: OPERATOR_NAMESPACE
7575
valueFrom:
7676
fieldRef:
@@ -84,8 +84,8 @@ spec:
8484
- name: WATCH_NAMESPACE
8585
value: "{{ .Release.Namespace }}"
8686
{{- end }}
87-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
88-
imagePullPolicy: {{ .Values.image.pullPolicy }}
87+
image: "{{- include "edb-postgres-for-kubernetes-lts.operatorImageName" . }}"
88+
imagePullPolicy: "{{- include "edb-postgres-for-kubernetes-lts.operatorImagePullPolicy" . }}"
8989
livenessProbe:
9090
httpGet:
9191
path: /readyz

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
replicaCount: 1
2020

2121
image:
22-
repository: docker.enterprisedb.com/k8s_enterprise/edb-postgres-for-kubernetes
23-
pullPolicy: IfNotPresent
22+
repository: docker.enterprisedb.com/k8s_enterprise
23+
# The name of the operator image to be pulled from repository
24+
imageName: edb-postgres-for-kubernetes
2425
# -- Overrides the image tag whose default is the chart appVersion.
2526
tag: ""
27+
pullPolicy: IfNotPresent
2628
# Credentials configuration
2729
imageCredentials:
2830
# -- Specifies if an imagePullSecret should be created
@@ -41,6 +43,7 @@ fullnameOverride: ""
4143
hostNetwork: false
4244
dnsPolicy: ""
4345

46+
installCRDs: true
4447
crds:
4548
# -- Specifies whether the CRDs should be created when installing the chart.
4649
create: true

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ Create chart name and version as used by the chart label.
3030
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
3131
{{- end }}
3232

33+
{{/*
34+
Create the pg4k-pgd operator image name
35+
*/}}
36+
{{- define "edb-postgres-distributed-for-kubernetes.operatorImageName" }}
37+
{{- if .Values.global.repository }}
38+
{{- printf "%s/%s:%s" .Values.global.repository .Values.global.imageName | default "pg4k-pgd" .Values.global.imageTag | default .Chart.AppVersion }}
39+
{{- end }}
40+
{{- end }}
41+
3342
{{/*
3443
Common labels
3544
*/}}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ spec:
6565
- /manager
6666
env:
6767
- name: OPERATOR_IMAGE_NAME
68-
value: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
68+
value: "{{- include "edb-postgres-distributed-for-kubernetes.operatorImageName" . }}"
6969
- name: OPERATOR_NAMESPACE
7070
valueFrom:
7171
fieldRef:
7272
fieldPath: metadata.namespace
73-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
74-
imagePullPolicy: {{ .Values.image.pullPolicy }}
73+
image: "{{- include "edb-postgres-distributed-for-kubernetes.operatorImageName" . }}"
74+
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
7575
livenessProbe:
7676
httpGet:
7777
path: /readyz

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

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,20 @@
1818

1919
replicaCount: 1
2020

21-
image:
22-
# Additional Registries
23-
# repository: docker.enterprisedb.com/k8s_standard_pgd/pg4k-pgd
24-
repository: docker.enterprisedb.com/k8s_enterprise_pgd/pg4k-pgd
25-
pullPolicy: IfNotPresent
21+
# -- Global values
22+
global:
23+
# -- Specifies the repository where the operator image to be downloaded from
24+
# repository: docker.enterprisedb.com/k8s_standard_pgd
25+
repository: docker.enterprisedb.com/k8s_enterprise_pgd
26+
# -- Specifies the name of the operator image to be pulled from repository
27+
imageName: pg4k-pgd
28+
# -- Specifies the tag of the operator image to be pulled from repository
2629
# -- Overrides the image tag whose default is the chart appVersion.
27-
tag: ""
30+
imageTag: ""
31+
imagePullPolicy: IfNotPresent
32+
33+
34+
image:
2835
# Credentials configuration
2936
imageCredentials:
3037
# -- Specifies if an imagePullSecret should be created
@@ -36,6 +43,7 @@ image:
3643

3744
imagePullSecrets:
3845
- name: edb-pull-secret
46+
3947
nameOverride: ""
4048
fullnameOverride: ""
4149

@@ -158,16 +166,9 @@ cert-manager:
158166
enabled: true
159167
installCRDs: true
160168

161-
# edb-postgres-for-kubernetes-lts
169+
# edb-postgres-for-kubernetes-lts subcharts
170+
# Values defined here will overwrite the global values
162171
edb-postgres-for-kubernetes-lts:
163172
enabled: true
164-
image:
165-
repository: docker.enterprisedb.com/k8s_enterprise_pgd/edb-postgres-for-kubernetes
166-
imagePullSecrets:
167-
- name: edb-pull-secret
168-
config:
169-
data:
170-
PULL_SECRET_NAME: edb-pull-secret
171173
crds:
172-
# -- Specifies whether the CRDs should be created when installing the chart.
173174
create: true

0 commit comments

Comments
 (0)