Skip to content

Commit e255655

Browse files
committed
[WFLY-20915] Remove bitnami's postgresql Helm Chart
Instead, the DB is deployed directly by the Helm Chart Update the `wildfly` Helm chart to actually pulls the DB credentials from the config map (as stated in the doc) instead of hard-coding them in the values.yaml file. This fixes https://issues.redhat.com/browse/WFLY-20915 Signed-off-by: Jeff Mesnil <jmesnil@ibm.com>
1 parent 3ea9264 commit e255655

File tree

7 files changed

+79
-75
lines changed

7 files changed

+79
-75
lines changed

todo-backend/README.adoc

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -514,28 +514,17 @@ ifdef::helm-install-prerequisites-openshift[]
514514
[[deploy_helm_prerequisites]]
515515
:leveloffset: +1
516516
517-
ifndef::ProductRelease[]
518-
Add the bitnami repository which provides an helm chart for PostgreSQL:
519-
[source,options="nowrap"]
520-
----
521-
$ helm repo add bitnami https://charts.bitnami.com/bitnami
522-
"bitnami" has been added to your repositories
523-
----
524-
525517
The Helm Chart for this quickstart contains all the information to build an image from the source code using S2I and install it with the database:
526518
527519
[source,options="nowrap"]
528520
----
529521
dependencies:
530-
- name: postgresql
531-
repository: https://charts.bitnami.com/bitnami
532-
version: ...
533522
- name: wildfly
534523
repository: http://docs.wildfly.org/wildfly-charts/
535524
version: ...
536525
----
537526
538-
So we need to update the dependecies of our Helm Chart.
527+
So we need to update the dependencies of our Helm Chart.
539528
540529
[source,options="nowrap",subs="+attributes"]
541530
----
@@ -636,11 +625,7 @@ name: todo-backend-chart
636625
description: A Helm chart to deploy a WildFly todo-backend application and its Postgresql database
637626
type: application
638627
version: 1.0.0
639-
appVersion: 31.0.0.Final
640628
dependencies:
641-
- name: postgresql
642-
repository: https://charts.bitnami.com/bitnami
643-
version: 16.2.2
644629
- name: wildfly
645630
repository: http://docs.wildfly.org/wildfly-charts/
646631
version: 2.3.2
@@ -1031,28 +1016,17 @@ ifdef::helm-install-prerequisites-kubernetes[]
10311016
[[deploy_helm_prerequisites]]
10321017
:leveloffset: +1
10331018
1034-
ifndef::ProductRelease[]
1035-
Add the bitnami repository which provides an helm chart for PostgreSQL:
1036-
[source,options="nowrap"]
1037-
----
1038-
$ helm repo add bitnami https://charts.bitnami.com/bitnami
1039-
"bitnami" has been added to your repositories
1040-
----
1041-
10421019
The Helm Chart for this quickstart contains all the information to build an image from the source code using S2I and install it with the database:
10431020
10441021
[source,options="nowrap"]
10451022
----
10461023
dependencies:
1047-
- name: postgresql
1048-
repository: https://charts.bitnami.com/bitnami
1049-
version: ...
10501024
- name: wildfly
10511025
repository: http://docs.wildfly.org/wildfly-charts/
10521026
version: ...
10531027
----
10541028
1055-
So we need to update the dependecies of our Helm Chart.
1029+
So we need to update the dependencies of our Helm Chart.
10561030
10571031
[source,options="nowrap",subs="+attributes"]
10581032
----
@@ -1153,11 +1127,7 @@ name: todo-backend-chart
11531127
description: A Helm chart to deploy a WildFly todo-backend application and its Postgresql database
11541128
type: application
11551129
version: 1.0.0
1156-
appVersion: 31.0.0.Final
11571130
dependencies:
1158-
- name: postgresql
1159-
repository: https://charts.bitnami.com/bitnami
1160-
version: 16.2.2
11611131
- name: wildfly
11621132
repository: http://docs.wildfly.org/wildfly-charts/
11631133
version: 2.3.2

todo-backend/additional-readme-cloud.adoc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ For {additional-readme-cloud-platform}, we rely on secrets so that the credentia
2020
deploy:
2121
env:
2222
- name: POSTGRESQL_PASSWORD
23-
valueFrom:
24-
secretKeyRef:
25-
key: database-password
26-
name: todo-backend-db
23+
- name: POSTGRESQL_DATABASE
24+
valueFrom:
25+
configMapKeyRef:
26+
name: postgres-configmap
27+
key: POSTGRES_PASSWORD
2728
----
2829

