Skip to content

Commit 4bcc370

Browse files
committed
feat: add Taskfile.dev.yaml for bootstrapping local multi-cluster dev environment
1 parent 21bb040 commit 4bcc370

4 files changed

Lines changed: 72 additions & 0 deletions

File tree

Taskfile.dev.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
destroy:
64+
desc: "Tear down the multi-cluster dev environment"
65+
cmds:
66+
- echo "💥 Destroying clusters..."
67+
- kind delete cluster --name nso-standard || true
68+
- kind delete cluster --name nso-infra || true
69+
- rm -f {{.TMP_DIR}}/.kind-nso-infra-internal.yaml
70+
- echo "✨ Cleanup finished."

Taskfile.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ includes:
55
docs:
66
taskfile: ./docs/Taskfile.yaml
77
dir: ./docs
8+
dev:
9+
taskfile: ./Taskfile.dev.yaml
810

911
tasks:
1012
validate-kustomizations:

docs/diagrams/http-metering-c4.png

-6.35 KB
Loading
-12.4 KB
Loading

0 commit comments

Comments
 (0)