Skip to content

Commit 2458686

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 <[email protected]>
1 parent 68610d0 commit 2458686

File tree

4 files changed

+48
-3
lines changed

4 files changed

+48
-3
lines changed

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."

0 commit comments

Comments
 (0)