diff --git a/ci/start-console.sh b/ci/start-console.sh index 08b0c27a9..c24f931de 100755 --- a/ci/start-console.sh +++ b/ci/start-console.sh @@ -4,26 +4,39 @@ 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" 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" +CONSOLE_PORT_PUBLISH="--publish=$CONSOLE_PORT:$CONSOLE_PORT" +CONSOLE_CONTAINER_NAME_RUN="--name=$CONSOLE_CONTAINER_NAME" + +# 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 +45,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 @@ -48,8 +61,9 @@ 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_PLUGIN_PROXY=$(cat << END | jq -c . +BRIDGE_PLUGINS="$PLUGIN_NAME=$PLUGIN_URL" +BRIDGE_PLUGIN_PROXY=$( + cat <