From 22af280739d38b681ff896c2f92e63a7ee531733 Mon Sep 17 00:00:00 2001 From: Chris Burr Date: Thu, 27 Mar 2025 09:57:40 +0100 Subject: [PATCH] Add support for specifying container registry proxies --- README.md | 16 ++++++++++++++++ README.md.gotmpl | 15 +++++++++++++++ run_demo.sh | 8 +++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 27b729e..6a348f3 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,22 @@ Note that this configuration is trivial and does not follow production recommand ![OTEL collector configuration](./demo/otel-collector.png) +## Using container registry proxies + +Using container registry proxy such as [Harbor](https://goharbor.io/) can help you to: + +* Enable support for installation in environments with restricted network access +* Avoid rate limiting issues with dockerhub +* Speed up the deployment of the chart + +To do these when running the demo you can set: + +```bash +export REGISTRY_PROXY=harbor.example.com +``` + +To do this when deploying the chart see the `global.images` option in the values.yaml file. + ## Requirements | Repository | Name | Version | diff --git a/README.md.gotmpl b/README.md.gotmpl index e76d157..f84d7e8 100644 --- a/README.md.gotmpl +++ b/README.md.gotmpl @@ -220,6 +220,21 @@ Note that this configuration is trivial and does not follow production recommand ![OTEL collector configuration](./demo/otel-collector.png) +## Using container registry proxies + +Using container registry proxy such as [Harbor](https://goharbor.io/) can help you to: + +* Enable support for installation in environments with restricted network access +* Avoid rate limiting issues with dockerhub +* Speed up the deployment of the chart + +To do these when running the demo you can set: + +```bash +export REGISTRY_PROXY=harbor.example.com +``` + +To do this when deploying the chart see the `global.images` option in the values.yaml file. {{ template "chart.requirementsSection" . }} diff --git a/run_demo.sh b/run_demo.sh index 940d8c1..30955e4 100755 --- a/run_demo.sh +++ b/run_demo.sh @@ -21,6 +21,11 @@ demo_dir="${script_dir}/.demo" mkdir -p "${demo_dir}" export KUBECONFIG="${demo_dir}/kube.conf" export HELM_DATA_HOME="${demo_dir}/helm_data" +# Provide a mechanism to override use a proxy for accessing the registry +# This is useful for either restricted environments or avoiding rate limits +export REGISTRY_PROXY=${DOCKERHUB_URL:-""} +export REGISTRY_PROXY_DOCKERHUB=${REGISTRY_PROXY_DOCKERHUB:-"${REGISTRY_PROXY}docker.io"} +export REGISTRY_PROXY_GITHUB=${REGISTRY_PROXY_GITHUB:-"${REGISTRY_PROXY}ghcr.io"} function cleanup(){ trap - SIGTERM; @@ -77,7 +82,7 @@ function check_hostname(){ printf "%b Hostname %s resolves to 127.0.0.1 but this is not supported\n" ${SKULL_EMOJI} "${1}" return 1 fi - 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 + 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 printf "%b ping command exited with a non-zero exit code from within docker\n" ${SKULL_EMOJI} return 1 fi @@ -434,6 +439,7 @@ space_monitor_pid=$! # Create the cluster itself printf "%b Starting Kind cluster...\n" ${UNICORN_EMOJI} "${demo_dir}/kind" create cluster \ + --image "${REGISTRY_PROXY_DOCKERHUB}/kindest/node:latest" \ --kubeconfig "${KUBECONFIG}" \ --wait "1m" \ --config "${demo_dir}/demo_cluster_conf.yaml" \