Use external IP for the servicemanager configuration if available 58/15158/2
authoraravind.est <aravindhan.a@est.tech>
Thu, 16 Oct 2025 17:05:33 +0000 (18:05 +0100)
committeraravind.est <aravindhan.a@est.tech>
Thu, 16 Oct 2025 17:18:58 +0000 (18:18 +0100)
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 <aravindhan.a@est.tech>
smo-install/scripts/sub-scripts/servicemanager-preload.sh

index 4356071..6012f2b 100755 (executable)
@@ -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