Skip to content

Commit 3670078

Browse files
committed
dynamically create containerd registry config file for e2e
Statically including the file with name that has a colon in it is invalid for Go modules, which lead to the v1.5.0 release being rendered broken: The go mod error shows: - malformed file path "...local:5000/hosts.toml": invalid char ':' - This prevents the module from being downloaded and verified - Finally, the Go sum database returns 404 because it can't process this malformed module This commit creates the file dynamically, instead of including the file statically in the repository. Signed-off-by: Anik Bhattacharjee <anbhatta@redhat.com>
1 parent 68610d0 commit 3670078

5 files changed

Lines changed: 58 additions & 3 deletions

File tree

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,14 @@ kind-deploy: manifests
351351
.PHONY: kind-cluster
352352
kind-cluster: $(KIND) kind-verify-versions #EXHELP Standup a kind cluster.
353353
-$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)
354+
./hack/setup-e2e-registry-config.sh
354355
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) --config ./kind-config.yaml
355356
$(KIND) export kubeconfig --name $(KIND_CLUSTER_NAME)
356357

357358
.PHONY: kind-clean
358359
kind-clean: $(KIND) #EXHELP Delete the kind cluster.
359360
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)
361+
./hack/cleanup-e2e-registry-config.sh
360362

361363
.PHONY: kind-verify-versions
362364
kind-verify-versions:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -o errexit
3+
set -o nounset
4+
set -o pipefail
5+
6+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
8+
CERTS_DIR="${PROJECT_ROOT}/hack/kind-config/containerd/certs.d"
9+
10+
REGISTRY_HOST="docker-registry.operator-controller-e2e.svc.cluster.local:5000"
11+
REGISTRY_DIR="${CERTS_DIR}/${REGISTRY_HOST}"
12+
13+
echo "Cleaning up e2e registry configuration..."
14+
15+
if [ -d "${REGISTRY_DIR}" ]; then
16+
echo "Removing directory: ${REGISTRY_DIR}"
17+
rm -rf "${REGISTRY_DIR}"
18+
echo "E2E registry configuration cleanup complete."
19+
else
20+
echo "Registry directory not found, nothing to clean."
21+
fi

hack/kind-config/containerd/certs.d/docker-registry.operator-controller-e2e.svc.cluster.local:5000/hosts.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

hack/setup-e2e-registry-config.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
set -o errexit
3+
set -o nounset
4+
set -o pipefail
5+
6+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
8+
CERTS_DIR="${PROJECT_ROOT}/hack/kind-config/containerd/certs.d"
9+
10+
REGISTRY_HOST="docker-registry.operator-controller-e2e.svc.cluster.local:5000"
11+
REGISTRY_DIR="${CERTS_DIR}/${REGISTRY_HOST}"
12+
13+
echo "Setting up e2e registry configuration..."
14+
echo "Creating directory: ${REGISTRY_DIR}"
15+
16+
mkdir -p "${REGISTRY_DIR}"
17+
18+
cat > "${REGISTRY_DIR}/hosts.toml" << 'EOF'
19+
[host."https://localhost:30000"]
20+
capabilities = ["pull", "resolve"]
21+
skip_verify = true
22+
EOF
23+
24+
echo "Created ${REGISTRY_DIR}/hosts.toml"
25+
echo "E2E registry configuration setup complete."

scripts/install.tpl.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ if [ -f "${olmv1_manifest}" ]; then
108108
fi
109109

110110
curl -L -s "${olmv1_manifest}" | sed "s/olmv1-system/${olmv1_namespace}/g" | kubectl apply -f -
111+
112+
# Wait for registry to be available if it exists (for e2e tests)
113+
if kubectl get namespace operator-controller-e2e >/dev/null 2>&1; then
114+
echo "Waiting for e2e registry to be available..."
115+
if ! kubectl_wait "operator-controller-e2e" "deployment/docker-registry" "60s"; then
116+
echo "Error: E2E registry is not ready, cannot proceed with deployment"
117+
exit 1
118+
fi
119+
fi
120+
111121
# Wait for the rollout, and then wait for the deployment to be Available
112122
kubectl_wait_rollout "${olmv1_namespace}" "deployment/catalogd-controller-manager" "60s"
113123
kubectl_wait "${olmv1_namespace}" "deployment/catalogd-controller-manager" "60s"

0 commit comments

Comments
 (0)