Skip to content

Commit 90c6f17

Browse files
committed
use global value for operator repository
Signed-off-by: Tao Li <tao.li@enterprisedb.com>
1 parent 8a8b77f commit 90c6f17

File tree

9 files changed

+80
-65
lines changed

9 files changed

+80
-65
lines changed

.github/workflows/continuous-delivery.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
PHASE="Cluster in healthy state"
6868
kubectl wait --timeout=5m --for=jsonpath='{.status.phase}'="$PHASE" clusters/cluster-example
6969
70-
deploy-ep4k-lts:
70+
deploy-ep4k-subcharts:
7171
runs-on: ubuntu-22.04
7272
needs:
7373
- change-triage
@@ -190,7 +190,7 @@ jobs:
190190
kubectl -n test-ignore apply -f hack/samples/ep4k-cluster.yaml
191191
kubectl -n test-ignore get pods 2>&1 >/dev/null | grep 'No resources found'
192192
193-
deploy-ep4k-lts-single-namespace:
193+
deploy-ep4k-subcharts-single-namespace:
194194
runs-on: ubuntu-22.04
195195
needs:
196196
- change-triage
@@ -209,11 +209,12 @@ jobs:
209209
- name: Create kind cluster
210210
uses: helm/kind-action@v1.10.0
211211

212-
- name: Deploy in single-namespace mode using helm chart
212+
- name: Deploy in single-namespace mode using helm chart use different namespace
213213
run: |
214214
helm upgrade --install edb-pg4k-lts --namespace single-install \
215215
--set config.clusterWide=false \
216216
--create-namespace charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts \
217+
--set image.repository=docker.enterprisedb.com/k8s_standard_pgd \
217218
--set image.imageCredentials.create=true \
218219
--set image.imageCredentials.username=${{ secrets.CS_USER }} \
219220
--set image.imageCredentials.password=${{ secrets.CS_PASSWORD }} \

README.md

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,17 @@ It is up to the user to ensure there is no collision between operators.
9090

9191
## Deployment of the EDB Postgres Distributed for Kubernetes operator (PG4K-PGD)
9292

93-
Like PG4K install, both the operator and the operand images required by PG4K-PGD
94-
may be pulled from the `k8s_enterprise` or `k8s_standard` repositories at
95-
`docker.enterprisedb.com`, please obtaining an EDB subscription token before setup.
93+
Like PG4K helm chart install, both the operator and the operand images required
94+
by `edb-postgres-distributed-for-kubernetes` may be pulled from the
95+
`k8s_enterprise_pgd` or `k8s_standard_pgd` repositories at `docker.enterprisedb.com`,
96+
please obtaining an EDB subscription token before setup.
9697

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.
98+
The PG4K-PGD chart installs both the PG4K-PGD and PG4K operators in the
99+
same namespace. The PG4K operator installed is a stable version that is
100+
part of the latest long-term support release of PG4K.
101101

