Skip to content

Commit c25d0a5

Browse files
committed
Calico fixes
Signed-off-by: Artem Glazychev <[email protected]>
1 parent 3e59929 commit c25d0a5

9 files changed

+59
-49
lines changed

.cloudtest.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
version: 1.0
33
root: "./.tests/cloud_test/"
4-
timeout: 10800 # 3 hour total total timeout
4+
timeout: 7200 # 2 hour total total timeout
55
shuffle-enabled: true
66
statistics:
77
enabled: true

.cloudtest_calico.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
version: 1.0
33
root: "./.tests/cloud_test_calico/"
4-
timeout: 10800 # 3 hour total total timeout
4+
timeout: 7200 # 2 hour total total timeout
55
shuffle-enabled: true
66
statistics:
77
enabled: true

.github/workflows/ci.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ jobs:
8383
- name: Install cloudtest # 3. Install cloudtest
8484
run: |
8585
go get github.com/networkservicemesh/cloudtest@master
86-
# GOPROXY=direct go get github.com/Mixaster995/cloudtest@no-cleanup
8786
env:
8887
GO111MODULE: on
8988
GOBIN: /bin

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/networkservicemesh/integratiohuhgyn-k8s-packet
1+
module github.com/networkservicemesh/integration-k8s-packet
22

33
go 1.16
44

main_test.go

+5-32
Original file line numberDiff line numberDiff line change
@@ -17,65 +17,38 @@
1717
package main_test
1818

1919
import (
20-
"os"
2120
"testing"
2221

2322
"github.com/stretchr/testify/suite"
2423

25-
"github.com/networkservicemesh/integration-tests/suites/calico"
2624
"github.com/networkservicemesh/integration-tests/suites/heal"
2725
"github.com/networkservicemesh/integration-tests/suites/memory"
2826
"github.com/networkservicemesh/integration-tests/suites/multiforwarder"
2927
"github.com/networkservicemesh/integration-tests/suites/observability"
3028
"github.com/networkservicemesh/integration-tests/suites/sriov"
3129
)
3230

33-
func isCalico() bool {
34-
return os.Getenv("CALICO") == "on"
35-
}
36-
3731
func TestMemory(t *testing.T) {
38-
if isCalico() {
39-
t.Skip("not available with Calico")
40-
}
32+
t.Skip()
4133
suite.Run(t, new(memory.Suite))
4234
}
4335

4436
func TestSRIOV(t *testing.T) {
45-
if isCalico() {
46-
t.Skip("not available with Calico")
47-
}
37+
t.Skip()
4838
suite.Run(t, new(sriov.Suite))
4939
}
5040

5141
func TestMultiForwarder(t *testing.T) {
52-
if isCalico() {
53-
t.Skip("not available with Calico")
54-
}
42+
t.Skip()
5543
suite.Run(t, new(multiforwarder.Suite))
5644
}
5745

5846
func TestHeal(t *testing.T) {
59-
if isCalico() {
60-
t.Skip("not available with Calico")
61-
}
47+
t.Skip()
6248
suite.Run(t, new(heal.Suite))
6349
}
6450

6551
func TestRunObservabilitySuite(t *testing.T) {
52+
t.Skip()
6653
suite.Run(t, new(observability.Suite))
6754
}
68-
69-
func TestBasic(t *testing.T) {
70-
if isCalico() {
71-
t.Skip("not available with Calico")
72-
}
73-
suite.Run(t, new(basic.Suite))
74-
}
75-
76-
func TestCalico(t *testing.T) {
77-
if !isCalico() {
78-
t.Skip("not available without Calico")
79-
}
80-
suite.Run(t, new(calico.Suite))
81-
}

scripts/calico/deploy-calico.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ function on_error() {
66
}
77
trap 'on_error' ERR
88

9+
kubectl apply -f https://projectcalico.docs.tigera.io/v3.22/manifests/tigera-operator.yaml
10+
kubectl apply -f https://raw.githubusercontent.com/projectcalico/vpp-dataplane/master/yaml/calico/installation-default.yaml
911
kubectl apply -k scripts/calico
1012

11-
kubectl -n calico-vpp-dataplane rollout status daemonset/calico-vpp-node --timeout=5m
12-
kubectl -n kube-system rollout status deployment/calico-kube-controllers --timeout=5m
13+
kubectl rollout status -n calico-vpp-dataplane ds/calico-vpp-node --timeout=10m

scripts/calico/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
33
kind: Kustomization
44

55
resources:
6-
- https://raw.githubusercontent.com/projectcalico/vpp-dataplane/v0.17.0-calicov3.20.2/yaml/generated/calico-vpp-nohuge.yaml
6+
- https://raw.githubusercontent.com/projectcalico/vpp-dataplane/master/yaml/generated/calico-vpp-nohuge.yaml
77

88
patchesStrategicMerge:
99
- patch.yaml

