forked from github/multus-cni
Update e2e
This change contains following: - update kind version to 0.8.1 - update setup script due to update - add teardown script - update README
This commit is contained in:
parent
2dab3225de
commit
17b24d5fd5
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
# Binary output dir
|
# Binary output dir
|
||||||
bin/
|
bin/
|
||||||
|
e2e/bin/
|
||||||
|
|
||||||
# GOPATH created by the build script
|
# GOPATH created by the build script
|
||||||
gopath/
|
gopath/
|
||||||
|
@ -10,3 +10,9 @@ $ ./get_tools.sh
|
|||||||
$ ./setup_cluster.sh
|
$ ./setup_cluster.sh
|
||||||
$ ./test-simple-macvlan1.sh
|
$ ./test-simple-macvlan1.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### How to teardown cluster
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./teardown.sh
|
||||||
|
```
|
||||||
|
@ -5,7 +5,7 @@ if [ ! -d bin ]; then
|
|||||||
mkdir bin
|
mkdir bin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -Lo ./bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64"
|
curl -Lo ./bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.8.1/kind-$(uname)-amd64"
|
||||||
chmod +x ./bin/kind
|
chmod +x ./bin/kind
|
||||||
curl -Lo ./bin/kubectl https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
|
curl -Lo ./bin/kubectl https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
|
||||||
chmod +x ./bin/kubectl
|
chmod +x ./bin/kubectl
|
||||||
|
@ -3,32 +3,64 @@ set -o errexit
|
|||||||
|
|
||||||
export PATH=${PATH}:./bin
|
export PATH=${PATH}:./bin
|
||||||
|
|
||||||
|
kind_network='kind'
|
||||||
reg_name='kind-registry'
|
reg_name='kind-registry'
|
||||||
reg_port='5000'
|
reg_port='5000'
|
||||||
running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
|
running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
|
||||||
if [ "${running}" != 'true' ]; then
|
if [ "${running}" != 'true' ]; then
|
||||||
|
# run registry and push the multus image
|
||||||
docker run -d --restart=always -p "${reg_port}:5000" --name "${reg_name}" registry:2
|
docker run -d --restart=always -p "${reg_port}:5000" --name "${reg_name}" registry:2
|
||||||
|
docker build -t localhost:5000/multus:e2e ..
|
||||||
|
docker push localhost:5000/multus:e2e
|
||||||
fi
|
fi
|
||||||
reg_ip="$(docker inspect -f '{{.NetworkSettings.IPAddress}}' "${reg_name}")"
|
reg_host="${reg_name}"
|
||||||
|
if [ "${kind_network}" = "bridge" ]; then
|
||||||
|
reg_host="$(docker inspect -f '{{.NetworkSettings.IPAddress}}' "${reg_name}")"
|
||||||
|
fi
|
||||||
|
echo "Registry Host: ${reg_host}"
|
||||||
|
|
||||||
|
# deploy cluster with kind
|
||||||
cat <<EOF | kind create cluster --config=-
|
cat <<EOF | kind create cluster --config=-
|
||||||
kind: Cluster
|
kind: Cluster
|
||||||
apiVersion: kind.x-k8s.io/v1alpha4
|
apiVersion: kind.x-k8s.io/v1alpha4
|
||||||
containerdConfigPatches:
|
containerdConfigPatches:
|
||||||
- |-
|
- |-
|
||||||
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"]
|
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"]
|
||||||
endpoint = ["http://${reg_ip}:${reg_port}"]
|
endpoint = ["http://${reg_host}:${reg_port}"]
|
||||||
nodes:
|
nodes:
|
||||||
- role: control-plane
|
- role: control-plane
|
||||||
- role: worker
|
- role: worker
|
||||||
- role: worker
|
- role: worker
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF | kubectl apply -f -
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: local-registry-hosting
|
||||||
|
namespace: kube-public
|
||||||
|
data:
|
||||||
|
localRegistryHosting.v1: |
|
||||||
|
host: "localhost:${reg_port}"
|
||||||
|
help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
containers=$(docker network inspect ${kind_network} -f "{{range .Containers}}{{.Name}} {{end}}")
|
||||||
|
needs_connect="true"
|
||||||
|
for c in $containers; do
|
||||||
|
if [ "$c" = "${reg_name}" ]; then
|
||||||
|
needs_connect="false"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ "${needs_connect}" = "true" ]; then
|
||||||
|
docker network connect "${kind_network}" "${reg_name}" || true
|
||||||
|
fi
|
||||||
|
|
||||||
kind export kubeconfig
|
kind export kubeconfig
|
||||||
sudo env PATH=${PATH} koko -d kind-worker,eth1 -d kind-worker2,eth1
|
sudo env PATH=${PATH} koko -d kind-worker,eth1 -d kind-worker2,eth1
|
||||||
sleep 1
|
sleep 1
|
||||||
kubectl -n kube-system wait --for=condition=available deploy/coredns --timeout=300s
|
kubectl -n kube-system wait --for=condition=available deploy/coredns --timeout=300s
|
||||||
kubectl create -f https://raw.githubusercontent.com/intel/multus-cni/master/images/multus-daemonset.yml
|
kubectl create -f multus-daemonset.yml
|
||||||
sleep 1
|
sleep 1
|
||||||
kubectl -n kube-system wait --for=condition=ready -l name=multus pod --timeout=300s
|
kubectl -n kube-system wait --for=condition=ready -l name=multus pod --timeout=300s
|
||||||
kubectl create -f cni-install.yml
|
kubectl create -f cni-install.yml
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -o errexit
|
|
||||||
|
|
||||||
export PATH=${PATH}:./bin
|
|
||||||
|
|
||||||
kind export kubeconfig
|
|
||||||
sudo koko -d kind-worker,eth1 -d kind-worker2,eth1
|
|
||||||
sleep 1
|
|
||||||
kubectl -n kube-system wait --for=condition=available deploy/coredns --timeout=300s
|
|
||||||
kubectl create -f https://raw.githubusercontent.com/intel/multus-cni/master/images/multus-daemonset.yml
|
|
||||||
sleep 1
|
|
||||||
kubectl -n kube-system wait --for=condition=ready -l name=multus pod --timeout=300s
|
|
||||||
kubectl create -f cni-install.yml
|
|
||||||
sleep 1
|
|
||||||
kubectl -n kube-system wait --for=condition=ready -l name=cni-plugins pod --timeout=300s
|
|
10
e2e/teardown.sh
Executable file
10
e2e/teardown.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#set -o errexit
|
||||||
|
|
||||||
|
reg_name='kind-registry'
|
||||||
|
export PATH=${PATH}:./bin
|
||||||
|
|
||||||
|
# delete cluster kind
|
||||||
|
kind delete cluster
|
||||||
|
docker kill ${reg_name}
|
||||||
|
docker rm ${reg_name}
|
@ -7,7 +7,7 @@ kubectl create -f macvlan1.yml
|
|||||||
kubectl wait --for=condition=ready -l app=macvlan --timeout=300s pod
|
kubectl wait --for=condition=ready -l app=macvlan --timeout=300s pod
|
||||||
|
|
||||||
echo "check macvlan1-worker1 interface: net1"
|
echo "check macvlan1-worker1 interface: net1"
|
||||||
kubectl exec macvlan1-worker1 ip a show dev net1
|
kubectl exec macvlan1-worker1 -- ip a show dev net1
|
||||||
|
|
||||||
echo "check macvlan1-worker1 interface address: net1"
|
echo "check macvlan1-worker1 interface address: net1"
|
||||||
ipaddr=$(kubectl exec macvlan1-worker1 -- ip -j a show | jq -r \
|
ipaddr=$(kubectl exec macvlan1-worker1 -- ip -j a show | jq -r \
|
||||||
@ -17,7 +17,7 @@ if [ $ipaddr != "10.1.1.11" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "check macvlan1-worker2 interface: net1"
|
echo "check macvlan1-worker2 interface: net1"
|
||||||
kubectl exec macvlan1-worker2 ip a show dev net1
|
kubectl exec macvlan1-worker2 -- ip a show dev net1
|
||||||
|
|
||||||
echo "check macvlan1-worker2 interface address: net1"
|
echo "check macvlan1-worker2 interface address: net1"
|
||||||
ipaddr=$(kubectl exec macvlan1-worker2 -- ip -j a show | jq -r \
|
ipaddr=$(kubectl exec macvlan1-worker2 -- ip -j a show | jq -r \
|
||||||
|
Loading…
Reference in New Issue
Block a user