From 05cee58e069d322eb43e338b85427b65ffc64038 Mon Sep 17 00:00:00 2001 From: "aravind.est" Date: Thu, 16 Oct 2025 18:05:33 +0100 Subject: [PATCH] Use external IP for the servicemanager configuration if available Servicemanager pre-configuration script modified to use the externalIP address if available. This is useful for the cloud environments where the externalIP address is accessible. As a fallback it uses the internalIP as well which works for the local environments. Also using the InternalIP was the existing behaviour. Issue-ID: NONRTRIC-1082 Change-Id: I3ad58f41e8ac5eaaaa12a02ab54470bdc62a81d8 Signed-off-by: aravind.est --- smo-install/scripts/sub-scripts/servicemanager-preload.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/smo-install/scripts/sub-scripts/servicemanager-preload.sh b/smo-install/scripts/sub-scripts/servicemanager-preload.sh index 43560715..6012f2bf 100755 --- a/smo-install/scripts/sub-scripts/servicemanager-preload.sh +++ b/smo-install/scripts/sub-scripts/servicemanager-preload.sh @@ -1,7 +1,7 @@ #!/bin/bash ################################################################################ -# Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved. # +# Copyright (C) 2024-2025 OpenInfra Foundation Europe. All rights reserved. # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -372,8 +372,18 @@ json_config=$(yq eval "$yaml_file" -o=json) echo "Preloading Service Manager from ${yaml_file}" # Get our Node IP and nodePort -first_node_ip=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}') servicemanager_node_port=$(kubectl get service servicemanager -n nonrtric -o jsonpath='{.spec.ports[0].nodePort}') +first_node_ip=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="ExternalIP")].address}') +if [ -z "$first_node_ip" ]; then + echo "ExternalIP not found, using InternalIP" + first_node_ip=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}') +else + echo "Using ExternalIP ($first_node_ip) for Service Manager access" + echo "Ensure the NodePort ($servicemanager_node_port) on node ($first_node_ip) is accessible from this machine" + echo "If the port is not accessible, the publish action will hang on curl timeout" +fi + +echo "Service Manager will be accessed at: http://${first_node_ip}:${servicemanager_node_port}" publish_services_from_config -- 2.16.6