Skip to content

Commit ae40cf6

Browse files
authored
fix(gateway): respect OPENSHELL_BIND_ADDRESS in dev task (#2756)
This is convenient when you want to run a local gateway pointed at a remote compute driver so that the supervisor can reach across the network to the gateway which is listening on 0.0.0.0. Signed-off-by: Kris Hicks <khicks@nvidia.com>
1 parent bdabb54 commit ae40cf6

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎tasks/scripts/gateway.sh‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Options:
3535
Environment:
3636
OPENSHELL_DRIVERS Driver override used by openshell-gateway.
3737
OPENSHELL_GATEWAY_NAME Gateway name for generic podman/kubernetes runs.
38+
OPENSHELL_BIND_ADDRESS Gateway listener address. Defaults to 127.0.0.1,
39+
or ::1 for Podman Machine on macOS.
3840
OPENSHELL_SERVER_PORT Gateway port. Defaults to 8080 for Kubernetes,
3941
18080 for Podman/Docker, and 18081 for VM.
4042
OPENSHELL_SUPERVISOR_IMAGE
@@ -300,13 +302,16 @@ SANDBOX_IMAGE="${OPENSHELL_SANDBOX_IMAGE:-ghcr.io/nvidia/openshell-community/san
300302
SANDBOX_IMAGE_PULL_POLICY="${OPENSHELL_SANDBOX_IMAGE_PULL_POLICY:-IfNotPresent}"
301303
GRPC_ENDPOINT="${OPENSHELL_GRPC_ENDPOINT:-}"
302304
LOG_LEVEL="${OPENSHELL_LOG_LEVEL:-info}"
303-
PRIMARY_BIND_IP="127.0.0.1"
305+
PRIMARY_BIND_IP="${OPENSHELL_BIND_ADDRESS:-127.0.0.1}"
304306
CLI_ENDPOINT_HOST="127.0.0.1"
305307

306-
if [[ "${DRIVER}" == "podman" && "$(uname -s)" == "Darwin" ]]; then
308+
if [[ -z "${OPENSHELL_BIND_ADDRESS:-}" \
309+
&& "${DRIVER}" == "podman" \
310+
&& "$(uname -s)" == "Darwin" ]]; then
307311
# Podman Machine reserves IPv4 loopback for its callback-only listener.
308312
# Keep the primary listener distinct while using a hostname that resolves
309-
# to IPv6 loopback for local CLI connections.
313+
# to IPv6 loopback for local CLI connections. An explicit bind address
314+
# overrides this platform default.
310315
PRIMARY_BIND_IP="::1"
311316
CLI_ENDPOINT_HOST="localhost"
312317
fi
@@ -437,6 +442,7 @@ register_gateway_metadata "${GATEWAY_NAME}" "${GATEWAY_ENDPOINT}" "${PORT}"
437442
echo "Starting standalone ${DRIVER} gateway..."
438443
echo " gateway: ${GATEWAY_NAME}"
439444
echo " endpoint: ${GATEWAY_ENDPOINT}"
445+
echo " bind: ${PRIMARY_BIND_IP}:${PORT}"
440446
echo " namespace: ${SANDBOX_NAMESPACE}"
441447
echo " state dir: ${STATE_DIR}"
442448
if [[ "${DRIVER}" == "podman" ]]; then

0 commit comments

Comments
 (0)