diff --git a/Makefile b/Makefile index acac46a5d5..a4dfa5c6ad 100644 --- a/Makefile +++ b/Makefile @@ -351,12 +351,14 @@ kind-deploy: manifests .PHONY: kind-cluster kind-cluster: $(KIND) kind-verify-versions #EXHELP Standup a kind cluster. -$(KIND) delete cluster --name $(KIND_CLUSTER_NAME) + ./hack/setup-e2e-registry-config.sh $(KIND) create cluster --name $(KIND_CLUSTER_NAME) --config ./kind-config.yaml $(KIND) export kubeconfig --name $(KIND_CLUSTER_NAME) .PHONY: kind-clean kind-clean: $(KIND) #EXHELP Delete the kind cluster. $(KIND) delete cluster --name $(KIND_CLUSTER_NAME) + ./hack/cleanup-e2e-registry-config.sh .PHONY: kind-verify-versions kind-verify-versions: diff --git a/hack/cleanup-e2e-registry-config.sh b/hack/cleanup-e2e-registry-config.sh new file mode 100755 index 0000000000..f954bd342d --- /dev/null +++ b/hack/cleanup-e2e-registry-config.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -o errexit +set -o nounset +set -o pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" +CERTS_DIR="${PROJECT_ROOT}/hack/kind-config/containerd/certs.d" + +REGISTRY_HOST="docker-registry.operator-controller-e2e.svc.cluster.local:5000" +REGISTRY_DIR="${CERTS_DIR}/${REGISTRY_HOST}" + +echo "Cleaning up e2e registry configuration..." + +if [ -d "${REGISTRY_DIR}" ]; then + echo "Removing directory: ${REGISTRY_DIR}" + rm -rf "${REGISTRY_DIR}" + echo "E2E registry configuration cleanup complete." +else + echo "Registry directory not found, nothing to clean." +fi diff --git a/hack/kind-config/containerd/certs.d/docker-registry.operator-controller-e2e.svc.cluster.local:5000/hosts.toml b/hack/kind-config/containerd/certs.d/docker-registry.operator-controller-e2e.svc.cluster.local:5000/hosts.toml deleted file mode 100644 index b0a5eb47fc..0000000000 --- a/hack/kind-config/containerd/certs.d/docker-registry.operator-controller-e2e.svc.cluster.local:5000/hosts.toml +++ /dev/null @@ -1,3 +0,0 @@ -[host."https://localhost:30000"] - capabilities = ["pull", "resolve"] - skip_verify = true diff --git a/hack/setup-e2e-registry-config.sh b/hack/setup-e2e-registry-config.sh new file mode 100755 index 0000000000..4d1d100ae6 --- /dev/null +++ b/hack/setup-e2e-registry-config.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -o errexit +set -o nounset +set -o pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" +CERTS_DIR="${PROJECT_ROOT}/hack/kind-config/containerd/certs.d" + +REGISTRY_HOST="docker-registry.operator-controller-e2e.svc.cluster.local:5000" +REGISTRY_DIR="${CERTS_DIR}/${REGISTRY_HOST}" + +echo "Setting up e2e registry configuration..." +echo "Creating directory: ${REGISTRY_DIR}" + +mkdir -p "${REGISTRY_DIR}" + +cat > "${REGISTRY_DIR}/hosts.toml" << 'EOF' +[host."https://localhost:30000"] + capabilities = ["pull", "resolve"] + skip_verify = true +EOF + +echo "Created ${REGISTRY_DIR}/hosts.toml" +echo "E2E registry configuration setup complete." diff --git a/scripts/install.tpl.sh b/scripts/install.tpl.sh index 2ddf79856b..24a0f42e7f 100644 --- a/scripts/install.tpl.sh +++ b/scripts/install.tpl.sh @@ -108,6 +108,16 @@ if [ -f "${olmv1_manifest}" ]; then fi curl -L -s "${olmv1_manifest}" | sed "s/olmv1-system/${olmv1_namespace}/g" | kubectl apply -f - + +# Wait for registry to be available if it exists (for e2e tests) +if kubectl get namespace operator-controller-e2e >/dev/null 2>&1; then + echo "Waiting for e2e registry to be available..." + if ! kubectl_wait "operator-controller-e2e" "deployment/docker-registry" "60s"; then + echo "Error: E2E registry is not ready, cannot proceed with deployment" + exit 1 + fi +fi + # Wait for the rollout, and then wait for the deployment to be Available kubectl_wait_rollout "${olmv1_namespace}" "deployment/catalogd-controller-manager" "60s" kubectl_wait "${olmv1_namespace}" "deployment/catalogd-controller-manager" "60s"