-
Notifications
You must be signed in to change notification settings - Fork 64
RHDHBUGS-2625: Add procedure to configure Orchestrator to connect to … #2217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jmagak
wants to merge
2
commits into
redhat-developer:release-1.8
Choose a base branch
from
jmagak:RHDHBUGS-2625-1.8-Add-section-how-to-disable-SonataFlow-references-for-Orchestrator
base: release-1.8
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...e-orchestrator-to-connect-to-existing-postgresql-infrastructure-using-helm.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| :_mod-docs-content-type: PROCEDURE | ||
|
|
||
| [id="configure-orchestrator-to-connect-to-existing-postgresql-infrastructure-using-helm_{context}"] | ||
| = Configure Orchestrator to connect to existing PostgreSQL infrastructure using Helm | ||
|
|
||
| [role="_abstract"] | ||
| Connect the Orchestrator plugins to your existing PostgreSQL database when deploying with the Helm chart to leverage centralized database management and meet compliance requirements. | ||
|
|
||
| By default, when you enable the Orchestrator plugin by using the Helm chart with `orchestrator.enabled=true`, the chart automatically provisions a `SonataFlowPlatform` custom resource (CR) and creates the required PostgreSQL database resources. The chart uses the `orchestrator.sonataflowPlatform` values to configure these resources. | ||
|
|
||
| However, when you use an external PostgreSQL database that the Helm chart does not manage, you must explicitly configure the `orchestrator.sonataflowPlatform` values to reference your external database resources. | ||
|
|
||
| .Prerequisites | ||
| * You have installed {product-very-short} by using the Helm chart. | ||
| * You have {configuring-book-link}#proc-configuring-postgresql-instance-using-helm_configuring-external-postgresql-databases[configured {product-short} to use an external PostgreSQL database]. | ||
| * You have access to create jobs, secrets, services, and custom resources in the namespace where you deploy {product-very-short}. | ||
|
|
||
| .Procedure | ||
| include::../shared/snip-create-orchestrator-database.adoc[] | ||
| . Configure your external PostgreSQL database for Orchestrator in your Helm configuration file `values.yaml`: | ||
| + | ||
| [source,yaml,subs="+quotes,+attributes"] | ||
| ---- | ||
| orchestrator: | ||
| enabled: true | ||
| sonataflowPlatform: | ||
| externalDBsecretRef: __<SECRET-NAME-WITH-DB-CREDENTIALS>__ | ||
| externalDBName: backstage_plugin_orchestrator | ||
| externalDBHost: __<SERVICE-NAME-TO-DB>__ | ||
| externalDBPort: "5432" | ||
| ---- | ||
| + | ||
| Where: | ||
|
|
||
| `orchestrator.enabled`:: Set to `true` to enable the Orchestrator plugin. | ||
| `orchestrator.sonataflowPlatform.externalDBsecretRef`:: The secret name containing database credentials with `POSTGRES_USER`, `POSTGRES_PASSWORD`, `POSTGRES_HOST`, and `POSTGRES_PORT` keys. | ||
| `orchestrator.sonataflowPlatform.externalDBName`:: The database name for Orchestrator data (must be `backstage_plugin_orchestrator`). | ||
| `orchestrator.sonataflowPlatform.externalDBHost`:: The Kubernetes Service name pointing to your external database. | ||
| `orchestrator.sonataflowPlatform.externalDBPort`:: The PostgreSQL port (typically `5432`). | ||
| + | ||
| [IMPORTANT] | ||
| ==== | ||
| Unlike the default configuration where the Helm chart automatically provisions database resources, this configuration explicitly references your external database Service and Secret. The `SonataFlowPlatform` CR will use these resources to connect to your external database instead of creating new database resources. | ||
| ==== | ||
| + | ||
| . Apply the configuration changes in your Helm configuration file `values.yaml`: | ||
| + | ||
| [source,terminal,subs="+attributes"] | ||
| ---- | ||
| $ helm upgrade -n <your_namespace> <your_deploy_name> openshift-helm-charts/redhat-developer-hub -f values.yaml --version {product-chart-version} | ||
| ---- | ||
|
|
||
| .Verification | ||
| . Verify that the `SonataFlowPlatform` CR is running: | ||
| + | ||
| [source,terminal] | ||
| ---- | ||
| $ oc get sonataflowplatform sonataflow-platform -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' | ||
| True | ||
| ---- | ||
| + | ||
| . In the {product-very-short} console, confirm that the Orchestrator frontend and backend features are available and can connect to your external database. |
125 changes: 125 additions & 0 deletions
125
...oc-configure-orchestrator-to-connect-to-existing-postgresql-infrastructure.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| :_mod-docs-content-type: PROCEDURE | ||
|
|
||
| [id="configure-orchestrator-to-connect-to-existing-postgresql-infrastructure_{context}"] | ||
| = Configure Orchestrator to connect to existing PostgreSQL infrastructure | ||
|
|
||
| [role="_abstract"] | ||
| Connect the Orchestrator plugins to your existing PostgreSQL database to leverage centralized database management and meet compliance requirements. | ||
|
|
||
| By default, when you enable the Orchestrator plugin by using the Operator, the `dependencies: - ref: sonataflow` field automatically provisions a `SonataFlowPlatform` custom resource (CR) and creates the required PostgreSQL database resources. The Operator uses specific naming patterns for these resources (such as `backstage-psql-{{backstage-name}}` for the service and `backstage-psql-secret-{{backstage-name}}` for the secret). | ||
|
|
||
| However, when you use an external PostgreSQL database that the Operator does not manage, these default resources and naming patterns do not exist. You must explicitly configure the `SonataFlowPlatform` CR to reference your external database resources and remove the automatic dependency provisioning. | ||
|
|
||
| .Prerequisites | ||
| * You have installed {product-very-short} by using the Operator. | ||
| * You have {configuring-book-link}#proc-configuring-postgresql-instance-using-operator_configuring-external-postgresql-databases[configured {product-short} to use an external PostgreSQL database]. | ||
| * You have access to create jobs, secrets, config maps, and custom resources in the namespace where you deploy the {product-custom-resource-type} CR. | ||
|
|
||
| .Procedure | ||
| include::../shared/snip-create-orchestrator-database.adoc[] | ||
| . Create a `SonataFlowPlatform` CR that references your external PostgreSQL service: | ||
| + | ||
| [source,yaml,subs="+attributes,+quotes"] | ||
| ---- | ||
| apiVersion: sonataflow.org/v1alpha08 | ||
| kind: SonataFlowPlatform | ||
| metadata: | ||
| name: sonataflow-platform | ||
| spec: | ||
| monitoring: | ||
| enabled: true | ||
| services: | ||
| dataIndex: | ||
| enabled: true | ||
| persistence: | ||
| postgresql: | ||
| secretRef: | ||
| name: __<SECRET-NAME-WITH-DB-CREDENTIALS>__ | ||
| userKey: POSTGRES_USER | ||
| passwordKey: POSTGRES_PASSWORD | ||
| serviceRef: | ||
| name: __<SERVICE-NAME-TO-DB>__ | ||
| namespace: __<{product-very-short}-NAMESPACE>__ | ||
| databaseName: backstage_plugin_orchestrator | ||
| jobService: | ||
| enabled: true | ||
| persistence: | ||
| postgresql: | ||
| secretRef: | ||
| name: __<SECRET-NAME-WITH-DB-CREDENTIALS>__ | ||
| userKey: POSTGRES_USER | ||
| passwordKey: POSTGRES_PASSWORD | ||
| serviceRef: | ||
| name: __<SERVICE-NAME-TO-DB>__ | ||
| namespace: __<{product-very-short}-NAMESPACE>__ | ||
| databaseName: backstage_plugin_orchestrator | ||
| ---- | ||
| + | ||
| [IMPORTANT] | ||
| ==== | ||
| Unlike the default configuration that uses the `dependencies: - ref: sonataflow` field to automatically provision database resources with specific naming patterns, this configuration explicitly references your external database Service and Secret. The `SonataFlowPlatform` CR will use these resources to connect to your external database instead of creating new database resources. | ||
| ==== | ||
| + | ||
| . Configure the Orchestrator plugins in your dynamic plugins config map to remove the default `sonataflow` dependency and explicitly reference the SonataFlowPlatform services: | ||
| + | ||
| [source,yaml,subs="+attributes,+quotes"] | ||
| ---- | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: orchestrator-plugin | ||
| data: | ||
| dynamic-plugins.yaml: | | ||
| includes: | ||
| - dynamic-plugins.default.yaml | ||
| plugins: | ||
| # Orchestrator plugins | ||
| - package: "oci://registry.access.redhat.com/rhdh/red-hat-developer-hub-backstage-plugin-orchestrator:{{inherit}}" | ||
| disabled: false | ||
| - package: "oci://registry.access.redhat.com/rhdh/red-hat-developer-hub-backstage-plugin-orchestrator-backend:{{inherit}}" | ||
| disabled: false | ||
| pluginConfig: | ||
| orchestrator: | ||
| dataIndexService: | ||
| url: http://__<SERVICE-NAME-SONATAFLOW-PLATFORM-DATA-INDEX>__ | ||
| dependencies: [{}] # Empty array removes default 'ref: sonataflow' to prevent automatic database provisioning | ||
| - package: "oci://registry.access.redhat.com/rhdh/red-hat-developer-hub-backstage-plugin-scaffolder-backend-module-orchestrator:{{inherit}}" | ||
| disabled: false | ||
| pluginConfig: | ||
| orchestrator: | ||
| dataIndexService: | ||
| url: http://__<SERVICE-NAME-SONATAFLOW-PLATFORM-DATA-INDEX>__ | ||
| dependencies: [{}] # Empty array removes default 'ref: sonataflow' to prevent automatic database provisioning | ||
| - package: "oci://registry.access.redhat.com/rhdh/red-hat-developer-hub-backstage-plugin-orchestrator-form-widgets:{{inherit}}" | ||
| disabled: false | ||
| ---- | ||
| + | ||
| . Update your {product-custom-resource-type} CR to reference the orchestrator plugin config map and inject the database credentials secret: | ||
| + | ||
| [source,yaml,subs="+attributes,+quotes"] | ||
| ---- | ||
| apiVersion: rhdh.redhat.com/v1alpha5 | ||
| kind: {product-custom-resource-type} | ||
| metadata: | ||
| name: orchestrator | ||
| spec: | ||
| application: | ||
| appConfig: | ||
| configMaps: | ||
| - name: app-config-rhdh | ||
| dynamicPluginsConfigMapName: orchestrator-plugin | ||
| extraEnvs: | ||
| secrets: | ||
| - name: __<SECRET-NAME-WITH-DB-CREDENTIALS>__ | ||
| ---- | ||
|
|
||
| .Verification | ||
| . Verify that the `SonataFlowPlatform` CR is running: | ||
| + | ||
| [source,terminal] | ||
| ---- | ||
| $ oc get sonataflowplatform sonataflow-platform -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' | ||
| True | ||
| ---- | ||
| + | ||
| . In the {product-very-short} console, confirm that the Orchestrator frontend and backend features are available and can connect to your external database. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
modules/shared/snip-create-kubernetes-service-for-external-postgresql.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| :_mod-docs-content-type: SNIPPET | ||
| . Create a Kubernetes service that points to your external PostgreSQL database: | ||
| + | ||
| [source,yaml,subs="+attributes,+quotes"] | ||
| ---- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: external-postgresql-service | ||
| spec: | ||
| type: ExternalName | ||
| externalName: __<your-external-db-host-name>__ | ||
| ports: | ||
| - port: 5432 | ||
| targetPort: 5432 | ||
| protocol: TCP | ||
| ---- | ||
| + | ||
| Where: | ||
|
|
||
| `external-postgresql-service`:: Name of the service to reference in plugin configurations. | ||
| `ExternalName`:: Service type that creates a CNAME record to the external database host name. | ||
| `__<your-external-db-host-name>__`:: FQDN of your external PostgreSQL server, for example, `postgres.example.com`. | ||
| + | ||
| [NOTE] | ||
| ==== | ||
| If your external database is outside the cluster or uses an IP address instead of a host name, create a service with endpoints: | ||
|
|
||
| [source,yaml,subs="+attributes,+quotes"] | ||
| ---- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: external-postgresql-service | ||
| spec: | ||
| ports: | ||
| - port: 5432 | ||
| targetPort: 5432 | ||
| protocol: TCP | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Endpoints | ||
| metadata: | ||
| name: external-postgresql-service | ||
| subsets: | ||
| - addresses: | ||
| - ip: __<your-external-db-ip>__ | ||
| ports: | ||
| - port: 5432 | ||
| protocol: TCP | ||
| ---- | ||
|
|
||
| Where: | ||
|
|
||
| `__<your-external-db-ip>__`:: IP address of your external PostgreSQL server. | ||
| ==== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| :_mod-docs-content-type: SNIPPET | ||
| . Create the `backstage_plugin_orchestrator` database on your external PostgreSQL server by applying the following job: | ||
| + | ||
| [source,yaml,subs="+attributes,+quotes"] | ||
| ---- | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: create-sonataflow-database-developer-hub | ||
| spec: | ||
| ttlSecondsAfterFinished: 30 | ||
| activeDeadlineSeconds: 120 | ||
| template: | ||
| spec: | ||
| containers: | ||
| - name: psql | ||
| image: quay.io/fedora/postgresql-15:latest | ||
| resources: | ||
| limits: | ||
| cpu: "100m" | ||
| memory: "128Mi" | ||
| requests: | ||
| cpu: "100m" | ||
| memory: "64Mi" | ||
| securityContext: | ||
| readOnlyRootFilesystem: true | ||
| allowPrivilegeEscalation: false | ||
| runAsNonRoot: true | ||
| capabilities: | ||
| drop: | ||
| - ALL | ||
| envFrom: | ||
| - secretRef: | ||
| name: __<SECRET-NAME-WITH-DB-CREDENTIALS>__ | ||
| command: [ "sh", "-c" ] | ||
| args: | ||
| - | | ||
| set -e | ||
| # Check if the backstage_plugin_orchestrator database exists | ||
| DB_EXISTS=$(PGPASSWORD=${POSTGRES_PASSWORD} psql -h ${POSTGRES_HOST} -p ${POSTGRES_PORT} -U ${POSTGRES_USER} -tAc "SELECT 1 FROM pg_database WHERE datname='backstage_plugin_orchestrator'" postgres) | ||
| if [ -z "$DB_EXISTS" ]; then | ||
| # Create the database if it does not exist | ||
| PGPASSWORD=${POSTGRES_PASSWORD} psql -h ${POSTGRES_HOST} -p ${POSTGRES_PORT} -U ${POSTGRES_USER} -c "CREATE DATABASE backstage_plugin_orchestrator;" postgres | ||
| fi | ||
| restartPolicy: Never | ||
| ---- |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.