@@ -1301,12 +1301,14 @@ deploy_orchestrator_workflows() {
13011301 local pqsl_password_key=" POSTGRES_PASSWORD"
13021302 local pqsl_svc_name=" postgress-external-db-primary"
13031303 local patch_namespace=" ${NAME_SPACE_POSTGRES_DB} "
1304+ local release_name=" ${RELEASE_NAME_RBAC} "
13041305 else
13051306 local pqsl_secret_name=" rhdh-postgresql-svcbind-postgres"
13061307 local pqsl_user_key=" username"
13071308 local pqsl_password_key=" password"
13081309 local pqsl_svc_name=" rhdh-postgresql"
13091310 local patch_namespace=" $namespace "
1311+ local release_name=" ${RELEASE_NAME} "
13101312 fi
13111313
13121314 oc apply -f " ${WORKFLOW_MANIFESTS} "
@@ -1319,9 +1321,54 @@ deploy_orchestrator_workflows() {
13191321 sleep 5
13201322 done
13211323
1324+ echo " Updating user-onboarding secret with dynamic service URLs..."
1325+ # Update the user-onboarding secret with correct service URLs
1326+ local onboarding_server_url=" http://user-onboarding-server.${namespace} :8080"
1327+
1328+ # Dynamically determine the backstage service (excluding psql)
1329+ local backstage_service
1330+ backstage_service=$( oc get svc -l app.kubernetes.io/name=developer-hub -n " $namespace " --no-headers=true | grep -v psql | awk ' {print $1}' | head -1)
1331+ if [[ -z " $backstage_service " ]]; then
1332+ echo " Warning: No backstage service found, using fallback"
1333+ backstage_service=" backstage-rhdh"
1334+ fi
1335+ local backstage_notifications_url=" http://${backstage_service} .${namespace} :80"
1336+
1337+ # Get the notifications bearer token from rhdh-secrets
1338+ local notifications_bearer_token
1339+ notifications_bearer_token=$( oc get secret " $release_name " -auth -n " $namespace " -o json | jq ' .data."backend-secret"' -r | base64 -d)
1340+ if [[ -z " $notifications_bearer_token " ]]; then
1341+ echo " Warning: No BACKEND_SECRET found in rhdh-secrets, using empty token"
1342+ notifications_bearer_token=" "
1343+ fi
1344+
1345+ # Base64 encode the URLs and token
1346+ local onboarding_server_url_b64
1347+ onboarding_server_url_b64=$( echo -n " $onboarding_server_url " | base64 -w 0)
1348+ local backstage_notifications_url_b64
1349+ backstage_notifications_url_b64=$( echo -n " $backstage_notifications_url " | base64 -w 0)
1350+ local notifications_bearer_token_b64
1351+ notifications_bearer_token_b64=$( echo -n " $notifications_bearer_token " | base64 -w 0)
1352+
1353+ # Patch the secret
1354+ oc patch secret user-onboarding-creds -n " $namespace " --type merge -p " {
1355+ \" data\" : {
1356+ \" ONBOARDING_SERVER_URL\" : \" $onboarding_server_url_b64 \" ,
1357+ \" BACKSTAGE_NOTIFICATIONS_URL\" : \" $backstage_notifications_url_b64 \" ,
1358+ \" NOTIFICATIONS_BEARER_TOKEN\" : \" $notifications_bearer_token_b64 \"
1359+ }
1360+ }"
1361+ echo " User-onboarding secret updated successfully!"
1362+
13221363 for workflow in greeting user-onboarding; do
13231364 oc -n " $namespace " patch sonataflow " $workflow " --type merge -p " {\" spec\" : { \" persistence\" : { \" postgresql\" : { \" secretRef\" : {\" name\" : \" $pqsl_secret_name \" ,\" userKey\" : \" $pqsl_user_key \" ,\" passwordKey\" : \" $pqsl_password_key \" },\" serviceRef\" : {\" name\" : \" $pqsl_svc_name \" ,\" namespace\" : \" $patch_namespace \" }}}}}"
13241365 done
1366+
1367+ echo " Waiting for all workflow pods to be running..."
1368+ wait_for_deployment $namespace greeting 5
1369+ wait_for_deployment $namespace user-onboarding 5
1370+
1371+ echo " All workflow pods are now running!"
13251372}
13261373
13271374# Helper function to deploy workflows for orchestrator testing
0 commit comments