Skip to content

Commit 62fa475

Browse files
authored
Merge pull request #198 from datum-cloud/fix/e2e
fix(e2e): Install missing NSO CRDs on the downstream
2 parents ee282a6 + 359cf2e commit 62fa475

3 files changed

Lines changed: 114 additions & 1 deletion

File tree

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,13 @@ set-image-controller: manifests kustomize
153153
cd config/manager && $(KUSTOMIZE) edit set image ghcr.io/datum-cloud/network-services-operator=${IMG}
154154

155155
.PHONY: prepare-infra-cluster
156-
prepare-infra-cluster: cert-manager envoy-gateway external-dns
156+
prepare-infra-cluster: cert-manager envoy-gateway external-dns downstream-crds
157+
158+
.PHONY: downstream-crds
159+
downstream-crds: ## Install NSO CRDs on the downstream (infra) cluster that the replicator mirrors into it.
160+
$(KUBECTL) apply -f config/crd/bases/networking.datumapis.com_connectors.yaml
161+
$(KUBECTL) apply -f config/crd/bases/networking.datumapis.com_httpproxies.yaml
162+
$(KUBECTL) apply -f config/crd/bases/networking.datumapis.com_trafficprotectionpolicies.yaml
157163

158164
.PHONY: prepare-e2e
159165
prepare-e2e: chainsaw set-image-controller cert-manager load-image-all deploy-e2e

Taskfile.dev.yaml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
version: '3'
2+
3+
vars:
4+
TMP_DIR:
5+
sh: echo "${TMPDIR:-/tmp}"
6+
7+
tasks:
8+
bootstrap:
9+
desc: "Bootstrap the multi-cluster dev environment (nso-standard and nso-infra) for local testing"
10+
cmds:
11+
- echo "🚀 Bootstrapping dev environment..."
12+
- task: create-clusters
13+
- task: prep-upstream
14+
- task: prep-downstream
15+
- task: link-clusters
16+
- echo "🎉 Dev environment bootstrapped successfully! Context is now kind-nso-standard."
17+
18+
create-clusters:
19+
desc: "Create Kind upstream (standard) and downstream (infra) clusters"
20+
cmds:
21+
- echo "🧹 Cleaning up any existing clusters..."
22+
- kind delete cluster --name nso-standard || true
23+
- kind delete cluster --name nso-infra || true
24+
- echo "🏗️ Creating upstream (nso-standard) cluster..."
25+
- make kind-standard-cluster
26+
- echo "🏗️ Creating downstream (nso-infra) cluster..."
27+
- make kind-infra-cluster
28+
29+
prep-upstream:
30+
desc: "Prepare the upstream cluster with Operator and cert-manager"
31+
cmds:
32+
- echo "🔧 Preparing upstream (nso-standard)..."
33+
- kubectl config use-context kind-nso-standard
34+
- make prepare-e2e
35+
36+
prep-downstream:
37+
desc: "Prepare the downstream cluster with cert-manager, envoy-gateway, and external-dns"
38+
cmds:
39+
- echo "🔧 Preparing downstream (nso-infra)..."
40+
- kubectl config use-context kind-nso-infra
41+
- make prepare-infra-cluster
42+
43+
link-clusters:
44+
desc: "Link upstream and downstream clusters using kubeconfig secret"
45+
cmds:
46+
- echo "🔗 Linking clusters..."
47+
- kind get kubeconfig --name nso-infra --internal > {{.TMP_DIR}}/.kind-nso-infra-internal.yaml
48+
- kubectl config use-context kind-nso-standard
49+
- |
50+
kubectl create namespace network-services-operator-system --dry-run=client -o yaml | kubectl apply -f -
51+
kubectl create secret -n network-services-operator-system \
52+
generic downstream-cluster-kubeconfig \
53+
--save-config \
54+
--dry-run=client -o yaml \
55+
--from-file=kubeconfig={{.TMP_DIR}}/.kind-nso-infra-internal.yaml | kubectl apply -f -
56+
- echo "⏳ Waiting for operator controller manager deployment to be ready..."
57+
- |
58+
kubectl -n network-services-operator-system \
59+
wait deploy network-services-operator-controller-manager \
60+
--for=condition=Available \
61+
--timeout=180s
62+
63+
redeploy-operator:
64+
desc: "Rebuild the operator image, load it into nso-standard, and roll out the deployed controller"
65+
cmds:
66+
- echo "🔨 Building operator image and loading it into nso-standard..."
67+
# docker-build + kind load docker-image $(IMG) -n nso-standard
68+
- make load-image-operator
69+
- echo "♻️ Restarting the controller-manager to pick up the new image..."
70+
- kubectl config use-context kind-nso-standard
71+
- |
72+
kubectl -n network-services-operator-system \
73+
rollout restart deploy network-services-operator-controller-manager
74+
- echo "⏳ Waiting for the new controller-manager rollout to complete..."
75+
- |
76+
kubectl -n network-services-operator-system \
77+
rollout status deploy network-services-operator-controller-manager \
78+
--timeout=180s
79+
- echo "✅ Operator redeployed with the freshly built image."
80+
81+
destroy:
82+
desc: "Tear down the multi-cluster dev environment"
83+
cmds:
84+
- echo "💥 Destroying clusters..."
85+
- kind delete cluster --name nso-standard || true
86+
- kind delete cluster --name nso-infra || true
87+
- rm -f {{.TMP_DIR}}/.kind-nso-infra-internal.yaml
88+
- echo "✨ Cleanup finished."
89+
90+
test:
91+
desc: "Run E2E tests using chainsaw on the local multi-cluster setup"
92+
cmds:
93+
- echo "🧪 Running E2E tests..."
94+
- |
95+
if [ -n "{{.CLI_ARGS}}" ]; then
96+
if [[ "{{.CLI_ARGS}}" == test/e2e/* || "{{.CLI_ARGS}}" == ./test/e2e/* ]]; then
97+
make test-e2e TEST_DIR="{{.CLI_ARGS}}"
98+
else
99+
make test-e2e TEST_DIR="./test/e2e/{{.CLI_ARGS}}"
100+
fi
101+
else
102+
make test-e2e
103+
fi

Taskfile.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
version: '3'
22

3+
includes:
4+
dev:
5+
taskfile: ./Taskfile.dev.yaml
6+
37
tasks:
48
validate-kustomizations:
59
desc: Validate all kustomization.yaml files using kustomize build

0 commit comments

Comments
 (0)