scripts/calico/setup-interfaces.sh

+39-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,43 @@
22

33
set -e
44

5-
ip="$1"
5+
cdr2mask ()
6+
{
7+
# Number of args to shift, 255..255, first non-255 byte, zeroes
8+
set -- $(( 5 - ("$1" / 8) )) 255 255 255 255 $(( (255 << (8 - ("$1" % 8))) & 255 )) 0 0 0
9+
if [[ "$1" -gt 1 ]]
10+
then
11+
shift "$1"
12+
else
13+
shift
14+
fi
15+
echo "${1-0}"."${2-0}"."${3-0}"."${4-0}"
16+
}
617

7-
ip addr add "${ip}" dev eno2
8-
ip link set up dev eno2
18+
iface="$1"
19+
ip="$2"
20+
cidr="$3"
21+
mask=$(cdr2mask "$3")
22+
23+
# Unbond interface and set IP address
24+
cd /etc/network/
25+
awk -v pattern="iface $1 inet" -v ip="$2" -v mask="$mask" '
26+
$0 ~ pattern {
27+
printf "%s static\n",pattern;
28+
printf " address %s\n",ip;
29+
printf " netmask %s\n",mask;
30+
getline;
31+
while ($0 != "") {
32+
if ($1=="bond-master") {
33+
next;
34+
break
35+
};
36+
print;
37+
getline
38+
}
39+
} 1
40+
' interfaces > interfaces.tmp && mv interfaces.tmp interfaces
41+
cd
42+
ifenslave -d bond0 "${iface}"
43+
ip addr change "${ip}/${cidr}" dev "${iface}"
44+
ip link set up dev "${iface}"

scripts/create-kubernetes-cluster.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ if [[ "$CALICO" == "on" ]]; then # calico
1515

1616
CALICO_MASTER_IP="10.0.0.$(( base_ip + 1 ))"
1717
CALICO_WORKER_IP="10.0.0.$(( base_ip + 2 ))"
18-
CALICO_SUBNET_MASK="30"
18+
CALICO_CIDR_PREFIX="30"
19+
CALICO_INTERFACE="eno2"
1920
fi
2021

2122
ENVS="KUBERNETES_VERSION CALICO"
@@ -53,24 +54,24 @@ wait_pids "${pids}" "SR-IOV config failed" || exit 21
5354

5455
if [[ "$CALICO" == "on" ]]; then # calico
5556
# 3. Create Calico scripts directory on nodes.
56-
ssh ${SSH_OPTS} root@${master_ip} mkdir calico || exit 31
57-
ssh ${SSH_OPTS} root@${worker_ip} mkdir calico || exit 32
57+
ssh ${SSH_OPTS} root@${master_ip} mkdir -p calico || exit 31
58+
ssh ${SSH_OPTS} root@${worker_ip} mkdir -p calico || exit 32
5859

5960
# 4. Setup Calico interfaces.
6061
scp ${SSH_OPTS} scripts/calico/setup-interfaces.sh root@${master_ip}:calico/setup-interfaces.sh || exit 41
6162
scp ${SSH_OPTS} scripts/calico/setup-interfaces.sh root@${worker_ip}:calico/setup-interfaces.sh || exit 42
6263

6364
pids=""
64-
ssh ${SSH_OPTS} root@${master_ip} ./calico/setup-interfaces.sh "${CALICO_MASTER_IP}/${CALICO_SUBNET_MASK}" &
65+
ssh ${SSH_OPTS} root@${master_ip} ./calico/setup-interfaces.sh "${CALICO_INTERFACE}" "${CALICO_MASTER_IP}" "${CALICO_CIDR_PREFIX}" &
6566
pids+=" $!"
66-
ssh ${SSH_OPTS} root@${worker_ip} ./calico/setup-interfaces.sh "${CALICO_WORKER_IP}/${CALICO_SUBNET_MASK}" &
67+
ssh ${SSH_OPTS} root@${worker_ip} ./calico/setup-interfaces.sh "${CALICO_INTERFACE}" "${CALICO_WORKER_IP}" "${CALICO_CIDR_PREFIX}" &
6768
pids+=" $!"
6869
wait_pids "${pids}" "setup Calico interfaces failed" || exit 43
6970
fi
7071

7172
# 5. Create k8s scripts directory on nodes.
72-
ssh ${SSH_OPTS} root@${master_ip} mkdir k8s || exit 51
73-
ssh ${SSH_OPTS} root@${worker_ip} mkdir k8s || exit 52
73+
ssh ${SSH_OPTS} root@${master_ip} mkdir -p k8s || exit 51
74+
ssh ${SSH_OPTS} root@${worker_ip} mkdir -p k8s || exit 52
7475

7576
# 6. Config docker.
7677
scp ${SSH_OPTS} scripts/k8s/config-docker.sh root@${master_ip}:k8s/config-docker.sh || exit 61

0 commit comments

Comments
 (0)