Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the cause of failure of multiple kind job runs on same VM #6468

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ TEST_ARGS ?=
# If we have stdin we can run interactive so the tests running in docker can be interrupted.
INTERACTIVE_ARGS := $(shell [ -t 0 ] && echo "-it")

BUILD_TAG :=
ifndef CUSTOM_BUILD_TAG
BUILD_TAG = $(shell build/images/build-tag.sh)
else
BUILD_TAG = $(CUSTOM_BUILD_TAG)
DOCKER_IMG_VERSION = $(CUSTOM_BUILD_TAG)
endif

DOCKER_BUILD_ARGS :=
ifeq ($(NO_PULL),)
DOCKER_BUILD_ARGS += --pull
Expand All @@ -57,7 +49,6 @@ ifneq ($(DOCKER_TARGETPLATFORM),)
endif
DOCKER_BUILD_ARGS += --build-arg OVS_VERSION=$(OVS_VERSION)
DOCKER_BUILD_ARGS += --build-arg GO_VERSION=$(GO_VERSION)
DOCKER_BUILD_ARGS += --build-arg BUILD_TAG=$(BUILD_TAG)

export CGO_ENABLED

Expand All @@ -66,6 +57,17 @@ all: build

include versioning.mk

# This should be located after the include directive for versioning.mk,
# so that we can override DOCKER_IMG_VERSION with CUSTOM_BUILD_TAG.
BUILD_TAG :=
jainpulkit22 marked this conversation as resolved.
Show resolved Hide resolved
ifndef CUSTOM_BUILD_TAG
BUILD_TAG = $(shell build/images/build-tag.sh)
else
BUILD_TAG = $(CUSTOM_BUILD_TAG)
DOCKER_IMG_VERSION = $(CUSTOM_BUILD_TAG)
endif
DOCKER_BUILD_ARGS += --build-arg BUILD_TAG=$(BUILD_TAG)

LDFLAGS += $(VERSION_LDFLAGS)

UNAME_S := $(shell uname -s)
Expand Down
9 changes: 4 additions & 5 deletions ci/jenkins/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ Run K8s e2e community tests (Conformance & Network Policy) or Antrea e2e tests o
--kind-cluster-name Name of the kind Cluster.
--proxyall Enable proxyAll to test AntreaProxy.
--build-tag Custom build tag for images.
--docker-user Username for Docker account.
--docker-password Password for Docker account."
--docker-user Username for Docker account.
--docker-password Password for Docker account."

function print_usage {
echoerr "$_usage"
Expand Down Expand Up @@ -201,7 +201,7 @@ function clean_antrea {
for antrea_yml in ${WORKDIR}/*.yml; do
kubectl delete -f $antrea_yml --ignore-not-found=true || true
done
docker images --format "{{.Repository}}:{{.Tag}}" | grep 'antrea'| xargs -r docker rmi -f || true
docker images --format "{{.Repository}}:{{.Tag}}" | grep ${BUILD_TAG} | xargs -r docker rmi || true
docker images | grep '<none>' | awk '{print $3}' | xargs -r docker rmi || true
check_and_cleanup_docker_build_cache
}
Expand Down Expand Up @@ -608,7 +608,6 @@ function deliver_antrea {
kind load docker-image antrea/antrea-agent-ubuntu:$BUILD_TAG --name ${KIND_CLUSTER}
kind load docker-image antrea/antrea-controller-ubuntu:$BUILD_TAG --name ${KIND_CLUSTER}
kind load docker-image antrea/flow-aggregator:latest --name ${KIND_CLUSTER}
kubectl config use-context kind-${KIND_CLUSTER}
jainpulkit22 marked this conversation as resolved.
Show resolved Hide resolved
docker cp ./build/yamls/antrea.yml ${KIND_CLUSTER}-control-plane:/root/antrea.yml
elif [[ $TESTBED_TYPE == "jumper" ]]; then
kubectl get nodes -o wide --no-headers=true | awk '{print $6}' | while read IP; do
Expand Down Expand Up @@ -674,7 +673,7 @@ function run_e2e {
if [[ $TESTBED_TYPE == "flexible-ipam" ]]; then
go test -v antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider remote -timeout=100m --prometheus --antrea-ipam
elif [[ $TESTBED_TYPE == "kind" ]]; then
go test -v antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider kind -timeout=100m --prometheus
go test -v antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider kind --kind.kubeconfig ${KUBECONFIG_PATH} -timeout=100m --prometheus
elif [[ $TESTBED_TYPE == "kind-flexible-ipam" ]]; then
go test -v antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider kind -timeout=100m --prometheus --antrea-ipam
else
Expand Down
14 changes: 6 additions & 8 deletions test/e2e/providers/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package providers

import (
"flag"
"fmt"
"os"
"path"
Expand All @@ -23,6 +24,8 @@ import (
"antrea.io/antrea/test/e2e/providers/exec"
)

var kindKubeconfigPath = flag.String("kind.kubeconfig", path.Join(homedir, ".kube", "config"), "Path of the kubeconfig of the cluster")
jainpulkit22 marked this conversation as resolved.
Show resolved Hide resolved

type KindProvider struct {
controlPlaneNodeName string
}
Expand All @@ -47,15 +50,10 @@ func (provider *KindProvider) RunCommandOnNodeExt(nodeName, cmd string, envs map
}

func (provider *KindProvider) GetKubeconfigPath() (string, error) {
homeDir, err := os.UserHomeDir()
if err != nil {
return "", fmt.Errorf("error when retrieving user home directory: %v", err)
}
kubeconfigPath := path.Join(homeDir, ".kube", "config")
if _, err := os.Stat(kubeconfigPath); os.IsNotExist(err) {
return "", fmt.Errorf("Kubeconfig file not found at expected location '%s'", kubeconfigPath)
if _, err := os.Stat(*kindKubeconfigPath); os.IsNotExist(err) {
return "", fmt.Errorf("Kubeconfig file not found at expected location '%s'", *kindKubeconfigPath)
}
return kubeconfigPath, nil
return *kindKubeconfigPath, nil
}

// enableKubectlOnControlPlane copies the Kubeconfig file on the Kind control-plane / control-plane Node to the
Expand Down
Loading