diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 02265945..225ee5cf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -87,11 +87,6 @@ jobs: env: GO111MODULE: on GOBIN: /bin - - name: Checkout deployments # 4. Checkout deployments - uses: actions/checkout@v2 - with: - repository: networkservicemesh/deployments-k8s - path: networkservicemesh/deployments-k8s - name: Compute suffix # 5. Compute suffix for cloudtest input and output paths id: suffix run: | diff --git a/cloudtest/packet.yaml b/cloudtest/packet.yaml index 08d2fbb0..8437f6e2 100644 --- a/cloudtest/packet.yaml +++ b/cloudtest/packet.yaml @@ -11,7 +11,7 @@ providers: env: - CLUSTER_RULES_PREFIX=null # To not add any specific code - KUBECONFIG=$(tempdir)/config - - CLUSTER_NAME=$(cluster-name)-$(date)-${GITHUB_RUN_NUMBER}-$(rands10) + - CLUSTER_NAME=test-$(cluster-name)-$(date)-${GITHUB_RUN_NUMBER}-$(rands10) env-check: - PACKET_AUTH_TOKEN - PACKET_PROJECT_ID @@ -37,10 +37,8 @@ providers: hardware-reservations: - 2cf78481-53b0-46c8-a084-6e9815acdb0b - 2361d3c2-f694-4fa7-a683-a9f69e2abe7c - - 70b51e39-2e65-4a64-8191-dd28386c0b80 - 4f27da36-a911-45a5-ab81-0e789348e3fe - 7741d4a8-8555-492b-8d73-63c2f0715d16 - - d173dbde-8510-454e-b0c2-c120c397cdf5 scripts: install: "echo all deps installed" setup: | diff --git a/go.mod b/go.mod index 9da1ddad..7bcce149 100644 --- a/go.mod +++ b/go.mod @@ -8,3 +8,5 @@ require ( github.com/stretchr/testify v1.7.0 gopkg.in/yaml.v2 v2.4.0 // indirect ) + +replace github.com/networkservicemesh/integration-tests => github.com/glazychev-art/integration-tests v0.0.0-20220225082059-2b2495896525 diff --git a/go.sum b/go.sum index 8f7a6afc..7631a963 100644 --- a/go.sum +++ b/go.sum @@ -56,6 +56,8 @@ github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoD github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/glazychev-art/integration-tests v0.0.0-20220225082059-2b2495896525 h1:5oPskwUElyd01o5JW4eWNCu4wrZ+FZsShcEAbil16ZY= +github.com/glazychev-art/integration-tests v0.0.0-20220225082059-2b2495896525/go.mod h1:0o7WrzxlHEwnDSuZPEM1BnKd4hr7+akKgymoAoTTbv8= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= 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 github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/networkservicemesh/gotestmd v0.0.0-20211116145945-871d2aaf07ab h1:/dIr8Nky77grI3s9Rc78eFH9M1Svobyj2XJBaKm27ts= github.com/networkservicemesh/gotestmd v0.0.0-20211116145945-871d2aaf07ab/go.mod h1:8EWnekTRNX+NxBdTFE24WqUoM7SgJHbiafDBrIIdOmQ= -github.com/networkservicemesh/integration-tests v0.0.0-20220224092342-e43fd2731d3f h1:qtM8AF8U8NggNijNb9dgkBxRNj8IFXO0IT0rnO+oeRs= -github.com/networkservicemesh/integration-tests v0.0.0-20220224092342-e43fd2731d3f/go.mod h1:0o7WrzxlHEwnDSuZPEM1BnKd4hr7+akKgymoAoTTbv8= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= diff --git a/main_test.go b/main_test.go index 07498b6b..d837a681 100644 --- a/main_test.go +++ b/main_test.go @@ -17,65 +17,47 @@ package main_test import ( - "os" + "github.com/networkservicemesh/integration-tests/suites/basic" "testing" "github.com/stretchr/testify/suite" - - "github.com/networkservicemesh/integration-tests/suites/calico" - "github.com/networkservicemesh/integration-tests/suites/heal" - "github.com/networkservicemesh/integration-tests/suites/memory" - "github.com/networkservicemesh/integration-tests/suites/multiforwarder" - "github.com/networkservicemesh/integration-tests/suites/observability" - "github.com/networkservicemesh/integration-tests/suites/sriov" ) -func isCalico() bool { - return os.Getenv("CALICO") == "on" -} - -func TestMemory(t *testing.T) { - if isCalico() { - t.Skip("not available with Calico") - } - suite.Run(t, new(memory.Suite)) -} - -func TestSRIOV(t *testing.T) { - if isCalico() { - t.Skip("not available with Calico") - } - suite.Run(t, new(sriov.Suite)) -} - -func TestMultiForwarder(t *testing.T) { - if isCalico() { - t.Skip("not available with Calico") - } - suite.Run(t, new(multiforwarder.Suite)) -} +//func isCalico() bool { +// return os.Getenv("CALICO") == "on" +//} -func TestHeal(t *testing.T) { - if isCalico() { - t.Skip("not available with Calico") - } - suite.Run(t, new(heal.Suite)) -} +//func TestMemory(t *testing.T) { +// suite.Run(t, new(memory.Suite)) +//} +// +//func TestSRIOV(t *testing.T) { +// suite.Run(t, new(sriov.Suite)) +//} +// +//func TestMultiForwarder(t *testing.T) { +// suite.Run(t, new(multiforwarder.Suite)) +//} +// +//func TestHeal(t *testing.T) { +// suite.Run(t, new(heal.Suite)) +//} -func TestRunObservabilitySuite(t *testing.T) { - suite.Run(t, new(observability.Suite)) -} +//func TestRunObservabilitySuite(t *testing.T) { +// suite.Run(t, new(observability.Suite)) +//} func TestBasic(t *testing.T) { - if isCalico() { - t.Skip("not available with Calico") - } suite.Run(t, new(basic.Suite)) } - -func TestCalico(t *testing.T) { - if !isCalico() { - t.Skip("not available without Calico") - } - suite.Run(t, new(calico.Suite)) -} +// +//func TestRunFeatureSuiteSingle(t *testing.T) { +// suite.Run(t, new(features.Suite)) +//} + +//func TestCalico(t *testing.T) { +// if !isCalico() { +// t.Skip("not available without Calico") +// } +// suite.Run(t, new(calico.Suite)) +//} diff --git a/scripts/calico/kustomization.yaml b/scripts/calico/kustomization.yaml index 446d8683..d395133a 100644 --- a/scripts/calico/kustomization.yaml +++ b/scripts/calico/kustomization.yaml @@ -3,7 +3,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - https://raw.githubusercontent.com/projectcalico/vpp-dataplane/v0.17.0-calicov3.20.2/yaml/generated/calico-vpp-nohuge.yaml + - https://raw.githubusercontent.com/glazychev-art/test-repo/calico/calico-vpp-nohuge.yaml patchesStrategicMerge: - patch.yaml diff --git a/scripts/calico/setup-interfaces.sh b/scripts/calico/setup-interfaces.sh index c093f56b..1117e7d8 100755 --- a/scripts/calico/setup-interfaces.sh +++ b/scripts/calico/setup-interfaces.sh @@ -2,7 +2,37 @@ set -e -ip="$1" +cdr2mask () +{ + # Number of args to shift, 255..255, first non-255 byte, zeroes + set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0 + [ $1 -gt 1 ] && shift $1 || shift + echo ${1-0}.${2-0}.${3-0}.${4-0} +} -ip addr add "${ip}" dev eno2 -ip link set up dev eno2 +iface="$1" +ip="$2" +cidr="$3" +mask=$(cdr2mask $3) + +cd /etc/network/ +awk -v pattern="iface $1 inet" -v ip="$2" -v mask="$mask" ' + $0 ~ pattern { + printf "%s static\n",pattern; + printf " address %s\n",ip; + printf " netmask %s\n",mask; + getline; + while ($0 != "") { + if ($1=="bond-master") { + next; + break + }; + print; + getline + } + } 1 +' interfaces > interfaces.tmp && mv interfaces.tmp interfaces +cd +ifenslave -d bond0 "${iface}" +ip addr change "${ip}/${cidr}" dev "${iface}" +ip link set up dev "${iface}" diff --git a/scripts/calico/unbond-interface.sh b/scripts/calico/unbond-interface.sh new file mode 100755 index 00000000..0ef79ba1 --- /dev/null +++ b/scripts/calico/unbond-interface.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +cd /etc/network/ +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 +cd +ifenslave -d bond0 $1 diff --git a/scripts/create-kubernetes-cluster.sh b/scripts/create-kubernetes-cluster.sh index b5529dba..cff6172b 100755 --- a/scripts/create-kubernetes-cluster.sh +++ b/scripts/create-kubernetes-cluster.sh @@ -15,7 +15,8 @@ if [[ "$CALICO" == "on" ]]; then # calico CALICO_MASTER_IP="10.0.0.$(( base_ip + 1 ))" CALICO_WORKER_IP="10.0.0.$(( base_ip + 2 ))" - CALICO_SUBNET_MASK="30" + CALICO_CIDR_PREFIX="30" + CALICO_INTERFACE="eno2" fi ENVS="KUBERNETES_VERSION CALICO" @@ -53,24 +54,24 @@ wait_pids "${pids}" "SR-IOV config failed" || exit 21 if [[ "$CALICO" == "on" ]]; then # calico # 3. Create Calico scripts directory on nodes. - ssh ${SSH_OPTS} root@${master_ip} mkdir calico || exit 31 - ssh ${SSH_OPTS} root@${worker_ip} mkdir calico || exit 32 + ssh ${SSH_OPTS} root@${master_ip} mkdir -p calico || exit 31 + ssh ${SSH_OPTS} root@${worker_ip} mkdir -p calico || exit 32 # 4. Setup Calico interfaces. scp ${SSH_OPTS} scripts/calico/setup-interfaces.sh root@${master_ip}:calico/setup-interfaces.sh || exit 41 scp ${SSH_OPTS} scripts/calico/setup-interfaces.sh root@${worker_ip}:calico/setup-interfaces.sh || exit 42 pids="" - ssh ${SSH_OPTS} root@${master_ip} ./calico/setup-interfaces.sh "${CALICO_MASTER_IP}/${CALICO_SUBNET_MASK}" & + ssh ${SSH_OPTS} root@${master_ip} ./calico/setup-interfaces.sh "${CALICO_INTERFACE}" "${CALICO_MASTER_IP}" "${CALICO_CIDR_PREFIX}" & pids+=" $!" - ssh ${SSH_OPTS} root@${worker_ip} ./calico/setup-interfaces.sh "${CALICO_WORKER_IP}/${CALICO_SUBNET_MASK}" & + ssh ${SSH_OPTS} root@${worker_ip} ./calico/setup-interfaces.sh "${CALICO_INTERFACE}" "${CALICO_WORKER_IP}" "${CALICO_CIDR_PREFIX}" & pids+=" $!" wait_pids "${pids}" "setup Calico interfaces failed" || exit 43 fi # 5. Create k8s scripts directory on nodes. -ssh ${SSH_OPTS} root@${master_ip} mkdir k8s || exit 51 -ssh ${SSH_OPTS} root@${worker_ip} mkdir k8s || exit 52 +ssh ${SSH_OPTS} root@${master_ip} mkdir -p k8s || exit 51 +ssh ${SSH_OPTS} root@${worker_ip} mkdir -p k8s || exit 52 # 6. Config docker. scp ${SSH_OPTS} scripts/k8s/config-docker.sh root@${master_ip}:k8s/config-docker.sh || exit 61