Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/backstage/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ sources: []
# Versions are expected to follow Semantic Versioning (https://semver.org/)
# Note that when this chart is published to https://github.com/openshift-helm-charts/charts
# it will follow the RHDH versioning 1.y.z
version: 4.2.9
version: 4.2.10
13 changes: 11 additions & 2 deletions charts/backstage/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# RHDH Backstage Helm Chart for OpenShift (Community Version)

![Version: 4.2.9](https://img.shields.io/badge/Version-4.2.9-informational?style=flat-square)
![Version: 4.2.10](https://img.shields.io/badge/Version-4.2.10-informational?style=flat-square)
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

Red Hat Developer Hub is a Red Hat supported version of Backstage.
Expand Down Expand Up @@ -187,7 +187,9 @@ Kubernetes: `>= 1.27.0-0`
| orchestrator.sonataflowPlatform.createDBJobImage | Image for the container used by the create-db job | string | `"{{ .Values.upstream.postgresql.image.registry }}/{{ .Values.upstream.postgresql.image.repository }}:{{ .Values.upstream.postgresql.image.tag }}"` |
| orchestrator.sonataflowPlatform.eventing.broker.name | | string | `""` |
| orchestrator.sonataflowPlatform.eventing.broker.namespace | | string | `""` |
| orchestrator.sonataflowPlatform.externalDBHost | Host for the user-configured external Database | string | `""` |
| orchestrator.sonataflowPlatform.externalDBName | Name for the user-configured external Database | string | `""` |
| orchestrator.sonataflowPlatform.externalDBPort | Port for the user-configured external Database | string | `""` |
| orchestrator.sonataflowPlatform.externalDBsecretRef | Secret name for the user-created secret to connect an external DB | string | `""` |
| orchestrator.sonataflowPlatform.initContainerImage | Image for the init container used by the create-db job | string | `"{{ .Values.upstream.postgresql.image.registry }}/{{ .Values.upstream.postgresql.image.repository }}:{{ .Values.upstream.postgresql.image.tag }}"` |
| orchestrator.sonataflowPlatform.monitoring.enabled | | bool | `true` |
Expand Down Expand Up @@ -373,13 +375,20 @@ and populate the following values in the values.yaml:
```bash
externalDBsecretRef: <cred-secret>
externalDBName: ""
externalDBHost: ""
externalDBPort: ""
```
The values for externalDBHost and externalDBPort should match the ones configured in the cred-secret.

Please note that `externalDBName` is the name of the user-configured existing database, not the database that the orchestrator and sonataflow resources will use.
A Job will run to create the 'sonataflow' database in the external database for the workflows to use.

Finally, install the Helm Chart (including [setting up the external DB](https://github.com/redhat-developer/rhdh-chart/blob/main/docs/external-db.md)):
```
helm install <release_name> redhat-developer/backstage \
--set orchestrator.enabled=true \
--set orchestrator.sonataflowPlatform.externalDBsecretRef=<cred-secret> \
--set orchestrator.sonataflowPlatform.externalDBName=example
--set orchestrator.sonataflowPlatform.externalDBName=example \
--set orchestrator.sonataflowPlatform.externalDBHost=example \
--set orchestrator.sonataflowPlatform.externalDBPort=example
```
9 changes: 8 additions & 1 deletion charts/backstage/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,20 @@ and populate the following values in the values.yaml:
```bash
externalDBsecretRef: <cred-secret>
externalDBName: ""
externalDBHost: ""
externalDBPort: ""
```
The values for externalDBHost and externalDBPort should match the ones configured in the cred-secret.

Please note that `externalDBName` is the name of the user-configured existing database, not the database that the orchestrator and sonataflow resources will use.
A Job will run to create the 'sonataflow' database in the external database for the workflows to use.

Finally, install the Helm Chart (including [setting up the external DB](https://github.com/redhat-developer/rhdh-chart/blob/main/docs/external-db.md)):
```
helm install <release_name> redhat-developer/backstage \
--set orchestrator.enabled=true \
--set orchestrator.sonataflowPlatform.externalDBsecretRef=<cred-secret> \
--set orchestrator.sonataflowPlatform.externalDBName=example
--set orchestrator.sonataflowPlatform.externalDBName=example \
--set orchestrator.sonataflowPlatform.externalDBHost=example \
--set orchestrator.sonataflowPlatform.externalDBPort=example
```
86 changes: 60 additions & 26 deletions charts/backstage/templates/sonataflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
enabled: true
persistence:
postgresql:
{{- if .Values.upstream.postgresql.enabled }}
{{- if .Values.upstream.postgresql.enabled }}
secretRef:
name: {{ .Release.Name }}-postgresql-svcbind-postgres
userKey: username
Expand All @@ -44,23 +44,23 @@ spec:
name: {{ .Release.Name }}-postgresql
namespace: {{ .Release.Namespace }}
databaseName: sonataflow
{{- else }}
{{- else }}
secretRef:
name: {{ .Values.orchestrator.sonataflowPlatform.externalDBsecretRef }}
userKey: POSTGRES_USER
passwordKey: POSTGRES_PASSWORD
jdbcUrl: jdbc:postgresql://{{ .Values.upstream.backstage.appConfig.backend.database.connection.host}}:{{ .Values.upstream.backstage.appConfig.backend.database.connection.port}}/sonataflow?currentSchema=data-index-service
{{- end }}
{{- if .Values.orchestrator.sonataflowPlatform.dataIndexImage }}
jdbcUrl: jdbc:postgresql://{{ .Values.orchestrator.sonataflowPlatform.externalDBHost }}:{{ .Values.orchestrator.sonataflowPlatform.externalDBPort }}/sonataflow?currentSchema=data-index-service
{{- end }}
{{- if .Values.orchestrator.sonataflowPlatform.dataIndexImage }}
podTemplate:
container:
image: {{ .Values.orchestrator.sonataflowPlatform.dataIndexImage }}
{{- end }}
{{- end }}
jobService:
enabled: true
persistence:
postgresql:
{{- if .Values.upstream.postgresql.enabled }}
{{- if .Values.upstream.postgresql.enabled }}
secretRef:
name: {{ .Release.Name }}-postgresql-svcbind-postgres
userKey: username
Expand All @@ -69,25 +69,26 @@ spec:
name: {{ .Release.Name }}-postgresql
namespace: {{ .Release.Namespace }}
databaseName: sonataflow
{{- else }}
{{- else }}
secretRef:
name: {{ .Values.orchestrator.sonataflowPlatform.externalDBsecretRef}}
name: {{ .Values.orchestrator.sonataflowPlatform.externalDBsecretRef }}
userKey: POSTGRES_USER
passwordKey: POSTGRES_PASSWORD
jdbcUrl: jdbc:postgresql://{{ .Values.upstream.backstage.appConfig.backend.database.connection.host}}:{{ .Values.upstream.backstage.appConfig.backend.database.connection.port}}/sonataflow?currentSchema=jobs-service
{{- end }}
{{- if .Values.orchestrator.sonataflowPlatform.jobServiceImage }}
jdbcUrl: jdbc:postgresql://{{ .Values.orchestrator.sonataflowPlatform.externalDBHost }}:{{ .Values.orchestrator.sonataflowPlatform.externalDBPort }}/sonataflow?currentSchema=jobs-service
{{- end }}
{{- if .Values.orchestrator.sonataflowPlatform.jobServiceImage }}
podTemplate:
container:
image: {{ .Values.orchestrator.sonataflowPlatform.jobServiceImage }}
{{- end }}
{{- end }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Release.Name }}-create-sonataflow-database
namespace: {{ .Release.Namespace }}
spec:
activeDeadlineSeconds: 120
template:
spec:
initContainers:
Expand All @@ -111,17 +112,31 @@ spec:
- bash
- -c
- |
{{- if .Values.upstream.postgresql.enabled }}
{{- if .Values.upstream.postgresql.enabled }}
dbHost="{{ .Release.Name }}-postgresql"
dbPort="5432"
{{- else }}
dbHost="{{ .Values.upstream.backstage.appConfig.backend.database.connection.host }}"
dbPort="{{ .Values.upstream.backstage.appConfig.backend.database.connection.port }}"
{{- end }}
until timeout --preserve-status --kill-after=3 2 bash -c ">/dev/tcp/${dbHost}/${dbPort}"; do
{{- else }}
dbHost=${POSTGRES_HOST}
dbPort=${POSTGRES_PORT}
{{- end }}
until timeout 2 bash -c ">/dev/tcp/$dbHost/$dbPort"; do
echo 'Waiting for DB...'
sleep 2
done
echo 'Connection made!'
{{- if not .Values.upstream.postgresql.enabled }}
env:
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: {{ .Values.orchestrator.sonataflowPlatform.externalDBsecretRef }}
key: POSTGRES_HOST
- name: POSTGRES_PORT
valueFrom:
secretKeyRef:
name: {{ .Values.orchestrator.sonataflowPlatform.externalDBsecretRef }}
key: POSTGRES_PORT
{{- end }}
containers:
- name: psql
image: "{{- tpl .Values.orchestrator.sonataflowPlatform.createDBJobImage . -}}"
Expand All @@ -140,22 +155,41 @@ spec:
drop:
- ALL
env:
{{- if .Values.upstream.postgresql.enabled }}
- name: PGPASSWORD
valueFrom:
{{- if .Values.upstream.postgresql.enabled }}
secretKeyRef:
name: {{ .Release.Name }}-postgresql-svcbind-postgres
key: password
{{- else }}
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: {{ .Values.orchestrator.sonataflowPlatform.externalDBsecretRef }}
key: POSTGRES_HOST
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ .Values.orchestrator.sonataflowPlatform.externalDBsecretRef }}
key: POSTGRES_USER
- name: POSTGRES_PORT
valueFrom:
secretKeyRef:
name: {{ .Values.orchestrator.sonataflowPlatform.externalDBsecretRef }}
key: POSTGRES_PORT
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.orchestrator.sonataflowPlatform.externalDBsecretRef }}
key: POSTGRES_PASSWORD
{{- end }}
command: [ "sh", "-c" ]
{{- if .Values.upstream.postgresql.enabled }}
args:
- "psql -h {{ .Release.Name }}-postgresql -U postgres -c 'CREATE DATABASE sonataflow;' || echo WARNING: Could not create database"
- "psql -h {{ .Release.Name }}-postgresql -p 5432 -U postgres -c 'CREATE DATABASE sonataflow;' || echo WARNING: Could not create database"
{{- else }}
secretKeyRef:
name: {{ .Values.orchestrator.sonataflowPlatform.externalDBsecretRef}}
key: POSTGRES_PASSWORD
command: [ "sh", "-c" ]
args:
- "psql -h {{ .Values.upstream.backstage.appConfig.backend.database.connection.host }} -U {{ .Values.upstream.backstage.appConfig.backend.database.connection.user }} -d {{ .Values.orchestrator.sonataflowPlatform.externalDBName }} -c 'CREATE DATABASE sonataflow;' || echo WARNING: Could not create database"
- "psql -h ${POSTGRES_HOST} -p ${POSTGRES_PORT} -U ${POSTGRES_USER} -d {{ .Values.orchestrator.sonataflowPlatform.externalDBName }} -c 'CREATE DATABASE sonataflow;' || echo WARNING: Could not create database"
{{- end }}
restartPolicy: Never
backoffLimit: 2
Expand Down
10 changes: 10 additions & 0 deletions charts/backstage/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,21 @@
"title": "eventing configuration",
"type": "object"
},
"externalDBHost": {
"additionalProperties": false,
"title": "Host for the user-configured external Database",
"type": "string"
},
"externalDBName": {
"additionalProperties": false,
"title": "Name for the user-configured external Database",
"type": "string"
},
"externalDBPort": {
"additionalProperties": false,
"title": "Port for the user-configured external Database",
"type": "string"
},
"externalDBsecretRef": {
"additionalProperties": false,
"title": "Secret name for the user-created secret to connect an external DB",
Expand Down
10 changes: 10 additions & 0 deletions charts/backstage/values.schema.tmpl.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,16 @@
"type": "string",
"additionalProperties": false
},
"externalDBHost": {
"title": "Host for the user-configured external Database",
"type": "string",
"additionalProperties": false
},
"externalDBPort": {
"title": "Port for the user-configured external Database",
"type": "string",
"additionalProperties": false
},
"initContainerImage": {
"title": "Image for the init container used by the create-db job",
"type": "string",
Expand Down
6 changes: 6 additions & 0 deletions charts/backstage/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,12 @@ orchestrator:
# -- Name for the user-configured external Database
externalDBName: ""

# -- Host for the user-configured external Database
externalDBHost: ""

# -- Port for the user-configured external Database
externalDBPort: ""

Comment thread
rm3l marked this conversation as resolved.
# -- Image for the init container used by the create-db job
initContainerImage: "{{ .Values.upstream.postgresql.image.registry }}/{{ .Values.upstream.postgresql.image.repository }}:{{ .Values.upstream.postgresql.image.tag }}"

Expand Down
Loading