mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Merge pull request #1758 from marquiz/devel/e2e-presubmit
scripts: refresh e2e-presubmit test script
This commit is contained in:
commit
dcc03a6296
1 changed files with 11 additions and 45 deletions
|
@ -2,66 +2,32 @@
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
# Configure environment
|
# Configure environment
|
||||||
KIND_IMAGE="kindest/node:v1.25.3"
|
export KIND_VERSION="v0.23.0"
|
||||||
export IMAGE_REGISTRY="localhost:5001"
|
export KIND_NODE_IMAGE="kindest/node:v1.30.2"
|
||||||
export CLUSTER_NAME=$(git describe --tags --dirty --always)
|
export CLUSTER_NAME="nfd-e2e"
|
||||||
export KUBECONFIG="/tmp/kubeconfig_$CLUSTER_NAME"
|
export KUBECONFIG="/tmp/kubeconfig_$CLUSTER_NAME"
|
||||||
|
export IMAGE_REPO="registry.local/node-feature-discovery"
|
||||||
|
export IMAGE_TAG_NAME=$(git describe --tags --dirty --always)
|
||||||
|
|
||||||
# create registry container unless it already exists
|
# Install kind
|
||||||
reg_name='kind-registry'
|
go install sigs.k8s.io/kind@$KIND_VERSION
|
||||||
reg_port='5001'
|
|
||||||
if [ "$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" != 'true' ]; then
|
|
||||||
docker run \
|
|
||||||
-d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \
|
|
||||||
registry:2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# create a cluster with the local registry enabled in containerd
|
# create a cluster with the local registry enabled in containerd
|
||||||
cat <<EOF | kind create cluster --kubeconfig $KUBECONFIG --config=-
|
cat <<EOF | kind create cluster --kubeconfig $KUBECONFIG --image $KIND_NODE_IMAGE --config=-
|
||||||
kind: Cluster
|
kind: Cluster
|
||||||
apiVersion: kind.x-k8s.io/v1alpha4
|
apiVersion: kind.x-k8s.io/v1alpha4
|
||||||
name: $CLUSTER_NAME
|
name: $CLUSTER_NAME
|
||||||
nodes:
|
nodes:
|
||||||
- role: control-plane
|
- role: control-plane
|
||||||
image: $KIND_IMAGE
|
|
||||||
- role: worker
|
- role: worker
|
||||||
image: $KIND_IMAGE
|
|
||||||
- role: worker
|
- role: worker
|
||||||
image: $KIND_IMAGE
|
|
||||||
containerdConfigPatches:
|
|
||||||
- |-
|
|
||||||
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"]
|
|
||||||
endpoint = ["http://${reg_name}:5000"]
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# connect the registry to the cluster network if not already connected
|
|
||||||
if [ "$(docker inspect -f='{{json .NetworkSettings.Networks.kind}}' "${reg_name}")" = 'null' ]; then
|
|
||||||
docker network connect "kind" "${reg_name}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat <<EOF | kubectl apply -f -
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ConfigMap
|
|
||||||
metadata:
|
|
||||||
name: local-registry-hosting
|
|
||||||
namespace: kube-public
|
|
||||||
data:
|
|
||||||
localRegistryHosting.v1: |
|
|
||||||
host: "localhost:${reg_port}"
|
|
||||||
help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# build the local image
|
# build the local image
|
||||||
make image
|
make image IMAGE_REPO=$IMAGE_REPO IMAGE_TAG_NAME=$IMAGE_TAG_NAME
|
||||||
|
|
||||||
# push the image to the local registry
|
# push the image to the local registry
|
||||||
make push
|
kind load docker-image $IMAGE_REPO:$IMAGE_TAG_NAME --name $CLUSTER_NAME
|
||||||
|
|
||||||
# run the tests
|
# run the tests
|
||||||
make e2e-test || rc=$?
|
make e2e-test IMAGE_REPO=$IMAGE_REPO IMAGE_TAG_NAME=$IMAGE_TAG_NAME E2E_PULL_IF_NOT_PRESENT=true
|
||||||
|
|
||||||
# clean up the environment
|
|
||||||
kind delete cluster --kubeconfig $KUBECONFIG --name $CLUSTER_NAME
|
|
||||||
echo "Deleting ${reg_name} container ..."
|
|
||||||
docker rm -f "${reg_name}"
|
|
||||||
exit $rc
|
|
||||||
|
|
Loading…
Reference in a new issue