From a2a2b25e4491df96224c5f5f3f207945c18f8348 Mon Sep 17 00:00:00 2001 From: Matan Schatzman Date: Mon, 10 Feb 2025 08:45:51 +0200 Subject: [PATCH 1/2] Fixing start script to work on mac Signed-off-by: Matan Schatzman --- ci/start-console.sh | 40 ++++++++++++------- packages/forklift-console-plugin/package.json | 2 +- .../forklift-console-plugin/webpack.config.ts | 4 +- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/ci/start-console.sh b/ci/start-console.sh index 08b0c27a9..720b8de3e 100755 --- a/ci/start-console.sh +++ b/ci/start-console.sh @@ -7,23 +7,34 @@ source ${script_dir}/configure/openshift.sh CONSOLE_CONTAINER_NAME=okd-console FORKLIFT_NAMESPACE=konveyor-forklift +BASE_HOST_URL="https://localhost" + PLUGIN_NAME="forklift-console-plugin" -PLUGIN_URL=${PLUGIN_URL:-"http://localhost:9001"} -CONTAINER_NETWORK_TYPE=${CONTAINER_NETWORK_TYPE:-"host"} -CONSOLE_IMAGE=${CONSOLE_IMAGE:-"quay.io/openshift/origin-console:latest"} -CONSOLE_PORT=${CONSOLE_PORT:-9000} +PLUGIN_URL="http://localhost:9001" + +CONTAINER_NETWORK="--network=host" + +CONSOLE_IMAGE="quay.io/openshift/origin-console:latest" +CONSOLE_PORT="9000" + +# On macOS +if [[ $(uname) = "Darwin" ]]; then + BASE_HOST_URL="http://host.containers.internal" + CONTAINER_NETWORK="" + PLUGIN_URL="$BASE_HOST_URL:9001" +fi + +# Default to localhost +INVENTORY_SERVER_HOST="$BASE_HOST_URL:30444" +SERVICES_API_SERVER_HOST="$BASE_HOST_URL:30446" # Look for forklift routes if oc_available_loggedin; then routes=$(oc get routes -A -o template --template='{{range .items}}{{.spec.host}}{{"\n"}}{{end}}' 2>/dev/null || true) - INVENTORY_SERVER_HOST=${INVENTORY_SERVER_HOST:-$(echo "$routes" | grep forklift-inventory || true)} - SERVICES_API_SERVER_HOST=${SERVICES_API_SERVER_HOST:-$(echo "$routes" | grep forklift-services || true)} + INVENTORY_SERVER_HOST="https://$(echo "$routes" | grep forklift-inventory)" + SERVICES_API_SERVER_HOST="https://$(echo "$routes" | grep forklift-services)" fi -# Default to localhost if no route found -INVENTORY_SERVER_HOST=${INVENTORY_SERVER_HOST:-"https://localhost:30444"} -SERVICES_API_SERVER_HOST=${SERVICES_API_SERVER_HOST:-"https://localhost:30446"} - if [[ ${CONSOLE_IMAGE} =~ ^localhost/ ]]; then PULL_POLICY="never" else @@ -32,8 +43,8 @@ fi # Test if console is already running if podman container exists ${CONSOLE_CONTAINER_NAME}; then - echo "container named ${CONSOLE_CONTAINER_NAME} is running, exit." - exit 1 + echo "container named ${CONSOLE_CONTAINER_NAME} is running, exit." + exit 1 fi # Base setup for the bridge @@ -49,7 +60,8 @@ fi # # NOTE: When running KinD we should use host network type because KinD only listen on localhost. BRIDGE_PLUGINS="${PLUGIN_NAME}=${PLUGIN_URL}" -BRIDGE_PLUGIN_PROXY=$(cat << END | jq -c . +BRIDGE_PLUGIN_PROXY=$( + cat < Date: Mon, 10 Feb 2025 09:31:33 +0200 Subject: [PATCH 2/2] update script Signed-off-by: Matan Schatzman --- ci/start-console.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ci/start-console.sh b/ci/start-console.sh index 720b8de3e..c24f931de 100755 --- a/ci/start-console.sh +++ b/ci/start-console.sh @@ -4,8 +4,8 @@ set -euo pipefail script_dir=$(dirname "$0") source ${script_dir}/configure/openshift.sh -CONSOLE_CONTAINER_NAME=okd-console -FORKLIFT_NAMESPACE=konveyor-forklift +CONSOLE_CONTAINER_NAME="okd-console" +FORKLIFT_NAMESPACE="konveyor-forklift" BASE_HOST_URL="https://localhost" @@ -16,6 +16,8 @@ CONTAINER_NETWORK="--network=host" CONSOLE_IMAGE="quay.io/openshift/origin-console:latest" CONSOLE_PORT="9000" +CONSOLE_PORT_PUBLISH="--publish=$CONSOLE_PORT:$CONSOLE_PORT" +CONSOLE_CONTAINER_NAME_RUN="--name=$CONSOLE_CONTAINER_NAME" # On macOS if [[ $(uname) = "Darwin" ]]; then @@ -59,7 +61,7 @@ fi # When the container network is default, host.containers.internal == container host # # NOTE: When running KinD we should use host network type because KinD only listen on localhost. -BRIDGE_PLUGINS="${PLUGIN_NAME}=${PLUGIN_URL}" +BRIDGE_PLUGINS="$PLUGIN_NAME=$PLUGIN_URL" BRIDGE_PLUGIN_PROXY=$( cat <