Skip to content

Commit 382ac11

Browse files
committed
Add support for specifying container registry proxies
1 parent 64fddda commit 382ac11

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

run_demo.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ demo_dir="${script_dir}/.demo"
2121
mkdir -p "${demo_dir}"
2222
export KUBECONFIG="${demo_dir}/kube.conf"
2323
export HELM_DATA_HOME="${demo_dir}/helm_data"
24+
# Provide a mechanism to override use a proxy for accessing the registry
25+
# This is useful for either restricted environments or avoiding rate limits
26+
export REGISTRY_PROXY=${DOCKERHUB_URL:-""}
27+
export REGISTRY_PROXY_DOCKERHUB=${REGISTRY_PROXY_DOCKERHUB:-"${REGISTRY_PROXY}docker.io"}
28+
export REGISTRY_PROXY_GITHUB=${REGISTRY_PROXY_GITHUB:-"${REGISTRY_PROXY}ghcr.io"}
2429

2530
function cleanup(){
2631
trap - SIGTERM;
@@ -77,7 +82,7 @@ function check_hostname(){
7782
printf "%b Hostname %s resolves to 127.0.0.1 but this is not supported\n" ${SKULL_EMOJI} "${1}"
7883
return 1
7984
fi
80-
if ! docker_ip_address=$(docker run --rm alpine ping -c 1 "$1" | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -n 1); then
85+
if ! docker_ip_address=$(docker run --rm "${REGISTRY_PROXY_DOCKERHUB}/library/alpine:latest" ping -c 1 "$1" | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -n 1); then
8186
printf "%b ping command exited with a non-zero exit code from within docker\n" ${SKULL_EMOJI}
8287
return 1
8388
fi
@@ -434,6 +439,7 @@ space_monitor_pid=$!
434439
# Create the cluster itself
435440
printf "%b Starting Kind cluster...\n" ${UNICORN_EMOJI}
436441
"${demo_dir}/kind" create cluster \
442+
--image ${REGISTRY_PROXY_DOCKERHUB}/kindest/node:latest \
437443
--kubeconfig "${KUBECONFIG}" \
438444
--wait "1m" \
439445
--config "${demo_dir}/demo_cluster_conf.yaml" \

0 commit comments

Comments
 (0)