Skip to content

Commit d6dd968

Browse files
committed
calico
Signed-off-by: Artem Glazychev <[email protected]>
1 parent 13d68c0 commit d6dd968

9 files changed

+88
-72
lines changed

.github/workflows/ci.yaml

-5
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ jobs:
8787
env:
8888
GO111MODULE: on
8989
GOBIN: /bin
90-
- name: Checkout deployments # 4. Checkout deployments
91-
uses: actions/checkout@v2
92-
with:
93-
repository: networkservicemesh/deployments-k8s
94-
path: networkservicemesh/deployments-k8s
9590
- name: Compute suffix # 5. Compute suffix for cloudtest input and output paths
9691
id: suffix
9792
run: |

cloudtest/packet.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ providers:
1111
env:
1212
- CLUSTER_RULES_PREFIX=null # To not add any specific code
1313
- KUBECONFIG=$(tempdir)/config
14-
- CLUSTER_NAME=$(cluster-name)-$(date)-${GITHUB_RUN_NUMBER}-$(rands10)
14+
- CLUSTER_NAME=test-$(cluster-name)-$(date)-${GITHUB_RUN_NUMBER}-$(rands10)
1515
env-check:
1616
- PACKET_AUTH_TOKEN
1717
- PACKET_PROJECT_ID
@@ -37,10 +37,8 @@ providers:
3737
hardware-reservations:
3838
- 2cf78481-53b0-46c8-a084-6e9815acdb0b
3939
- 2361d3c2-f694-4fa7-a683-a9f69e2abe7c
40-
- 70b51e39-2e65-4a64-8191-dd28386c0b80
4140
- 4f27da36-a911-45a5-ab81-0e789348e3fe
4241
- 7741d4a8-8555-492b-8d73-63c2f0715d16
43-
- d173dbde-8510-454e-b0c2-c120c397cdf5
4442
scripts:
4543
install: "echo all deps installed"
4644
setup: |

go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ require (
88
github.com/stretchr/testify v1.7.0
99
gopkg.in/yaml.v2 v2.4.0 // indirect
1010
)
11+
12+
replace github.com/networkservicemesh/integration-tests => github.com/glazychev-art/integration-tests v0.0.0-20220225082059-2b2495896525

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoD
5656
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
5757
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
5858
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
59+
github.com/glazychev-art/integration-tests v0.0.0-20220225082059-2b2495896525 h1:5oPskwUElyd01o5JW4eWNCu4wrZ+FZsShcEAbil16ZY=
60+
github.com/glazychev-art/integration-tests v0.0.0-20220225082059-2b2495896525/go.mod h1:0o7WrzxlHEwnDSuZPEM1BnKd4hr7+akKgymoAoTTbv8=
5961
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
6062
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
6163
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@@ -158,8 +160,6 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8m
158160
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
159161
github.com/networkservicemesh/gotestmd v0.0.0-20211116145945-871d2aaf07ab h1:/dIr8Nky77grI3s9Rc78eFH9M1Svobyj2XJBaKm27ts=
160162
github.com/networkservicemesh/gotestmd v0.0.0-20211116145945-871d2aaf07ab/go.mod h1:8EWnekTRNX+NxBdTFE24WqUoM7SgJHbiafDBrIIdOmQ=
161-
github.com/networkservicemesh/integration-tests v0.0.0-20220224092342-e43fd2731d3f h1:qtM8AF8U8NggNijNb9dgkBxRNj8IFXO0IT0rnO+oeRs=
162-
github.com/networkservicemesh/integration-tests v0.0.0-20220224092342-e43fd2731d3f/go.mod h1:0o7WrzxlHEwnDSuZPEM1BnKd4hr7+akKgymoAoTTbv8=
163163
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
164164
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
165165
github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=

main_test.go

+33-51
Original file line numberDiff line numberDiff line change
@@ -17,65 +17,47 @@
1717
package main_test
1818

