@@ -1218,6 +1218,45 @@ deploy_orchestrator_workflows() {
12181218 sleep 5
12191219 done
12201220
1221+ echo " Updating user-onboarding secret with dynamic service URLs..."
1222+ # Update the user-onboarding secret with correct service URLs
1223+ local onboarding_server_url=" http://user-onboarding-server.${namespace} :8080"
1224+
1225+ # Dynamically determine the backstage service (excluding psql)
1226+ local backstage_service
1227+ 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)
1228+ if [[ -z " $backstage_service " ]]; then
1229+ echo " Warning: No backstage service found, using fallback"
1230+ backstage_service=" backstage-rhdh"
1231+ fi
1232+ local backstage_notifications_url=" http://${backstage_service} .${namespace} :80"
1233+
1234+ # Get the notifications bearer token from rhdh-secrets
1235+ local notifications_bearer_token
1236+ notifications_bearer_token=$( oc get secret " $RELEASE_NAME " -auth -n " $namespace " -o json | jq ' .data.backend-secret' -r | base64 -d)
1237+ if [[ -z " $notifications_bearer_token " ]]; then
1238+ echo " Warning: No BACKEND_SECRET found in rhdh-secrets, using empty token"
1239+ notifications_bearer_token=" "
1240+ fi
1241+
1242+ # Base64 encode the URLs and token
1243+ local onboarding_server_url_b64
1244+ onboarding_server_url_b64=$( echo -n " $onboarding_server_url " | base64 -w 0)
1245+ local backstage_notifications_url_b64
1246+ backstage_notifications_url_b64=$( echo -n " $backstage_notifications_url " | base64 -w 0)
1247+ local notifications_bearer_token_b64
1248+ notifications_bearer_token_b64=$( echo -n " $notifications_bearer_token " | base64 -w 0)
1249+
1250+ # Patch the secret
1251+ oc patch secret user-onboarding-creds -n " $namespace " --type merge -p " {
1252+ \" data\" : {
1253+ \" ONBOARDING_SERVER_URL\" : \" $onboarding_server_url_b64 \" ,
1254+ \" BACKSTAGE_NOTIFICATIONS_URL\" : \" $backstage_notifications_url_b64 \" ,
1255+ \" NOTIFICATIONS_BEARER_TOKEN\" : \" $notifications_bearer_token_b64 \"
1256+ }
1257+ }"
1258+ echo " User-onboarding secret updated successfully!"
1259+
12211260 for workflow in greeting user-onboarding; do
12221261 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 \" }}}}}"
12231262 done
0 commit comments