29-
When the application is deployed, the value for the `POSTGRESQL_PASSWORD` will be taken from the key `database-password`
30-
in the secret `todo-backend-db`.
30+
When the application is deployed, the value for the `POSTGRESQL_PASSWORD` will be taken from the key `POSTGRES_PASSWORD`
31+
in the secret `postgres-configmap`.
3132

3233
ifdef::additional-readme-openshift[]
3334
== Use the todobackend Web Frontend

todo-backend/charts/Chart.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ name: todo-backend-chart
33
description: A Helm chart to deploy a WildFly todo-backend application and its Postgresql database
44
type: application
55
version: 1.0.0
6-
appVersion: 31.0.0.Final
76
dependencies:
8-
- name: postgresql
9-
repository: https://charts.bitnami.com/bitnami
10-
version: 16.2.2
117
- name: wildfly
128
repository: http://docs.wildfly.org/wildfly-charts/
139
version: 2.3.2
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: postgres-configmap
5+
labels:
6+
app: postgres
7+
data:
8+
POSTGRES_DB: {{ .Values.db.database }}
9+
POSTGRES_USER: {{ .Values.db.username }}
10+
POSTGRES_PASSWORD: {{ .Values.db.password }}
11+
PGDATA: /var/lib/postgresql/data/pgdata
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: todo-backend-postgresql
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: todo-backend-postgresql
10+
template:
11+
metadata:
12+
labels:
13+
app: todo-backend-postgresql
14+
spec:
15+
containers:
16+
- name: postgres
17+
image: postgres:17
18+
ports:
19+
- containerPort: 5432
20+
name: postgres
21+
envFrom:
22+
- configMapRef:
23+
name: postgres-configmap
24+
volumeMounts:
25+
- name: pgdata
26+
mountPath: /var/lib/postgresql/data
27+
volumes:
28+
- name: pgdata
29+
emptyDir: {}
30+
---
31+
apiVersion: v1
32+
kind: Service
33+
metadata:
34+
name: todo-backend-postgresql
35+
spec:
36+
ports:
37+
- port: 5432
38+
targetPort: postgres
39+
selector:
40+
app: todo-backend-postgresql

todo-backend/charts/values.yaml

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,10 @@
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

5-
postgresql:
6-
image:
7-
repository: bitnami/postgresql
8-
tag: 17
9-
auth:
10-
username: todos-db
11-
password: todos-db
12-
database: todos-db
13-
architecture: "standalone"
14-
primary:
15-
podSecurityContext:
16-
enabled: false
17-
fsGroup: "auto"
18-
containerSecurityContext:
19-
enabled: false
20-
runAsUser: "auto"
21-
runAsGroup: ""
22-
5+
db:
6+
username: todos-db
7+
password: todos-db
8+
database: todos-db
239

2410
wildfly:
2511
build:
@@ -31,11 +17,20 @@ wildfly:
3117
env:
3218
# Env vars to connect to PostgreSQL DB
3319
- name: POSTGRESQL_DATABASE
34-
value: todos-db
20+
valueFrom:
21+
configMapKeyRef:
22+
name: postgres-configmap
23+
key: POSTGRES_DB
3524
- name: POSTGRESQL_USER
36-
value: todos-db
25+
valueFrom:
26+
configMapKeyRef:
27+
name: postgres-configmap
28+
key: POSTGRES_USER
3729
- name: POSTGRESQL_PASSWORD
38-
value: todos-db
30+
valueFrom:
31+
configMapKeyRef:
32+
name: postgres-configmap
33+
key: POSTGRES_PASSWORD
3934
- name: POSTGRESQL_DATASOURCE
4035
value: ToDos
4136
- name: POSTGRESQL_SERVICE_HOST

todo-backend/helm-install-prerequisites.adoc

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
ifndef::ProductRelease[]
2-
Add the bitnami repository which provides an helm chart for PostgreSQL:
3-
[source,options="nowrap"]
4-
----
5-
$ helm repo add bitnami https://charts.bitnami.com/bitnami
6-
"bitnami" has been added to your repositories
7-
----
8-
9-
The Helm Chart for this quickstart contains all the information to build an image from the source code using S2I and install it with the database:
2+
The Helm Chart for this quickstart contains all the information to build an image from the source code using S2I.
3+
It also deploys the PostGreSQL database to store the data.
104

115
[source,options="nowrap"]
126
----
137
dependencies:
14-
- name: postgresql
15-
repository: https://charts.bitnami.com/bitnami
16-
version: ...
178
- name: wildfly
189
repository: http://docs.wildfly.org/wildfly-charts/
1910
version: ...
2011
----
2112

22-
So we need to update the dependecies of our Helm Chart.
13+
So we need to update the dependencies of our Helm Chart.
2314

2415
[source,options="nowrap",subs="+attributes"]
2516
----

0 commit comments

Comments
 (0)