@@ -1123,12 +1123,14 @@ deploy_orchestrator_workflows() {
11231123 local pqsl_password_key=" POSTGRES_PASSWORD"
11241124 local pqsl_svc_name=" postgress-external-db-primary"
11251125 local patch_namespace=" ${NAME_SPACE_POSTGRES_DB} "
1126+ local release_name=" ${RELEASE_NAME_RBAC} "
11261127 else
11271128 local pqsl_secret_name=" rhdh-postgresql-svcbind-postgres"
11281129 local pqsl_user_key=" username"
11291130 local pqsl_password_key=" password"
11301131 local pqsl_svc_name=" rhdh-postgresql"
11311132 local patch_namespace=" $namespace "
1133+ local release_name=" ${RELEASE_NAME} "
11321134 fi
11331135
11341136 oc apply -f " ${WORKFLOW_MANIFESTS} "
@@ -1141,9 +1143,54 @@ deploy_orchestrator_workflows() {
11411143 sleep 5
11421144 done
11431145
1146+ echo " Updating user-onboarding secret with dynamic service URLs..."
1147+ # Update the user-onboarding secret with correct service URLs
1148+ local onboarding_server_url=" http://user-onboarding-server.${namespace} :8080"
1149+
1150+ # Dynamically determine the backstage service (excluding psql)
1151+ local backstage_service
1152+ 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)
1153+ if [[ -z " $backstage_service " ]]; then
1154+ echo " Warning: No backstage service found, using fallback"
1155+ backstage_service=" backstage-rhdh"
1156+ fi
1157+ local backstage_notifications_url=" http://${backstage_service} .${namespace} :80"
1158+
1159+ # Get the notifications bearer token from rhdh-secrets
1160+ local notifications_bearer_token
1161+ notifications_bearer_token=$( oc get secret " $release_name " -auth -n " $namespace " -o json | jq ' .data."backend-secret"' -r | base64 -d)
1162+ if [[ -z " $notifications_bearer_token " ]]; then
1163+ echo " Warning: No BACKEND_SECRET found in rhdh-secrets, using empty token"
1164+ notifications_bearer_token=" "
1165+ fi
1166+
1167+ # Base64 encode the URLs and token
1168+ local onboarding_server_url_b64
1169+ onboarding_server_url_b64=$( echo -n " $onboarding_server_url " | base64 -w 0)
1170+ local backstage_notifications_url_b64
1171+ backstage_notifications_url_b64=$( echo -n " $backstage_notifications_url " | base64 -w 0)
1172+ local notifications_bearer_token_b64
1173+ notifications_bearer_token_b64=$( echo -n " $notifications_bearer_token " | base64 -w 0)
1174+
1175+ # Patch the secret
1176+ oc patch secret user-onboarding-creds -n " $namespace " --type merge -p " {
1177+ \" data\" : {
1178+ \" ONBOARDING_SERVER_URL\" : \" $onboarding_server_url_b64 \" ,
1179+ \" BACKSTAGE_NOTIFICATIONS_URL\" : \" $backstage_notifications_url_b64 \" ,
1180+ \" NOTIFICATIONS_BEARER_TOKEN\" : \" $notifications_bearer_token_b64 \"
1181+ }
1182+ }"
1183+ echo " User-onboarding secret updated successfully!"
1184+
11441185 for workflow in greeting user-onboarding; do
11451186 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 \" }}}}}"
11461187 done
1188+
1189+ echo " Waiting for all workflow pods to be running..."
1190+ wait_for_deployment $namespace greeting 5
1191+ wait_for_deployment $namespace user-onboarding 5
1192+
1193+ echo " All workflow pods are now running!"
11471194}
11481195
11491196# Helper function to deploy workflows for orchestrator testing
0 commit comments