Skip to content

Commit 9fee749

Browse files
committed
node-installer: move things around
- move the testing scripts to the `node-installer/tests/` directory - move the kwasm-job.yml to the `node-installer/tests/workloads/` directory - symlink the workload.yaml and runtime.yaml from the root `deployments/workloads/` to the `node-installer/tests/workloads/` directory Signed-off-by: Jiaxiao (mossaka) Zhou <[email protected]>
1 parent 768d6dc commit 9fee749

File tree

10 files changed

+46
-17
lines changed

10 files changed

+46
-17
lines changed

node-installer/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ build-dev-installer-image: $(BINARY)
2020
docker buildx build -t $(IMAGE_NAME) --load --platform $(PLATFORM) .
2121

2222
test-kind:
23-
./integration-test-kind.sh
23+
./tests/integration-test-kind.sh
2424

2525
test-minikube:
26-
./integration-test-minikube.sh
26+
./tests/integration-test-minikube.sh
2727

2828
test-microk8s:
29-
./integration-test-microk8s.sh
29+
./tests/integration-test-microk8s.sh
3030

3131
test-k3s:
32-
./integration-test-k3s.sh
32+
./tests/integration-test-k3s.sh
3333

3434
test-all: test-kind test-minikube test-microk8s test-k3s

node-installer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ project to handle this concern in the future.
1010

1111
## Integration Tests
1212

13-
The project includes integration test scripts for different Kubernetes distributions:
13+
The project includes integration test scripts for different Kubernetes distributions in the `tests/` directory:
1414

1515
1. Kind: `make test-kind`
1616
2. MiniKube: `make test-minikube`

node-installer/k3s-kwasm-job.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
labels:
5+
job-name: k3s-provision-kwasm
6+
name: k3s-provision-kwasm-dev
7+
namespace: kwasm
8+
spec:
9+
containers:
10+
- env:
11+
- name: NODE_ROOT
12+
value: /mnt/node-root
13+
image: ghcr.io/spinkube/containerd-shim-spin/node-installer:dev
14+
imagePullPolicy: IfNotPresent
15+
name: kwasm-provision
16+
securityContext:
17+
privileged: true
18+
volumeMounts:
19+
- mountPath: /mnt/node-root
20+
name: root-mount
21+
hostPID: true
22+
nodeName: devbox-5
23+
restartPolicy: Never
24+
volumes:
25+
- hostPath:
26+
path: /
27+
name: root-mount

node-installer/integration-test-k3s.sh renamed to node-installer/tests/integration-test-k3s.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ done
1616

1717
echo "=== Step 2: Create namespace and deploy RuntimeClass ==="
1818
kubectl create namespace kwasm || true
19-
kubectl apply -f ../deployments/workloads/runtime.yaml
19+
kubectl apply -f ./tests/workloads/runtime.yaml
2020

2121
echo "=== Step 3: Build and deploy the KWasm node installer ==="
2222
if ! docker image inspect $IMAGE_NAME >/dev/null 2>&1; then
@@ -42,7 +42,7 @@ sudo k3s ctr images import node-installer.tar
4242
rm node-installer.tar
4343

4444
NODE_NAME=$(kubectl get nodes -o jsonpath='{.items[0].metadata.name}')
45-
cp kwasm-job.yml k3s-kwasm-job.yml
45+
cp ./tests/workloads/kwasm-job.yml k3s-kwasm-job.yml
4646
sed -i "s/spin-test-control-plane-provision-kwasm/k3s-provision-kwasm/g" k3s-kwasm-job.yml
4747
sed -i "s/spin-test-control-plane-provision-kwasm-dev/k3s-provision-kwasm-dev/g" k3s-kwasm-job.yml
4848
sed -i "s/spin-test-control-plane/${NODE_NAME}/g" k3s-kwasm-job.yml
@@ -62,7 +62,7 @@ fi
6262

6363
echo "=== Step 4: Apply the workload ==="
6464
sudo k3s ctr images pull ghcr.io/spinkube/containerd-shim-spin/examples/spin-rust-hello:v0.18.0
65-
kubectl apply -f ../deployments/workloads/workload.yaml
65+
kubectl apply -f ./tests/workloads/workload.yaml
6666

6767
echo "Waiting for deployment to be ready..."
6868
kubectl wait --for=condition=Available deployment/wasm-spin --timeout=120s

node-installer/integration-test-kind.sh renamed to node-installer/tests/integration-test-kind.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ kubectl --context=kind-spin-test wait --for=condition=Ready nodes --all --timeou
2525

2626
echo "=== Step 2: Create namespace and deploy RuntimeClass ==="
2727
kubectl --context=kind-spin-test create namespace kwasm || true
28-
kubectl --context=kind-spin-test apply -f ../deployments/workloads/runtime.yaml
28+
kubectl --context=kind-spin-test apply -f ./tests/workloads/runtime.yaml
2929

3030
echo "=== Step 3: Build and deploy the KWasm node installer ==="
3131
if ! docker image inspect $IMAGE_NAME >/dev/null 2>&1; then
@@ -49,7 +49,7 @@ echo "Loading node installer image into kind..."
4949
kind load docker-image $IMAGE_NAME --name spin-test
5050

