#!/bin/sh set -o errexit ROOT_DIR=$(git rev-parse --show-toplevel) KIND="${ROOT_DIR}"/hack/tools/bin/kind # Reference: https://kind.sigs.k8s.io/docs/user/local-registry/ # set no_proxy if applicable if [ ! -z "${no_proxy}" ]; then echo "Updating no_proxy env var"; export no_proxy=${no_proxy},kind-registry; export NO_PROXY=${no_proxy}; fi # create registry container unless it already exists reg_name='kind-registry' reg_port='5001' if [ "$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" != 'true' ]; then docker run \ -d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \ ghcr.io/project-zot/zot-minimal-linux-amd64:latest fi CLUSTER_NAME=kind ## Delete the cluster if it already exist "${KIND}" get clusters | grep ${CLUSTER_NAME} && "${KIND}" delete cluster --name ${CLUSTER_NAME} # create a cluster with the local registry enabled in containerd cat <