Skip to content

Commit 7ca25b0

Browse files
committed
Add make-kind directive
This patch adds a 'make kind' directive that spins up a kind cluster, installs Calico, CalicoVPP from a local build VPP and the agent. Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
1 parent 2af2f87 commit 7ca25b0

File tree

4 files changed

+122
-8
lines changed

4 files changed

+122
-8
lines changed

Makefile

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,27 @@ image:
1616
$(MAKE) -C vpp-manager $@
1717
$(MAKE) -C multinet-monitor $@
1818

19+
.PHONY: image-kind
20+
image-kind: image
21+
docker image tag calicovpp/vpp:$(TAG) localhost:5000/calicovpp/vpp:latest
22+
docker push localhost:5000/calicovpp/vpp:latest
23+
docker image tag calicovpp/agent:$(TAG) localhost:5000/calicovpp/agent:latest
24+
docker push localhost:5000/calicovpp/agent:latest
25+
docker image tag calicovpp/multinet-monitor:$(TAG) localhost:5000/calicovpp/multinet-monitor:latest
26+
docker push localhost:5000/calicovpp/multinet-monitor:latest
27+
28+
29+
.PHONY: kind-new-cluster
30+
kind-new-cluster:
31+
make -C test/kind new-cluster
32+
33+
.PHONY: kind-install-cni
34+
kind-install-cni:
35+
make -C test/kind install-cni
36+
37+
.PHONY: kind
38+
kind: kind-new-cluster image-kind kind-install-cni
39+
1940
.PHONY: push
2041
push:
2142
$(MAKE) -C calico-vpp-agent $@
@@ -40,10 +61,6 @@ dev.k3s: dev
4061
rm -f /tmp/$$x.tar ; \
4162
done
4263

43-
.PHONY: kind-new-cluster
44-
kind-new-cluster:
45-
make -C test/kind new-cluster
46-
4764
.PHONY: dev-kind
4865
dev-kind: dev
4966
make -C test/kind dev

test/kind/Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
TAG ?= latest # Tag images with :$(TAG)
2-
N_KIND_WORKERS ?= 3
2+
N_KIND_WORKERS ?= 2
33
N_KIND_CONTROL_PLANES ?= 1
44
CPU_PINNING ?= false
55
KIND_CALICO_VERSION ?= master
66

77
.PHONY: new-cluster
88
new-cluster:
9-
@N_KIND_WORKERS=$(N_KIND_WORKERS) N_KIND_CONTROL_PLANES=$(N_KIND_CONTROL_PLANES) CPU_PINNING=$(CPU_PINNING) ./new_cluster.sh
9+
@N_KIND_WORKERS=$(N_KIND_WORKERS) \
10+
N_KIND_CONTROL_PLANES=$(N_KIND_CONTROL_PLANES) \
11+
CPU_PINNING=$(CPU_PINNING) \
12+
./new_cluster.sh
13+
14+
.PHONY: install-cni
15+
install-cni:
16+
@./install_calico_vpp.sh
17+
1018

1119
.PHONY: delete-cluster
1220
delete-cluster:
@@ -53,4 +61,4 @@ load-tag:
5361
docker exec -it $$nodename crictl pull localhost:5000/calico/$$x:$(KIND_CALICO_VERSION) ; \
5462
docker exec -it $$nodename ctr -n k8s.io images tag localhost:5000/calico/$$x:$(KIND_CALICO_VERSION) docker.io/calico/$$x:$(KIND_CALICO_VERSION) ; \
5563
done ; \
56-
done
64+
done

test/kind/install_calico_vpp.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
3+
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4+
5+
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/master/manifests/tigera-operator.yaml
6+
7+
while [[ "$(kubectl api-resources --api-group=operator.tigera.io | grep Installation)" == "" ]]; do echo "waiting for Installation kubectl resource"; sleep 2; done
8+
9+
export TAG=${TAG:-latest}
10+
11+
export CALICO_AGENT_IMAGE=localhost:5000/calicovpp/agent:${TAG}
12+
export CALICO_VPP_IMAGE=localhost:5000/calicovpp/vpp:${TAG}
13+
export MULTINET_MONITOR_IMAGE=localhost:5000/calicovpp/multinet-monitor:${TAG}
14+
15+
export IMAGE_PULL_POLICY=Always # Always Never IfNotPresent
16+
export CALICOVPP_ENABLE_MEMIF=true
17+
export CALICOVPP_ENABLE_VCL=true
18+
export CALICOVPP_LOG_LEVEL=debug
19+
20+
# ---------------- interfaces ----------------
21+
export CALICOVPP_MAIN_INTERFACE=eth0
22+
export CALICOVPP_INTERFACES='{
23+
"defaultPodIfSpec": {
24+
"rx": 1,
25+
"tx": 1,
26+
"rxqsz": 128,
27+
"txqsz": 128,
28+
"isl3": true,
29+
"rxMode": "interrupt"
30+
},
31+
"vppHostTapSpec": {
32+
"rx": 1,
33+
"tx": 1,
34+
"rxqsz": 512,
35+
"txqsz": 512,
36+
"isl3": false,
37+
"rxMode": "interrupt"
38+
},
39+
"uplinkInterfaces": [
40+
{
41+
"interfaceName": "eth0",
42+
"vppDriver": "af_packet",
43+
"rxMode": "interrupt"
44+
}
45+
]
46+
}'
47+
48+
export CALICOVPP_FEATURE_GATES='{
49+
"prometheusEnabled": true,
50+
"vclEnabled": true,
51+
"memifEnabled": true
52+
}'
53+
export CALICO_ENCAPSULATION=IPIP # VXLAN IPIP None
54+
export CALICO_NAT_OUTGOING=Enabled
55+
export CALICOVPP_DISABLE_HUGEPAGES=true
56+
57+
export CALICOVPP_CONFIG_TEMPLATE="unix {
58+
nodaemon
59+
full-coredump
60+
log /var/run/vpp/vpp.log
61+
cli-listen /var/run/vpp/cli.sock
62+
pidfile /run/vpp/vpp.pid
63+
}
64+
cpu {
65+
workers 0
66+
}
67+
socksvr {
68+
socket-name /var/run/vpp/vpp-api.sock
69+
}
70+
buffers {
71+
buffers-per-numa 16384
72+
page-size 4K
73+
}
74+
plugins {
75+
plugin default { enable }
76+
plugin calico_plugin.so { enable }
77+
plugin dpdk_plugin.so { disable }
78+
}
79+
"
80+
81+
${SCRIPTDIR}/../../yaml/overlays/dev/kustomize.sh up

test/kind/new_cluster.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
#!/bin/bash
22
set -o errexit
33

4+
if [[ $(kind get clusters | grep -E '^kind$') == "kind" ]]; then
5+
echo "Cluster kind already exists"
6+
exit 0
7+
fi
8+
9+
N_KIND_CONTROL_PLANES=${N_KIND_CONTROL_PLANES:-1}
10+
N_KIND_WORKERS=${N_KIND_WORKERS:-2}
11+
412
# create registry container unless it already exists
513
reg_name='kind-registry'
614
reg_port='5000'
@@ -20,7 +28,7 @@ containerdConfigPatches:
2028
endpoint = ["http://${reg_name}:5000"]
2129
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
2230
endpoint = ["http://${reg_name}:5000"]
23-
31+
2432
networking:
2533
disableDefaultCNI: true
2634
podSubnet: "11.0.0.0/16,fd20::0/64"

0 commit comments

Comments
 (0)