5151
echo "Applying KWasm node installer job..."
52-
kubectl --context=kind-spin-test apply -f ./kwasm-job.yml
52+
kubectl --context=kind-spin-test apply -f ./tests/workloads/kwasm-job.yml
5353

5454
echo "Waiting for node installer job to complete..."
5555
kubectl --context=kind-spin-test wait -n kwasm --for=condition=Ready pod --selector=job-name=spin-test-control-plane-provision-kwasm --timeout=90s || true
@@ -62,7 +62,7 @@ if ! kubectl --context=kind-spin-test get pods -n kwasm | grep -q "spin-test-con
6262
fi
6363

6464
echo "=== Step 4: Apply the workload ==="
65-
kubectl --context=kind-spin-test apply -f ../deployments/workloads/workload.yaml
65+
kubectl --context=kind-spin-test apply -f ./tests/workloads/workload.yaml
6666

6767
echo "Waiting for deployment to be ready..."
6868
kubectl --context=kind-spin-test wait --for=condition=Available deployment/wasm-spin --timeout=120s

node-installer/integration-test-microk8s.sh renamed to node-installer/tests/integration-test-microk8s.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ alias kubectl='sudo microk8s kubectl'
2424

2525
echo "=== Step 2: Create namespace and deploy RuntimeClass ==="
2626
kubectl create namespace kwasm || true
27-
kubectl apply -f ../deployments/workloads/runtime.yaml
27+
kubectl apply -f ./tests/workloads/runtime.yaml
2828

2929
echo "=== Step 3: Build and deploy the KWasm node installer ==="
3030
if ! docker image inspect $IMAGE_NAME >/dev/null 2>&1; then
@@ -50,7 +50,7 @@ sudo microk8s ctr image import node-installer.tar
5050
rm node-installer.tar
5151

5252
NODE_NAME=$(kubectl get nodes -o jsonpath='{.items[0].metadata.name}')
53-
cp kwasm-job.yml microk8s-kwasm-job.yml
53+
cp ./tests/workloads/kwasm-job.yml microk8s-kwasm-job.yml
5454
sed -i "s/spin-test-control-plane-provision-kwasm/microk8s-provision-kwasm/g" microk8s-kwasm-job.yml
5555
sed -i "s/spin-test-control-plane-provision-kwasm-dev/microk8s-provision-kwasm-dev/g" microk8s-kwasm-job.yml
5656
sed -i "s/spin-test-control-plane/${NODE_NAME}/g" microk8s-kwasm-job.yml
@@ -69,7 +69,7 @@ if ! kubectl get pods -n kwasm | grep -q "microk8s-provision-kwasm.*Completed";
6969
fi
7070

7171
echo "=== Step 4: Apply the workload ==="
72-
kubectl apply -f ../deployments/workloads/workload.yaml
72+
kubectl apply -f ./tests/workloads/workload.yaml
7373

7474
echo "Waiting for deployment to be ready..."
7575
kubectl wait --for=condition=Available deployment/wasm-spin --timeout=120s

node-installer/integration-test-minikube.sh renamed to node-installer/tests/integration-test-minikube.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ minikube start -p minikube --driver=docker --container-runtime=containerd
88

99
echo "=== Step 2: Create namespace and deploy RuntimeClass ==="
1010
kubectl create namespace kwasm || true
11-
kubectl apply -f ../deployments/workloads/runtime.yaml
11+
kubectl apply -f ./tests/workloads/runtime.yaml
1212

1313
echo "=== Step 3: Build and deploy the KWasm node installer ==="
1414
if ! docker image inspect $IMAGE_NAME >/dev/null 2>&1; then
@@ -32,7 +32,7 @@ echo "Loading node installer image into MiniKube..."
3232
minikube image load $IMAGE_NAME -p minikube
3333

3434
NODE_NAME=$(kubectl get nodes --context=minikube -o jsonpath='{.items[0].metadata.name}')
35-
cp kwasm-job.yml minikube-kwasm-job.yml
35+
cp ./tests/workloads/kwasm-job.yml minikube-kwasm-job.yml
3636
sed -i "s/spin-test-control-plane-provision-kwasm/minikube-provision-kwasm/g" minikube-kwasm-job.yml
3737
sed -i "s/spin-test-control-plane-provision-kwasm-dev/minikube-provision-kwasm-dev/g" minikube-kwasm-job.yml
3838
sed -i "s/spin-test-control-plane/${NODE_NAME}/g" minikube-kwasm-job.yml
@@ -51,7 +51,7 @@ if ! kubectl get pods -n kwasm | grep -q "minikube-provision-kwasm.*Completed";
5151
fi
5252

5353
echo "=== Step 4: Apply the workload ==="
54-
kubectl apply -f ../deployments/workloads/workload.yaml
54+
kubectl apply -f ./tests/workloads/workload.yaml
5555

5656
echo "Waiting for deployment to be ready..."
5757
kubectl wait --for=condition=Available deployment/wasm-spin --timeout=120s
File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../deployments/workloads/runtime.yaml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../deployments/workloads/workload.yaml

0 commit comments

Comments
 (0)