1919
import (
20-
"os"
20+
"github.com/networkservicemesh/integration-tests/suites/basic"
2121
"testing"
2222

2323
"github.com/stretchr/testify/suite"
24-
25-
"github.com/networkservicemesh/integration-tests/suites/calico"
26-
"github.com/networkservicemesh/integration-tests/suites/heal"
27-
"github.com/networkservicemesh/integration-tests/suites/memory"
28-
"github.com/networkservicemesh/integration-tests/suites/multiforwarder"
29-
"github.com/networkservicemesh/integration-tests/suites/observability"
30-
"github.com/networkservicemesh/integration-tests/suites/sriov"
3124
)
3225

33-
func isCalico() bool {
34-
return os.Getenv("CALICO") == "on"
35-
}
36-
37-
func TestMemory(t *testing.T) {
38-
if isCalico() {
39-
t.Skip("not available with Calico")
40-
}
41-
suite.Run(t, new(memory.Suite))
42-
}
43-
44-
func TestSRIOV(t *testing.T) {
45-
if isCalico() {
46-
t.Skip("not available with Calico")
47-
}
48-
suite.Run(t, new(sriov.Suite))
49-
}
50-
51-
func TestMultiForwarder(t *testing.T) {
52-
if isCalico() {
53-
t.Skip("not available with Calico")
54-
}
55-
suite.Run(t, new(multiforwarder.Suite))
56-
}
26+
//func isCalico() bool {
27+
// return os.Getenv("CALICO") == "on"
28+
//}
5729

58-
func TestHeal(t *testing.T) {
59-
if isCalico() {
60-
t.Skip("not available with Calico")
61-
}
62-
suite.Run(t, new(heal.Suite))
63-
}
30+
//func TestMemory(t *testing.T) {
31+
// suite.Run(t, new(memory.Suite))
32+
//}
33+
//
34+
//func TestSRIOV(t *testing.T) {
35+
// suite.Run(t, new(sriov.Suite))
36+
//}
37+
//
38+
//func TestMultiForwarder(t *testing.T) {
39+
// suite.Run(t, new(multiforwarder.Suite))
40+
//}
41+
//
42+
//func TestHeal(t *testing.T) {
43+
// suite.Run(t, new(heal.Suite))
44+
//}
6445

65-
func TestRunObservabilitySuite(t *testing.T) {
66-
suite.Run(t, new(observability.Suite))
67-
}
46+
//func TestRunObservabilitySuite(t *testing.T) {
47+
// suite.Run(t, new(observability.Suite))
48+
//}
6849

6950
func TestBasic(t *testing.T) {
70-
if isCalico() {
71-
t.Skip("not available with Calico")
72-
}
7351
suite.Run(t, new(basic.Suite))
7452
}
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-
}
53+
//
54+
//func TestRunFeatureSuiteSingle(t *testing.T) {
55+
// suite.Run(t, new(features.Suite))
56+
//}
57+
58+
//func TestCalico(t *testing.T) {
59+
// if !isCalico() {
60+
// t.Skip("not available without Calico")
61+
// }
62+
// suite.Run(t, new(calico.Suite))
63+
//}

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/glazychev-art/test-repo/calico/calico-vpp-nohuge.yaml
77

88
patchesStrategicMerge:
99
- patch.yaml

scripts/calico/setup-interfaces.sh

+33-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,37 @@
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+
[ $1 -gt 1 ] && shift $1 || shift
10+
echo ${1-0}.${2-0}.${3-0}.${4-0}
11+
}
612

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

scripts/calico/unbond-interface.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
cd /etc/network/
6+
awk -v pattern="iface $1" '$0 ~ pattern {print $0; getline; while($0 != "") {if($1=="bond-master") {next; break}; print; getline}} 1' interfaces > interfaces.tmp && mv interfaces.tmp interfaces
7+
cd
8+
ifenslave -d bond0 $1

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)