102-
The `edb-postgres-distributed-for-kubernetes` chart also install the cert-manager
103-
operators as dependency. You can avoid this if necessary. See the sub-section
102+
The PG4K-PGD chart also install the cert-manager operators as dependency. You
103+
can avoid this if necessary. See the sub-section
104104
[on deploying individually](#deploying-the-PG4K-PGD-operators-individually).
105105

106106
**Note:** this helm chart uses a default registry to retrieve the operator
@@ -145,7 +145,7 @@ helm chart are working:
145145
### Deploying the PG4K-PGD operators and cert-manager individually
146146

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

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

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

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
187+
#### 2. Setup PG4K-PGD
200188

201189
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.
190+
to set `cert-manager.enabled` to false if cert-manager is installed separately.
204191

205192
**Note:** in the following example, the flags setting the credentials were elided
206193
to put the focus on the `enabled=false` condition. The flags may still be
@@ -213,19 +200,17 @@ helm upgrade --dependency-update \
213200
--create-namespace \
214201
edb/edb-postgres-distributed-for-kubernetes \
215202
--set cert-manager.enabled=false
216-
--set edb-postgres-for-kubernetes-lts.enabled=false
217203
```
218204

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

222208
``` sh
223209
$ kubectl get ns
224210
NAME STATUS AGE
225211
226212
cert-manager Active 24m
227213
pgd-operator-system Active 55s
228-
postgresql-operator-system Active 5m33s
229214
```
230215

231216
### Controlling the image repositories
@@ -238,14 +223,12 @@ subscription plan. This needs to be done in several places in the command-line
238223
invocation.
239224

240225
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.
226+
`docker.enterprisedb.com`. Following is the description of set options.
227+
- `global.image.repository`: The repository where the PG4K-PGD and PG4K operator image downloaded from.
228+
This is a global setting, which is shared for both PG4K-PGD and PG4K operators.
229+
- `PGD_IMAGE_NAME`: The location where the PGD image are pulled from.
230+
- `PGD_PROXY_IMAGE_NAME`: The location 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 global.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/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,21 @@ EDB Postgres Distributed for Kubernetes Helm Chart
4444
| containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true,"runAsGroup":10001,"runAsUser":10001}` | Container Security Context |
4545
| crds.create | bool | `true` | ||
4646
| edb-postgres-for-kubernetes-lts.enable | bool | `true` | |
47-
| edb-postgres-for-kubernetes-lts.image.repository | string | `"docker.enterprisedb.com/k8s_enterprise_pgd/edb-postgres-for-kubernetes"` | |
47+
| edb-postgres-for-kubernetes-lts.image.repository | string | `""` | Overrides the global image repository for pg4k operator. |
48+
| edb-postgres-for-kubernetes-lts.image.imageName | string | `"edb-postgres-for-kubernetes"` | pg4k operator image name in repository|
4849
| edb-postgres-for-kubernetes-lts.image.imagePullSecrets[0].name | string| `"edb-pull-secret"` | |
4950
| edb-postgres-for-kubernetes-lts.config.data.PULL_SECRET_NAME| string| `"edb-pull-secret"` | |
51+
|global.repository| string|`docker.enterprisedb.com/k8s_enterprise_pgd`| specifies the repository name where all the operators are pulled from, image name is not included|
5052
| imagePullSecrets[0].name | string | `"edb-pull-secret"` | |
5153
| fullnameOverride | string | `""` | |
5254
| image.imageCredentials.create | bool | `true` | Specifies if an imagePullSecret should be created |
5355
| image.imageCredentials.name | string | `"edb-pull-secret"` | |
5456
| image.imageCredentials.password | string | `""` | |
5557
| image.imageCredentials.registry | string | `"docker.enterprisedb.com"` | |
56-
| image.imageCredentials.username | string | `""` | |
58+
| image.imageCredentials.username | string | `""` | |
59+
| image.repository | string | `""` | Overrides the global image repository for pg4k-pgd operator.|
60+
| image.imageName | string | `"pg4k-pgd"` | pg4k-pgd operator image name in repository|
5761
| image.pullPolicy | string | `"IfNotPresent"` | |
58-
| image.repository | string | `"docker.enterprisedb.com/k8s_enterprise_pgd/pg4k-pgd"` | |
5962
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
6063
| managerConfig.data.health.healthProbeBindAddress | string | `":9443"` | |
6164
| managerConfig.data.leaderElection.enabled | bool | `true` | |

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ 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 .Values.image.repository }}
80+
{{- printf "%s/%s:%s" .Values.image.repository ( .Values.imageName | default "edb-postgres-for-kubernetes" ) ( .Values.image.tag | default .Chart.AppVersion ) }}
81+
{{- else }}
82+
{{- printf "%s/%s:%s" .Values.global.repository ( .Values.global.imageName | default "edb-postgres-for-kubernetes" ) ( .Values.image.tag | default .Chart.AppVersion ) }}
83+
{{- end }}
84+
{{- end }}
85+
7586
{{/*
7687
Define the common set of rules that can be applied either with
7788
namespace scope or clusterwide

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

Lines changed: 2 additions & 2 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,7 +84,7 @@ spec:
8484
- name: WATCH_NAMESPACE
8585
value: "{{ .Release.Namespace }}"
8686
{{- end }}
87-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
87+
image: "{{- include "edb-postgres-for-kubernetes-lts.operatorImageName" . }}"
8888
imagePullPolicy: {{ .Values.image.pullPolicy }}
8989
livenessProbe:
9090
httpGet:

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

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

2121
image:
22-
repository: docker.enterprisedb.com/k8s_enterprise/edb-postgres-for-kubernetes
23-
pullPolicy: IfNotPresent
22+
# -- Specifies the repository where the operator image to be downloaded from
23+
# docker.enterprisedb.com/k8s_standard_pgd
24+
repository: docker.enterprisedb.com/k8s_enterprise_pgd
25+
# The name of the operator image to be pulled from repository
26+
imageName: edb-postgres-for-kubernetes
2427
# -- Overrides the image tag whose default is the chart appVersion.
2528
tag: ""
29+
pullPolicy: IfNotPresent
2630
# Credentials configuration
2731
imageCredentials:
2832
# -- Specifies if an imagePullSecret should be created
@@ -41,6 +45,7 @@ fullnameOverride: ""
4145
hostNetwork: false
4246
dnsPolicy: ""
4347

48+
installCRDs: true
4449
crds:
4550
# -- Specifies whether the CRDs should be created when installing the chart.
4651
create: true

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ 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.image.repository }}
38+
{{- printf "%s/%s:%s" .Values.image.repository ( .Values.image.imageName | default "pg4k-pgd" ) ( .Values.image.imageTag | default .Chart.AppVersion ) }}
39+
{{- else }}
40+
{{- printf "%s/%s:%s" .Values.global.repository ( .Values.image.imageName | default "pg4k-pgd" ) ( .Values.image.imageTag | default .Chart.AppVersion ) }}
41+
{{- end }}
42+
{{- end }}
43+
3344
{{/*
3445
Common labels
3546
*/}}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ 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 }}"
73+
image: "{{- include "edb-postgres-distributed-for-kubernetes.operatorImageName" . }}"
7474
imagePullPolicy: {{ .Values.image.pullPolicy }}
7575
livenessProbe:
7676
httpGet:

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

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

1919
replicaCount: 1
2020

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+
2127
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
28+
repository: ""
29+
# -- Specifies the name of the operator image to be pulled from repository
30+
imageName: pg4k-pgd
31+
# -- Specifies the tag of the operator image to be pulled from repository
2632
# -- Overrides the image tag whose default is the chart appVersion.
27-
tag: ""
33+
imageTag: ""
34+
imagePullPolicy: IfNotPresent
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,10 @@ cert-manager:
158166
enabled: true
159167
installCRDs: true
160168

161-
# edb-postgres-for-kubernetes-lts
169+
# edb-postgres-for-kubernetes-lts subcharts
162170
edb-postgres-for-kubernetes-lts:
163171
enabled: true
164172
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
173+
repository: ""
171174
crds:
172-
# -- Specifies whether the CRDs should be created when installing the chart.
173175
create: true

0 commit comments

Comments
 (0)