Skip to content

Commit ca5a4c9

Browse files
authored
Merge pull request #1230 from s1061123/update-kind
Update kind e2e
2 parents ba18cf5 + 03fcb34 commit ca5a4c9

File tree

5 files changed

+7
-55
lines changed

5 files changed

+7
-55
lines changed

.github/workflows/kind-e2e.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ jobs:
4848
sudo apt-get install -y j2cli
4949
echo $(j2 --version)
5050
51-
- name: Setup registry
52-
run: docker run -d --restart=always -p "5000:5000" --name "kind-registry" registry:2
53-
5451
- name: Build latest-amd64
5552
uses: docker/build-push-action@v5
5653
with:
@@ -60,10 +57,6 @@ jobs:
6057
file: ${{ matrix.docker-file }}
6158
platforms: linux/amd64
6259

63-
# docker buildx push is failed due to https://github.com/docker/buildx/issues/94
64-
- name: Push to local registry
65-
run: docker push localhost:5000/multus:e2e
66-
6760
- name: Get kind/kubectl/koko
6861
working-directory: ./e2e
6962
run: ./get_tools.sh
@@ -74,7 +67,7 @@ jobs:
7467

7568
- name: Setup cluster
7669
working-directory: ./e2e
77-
run: MULTUS_MANIFEST=${{ matrix.multus-manifest }} ./setup_cluster.sh
70+
run: MULTUS_MANIFEST=${{ matrix.multus-manifest }} MULTUS_DOCKERFILE=none ./setup_cluster.sh
7871

7972
- name: Test simple pod
8073
working-directory: ./e2e
@@ -108,5 +101,3 @@ jobs:
108101
- name: cleanup cluster and registry
109102
run: |
110103
kind delete cluster
111-
docker kill kind-registry
112-
docker rm kind-registry

e2e/get_tools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ ! -d bin ]; then
55
mkdir bin
66
fi
77

8-
curl -Lo ./bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.20.0/kind-$(uname)-amd64"
8+
curl -Lo ./bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.22.0/kind-$(uname)-amd64"
99
chmod +x ./bin/kind
1010
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
1111
chmod +x ./bin/kubectl

e2e/setup_cluster.sh

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,17 @@ MULTUS_MANIFEST="${MULTUS_MANIFEST:-multus-daemonset-thick.yml}"
1414
# define the dockerfile to build multus.
1515
# Acceptable values are `Dockerfile`. `Dockerfile.thick`.
1616
# Defaults to `Dockerfile.thick`.
17-
MULTUS_DOCKERFILE="${MULTUS_MANIFEST:-Dockerfile.thick}"
17+
MULTUS_DOCKERFILE="${MULTUS_DOCKERFILE:-Dockerfile.thick}"
1818

1919
kind_network='kind'
20-
reg_name='kind-registry'
21-
reg_port='5000'
22-
running="$($OCI_BIN inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
23-
if [ "${running}" != 'true' ]; then
24-
# run registry and push the multus image
25-
$OCI_BIN run -d --restart=always -p "${reg_port}:5000" --name "${reg_name}" registry:2
26-
$OCI_BIN build -t localhost:5000/multus:e2e -f ../images/${MULTUS_DOCKERFILE} ..
27-
$OCI_BIN push localhost:5000/multus:e2e
20+
if [ "${MULTUS_DOCKERFILE}" != "none" ]; then
21+
$OCI_BIN build -t localhost:5000/multus:e2e -f ../images/${MULTUS_DOCKERFILE} ..
2822
fi
29-
reg_host="${reg_name}"
30-
if [ "${kind_network}" = "bridge" ]; then
31-
reg_host="$($OCI_BIN inspect -f '{{.NetworkSettings.IPAddress}}' "${reg_name}")"
32-
fi
33-
echo "Registry Host: ${reg_host}"
3423

3524
# deploy cluster with kind
3625
cat <<EOF | kind create cluster --config=-
3726
kind: Cluster
3827
apiVersion: kind.x-k8s.io/v1alpha4
39-
containerdConfigPatches:
40-
- |-
41-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"]
42-
endpoint = ["http://${reg_host}:${reg_port}"]
4328
nodes:
4429
- role: control-plane
4530
- role: worker
@@ -52,28 +37,8 @@ nodes:
5237
- role: worker
5338
EOF
5439

55-
cat <<EOF | kubectl apply -f -
56-
apiVersion: v1
57-
kind: ConfigMap
58-
metadata:
59-
name: local-registry-hosting
60-
namespace: kube-public
61-
data:
62-
localRegistryHosting.v1: |
63-
host: "localhost:${reg_port}"
64-
help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
65-
EOF
66-
67-
containers=$($OCI_BIN network inspect ${kind_network} -f "{{range .Containers}}{{.Name}} {{end}}")
68-
needs_connect="true"
69-
for c in $containers; do
70-
if [ "$c" = "${reg_name}" ]; then
71-
needs_connect="false"
72-
fi
73-
done
74-
if [ "${needs_connect}" = "true" ]; then
75-
$OCI_BIN network connect "${kind_network}" "${reg_name}" || true
76-
fi
40+
# load multus image from container host to kind node
41+
kind load docker-image localhost:5000/multus:e2e
7742

7843
worker1_pid=$($OCI_BIN inspect --format "{{ .State.Pid }}" kind-worker)
7944
worker2_pid=$($OCI_BIN inspect --format "{{ .State.Pid }}" kind-worker2)

e2e/teardown.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
#!/bin/sh
22
#set -o errexit
33

4-
reg_name='kind-registry'
54
export PATH=${PATH}:./bin
65

76
# delete cluster kind
87
kind delete cluster
9-
docker kill ${reg_name}
10-
docker rm ${reg_name}

e2e/templates/multus-daemonset-thick.yml.j2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ spec:
133133
containers:
134134
- name: kube-multus
135135
image: localhost:5000/multus:e2e
136-
imagePullPolicy: Always
137136
command: [ "/usr/src/multus-cni/bin/multus-daemon" ]
138137
resources:
139138
requests:

0 commit comments

Comments
 (0)