Skip to content
Merged
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
3 changes: 2 additions & 1 deletion misc/snapshotter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ RUN apk add -q --no-cache curl && \

FROM base AS kubectl-sourcer
ARG TARGETARCH
ARG KUBE_VER=v1.30.2

RUN apk add -q --no-cache curl && \
curl -fsSL -o /usr/bin/kubectl https://dl.k8s.io/release/"$(curl -L -s https://dl.k8s.io/release/stable.txt)"/bin/linux/"$TARGETARCH"/kubectl && \
curl -fsSL -o /usr/bin/kubectl https://dl.k8s.io/release/${KUBE_VER}/bin/linux/${TARGETARCH}/kubectl && \
chmod +x /usr/bin/kubectl

FROM base
Expand Down
33 changes: 0 additions & 33 deletions tests/e2e/k8s/containerd.config.toml

This file was deleted.

8 changes: 5 additions & 3 deletions tests/e2e/k8s/kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
ipFamily: dual
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".containerd]
discard_unpacked_layers = false
disable_snapshot_annotations = false
nodes:
- role: control-plane
image: kindest/node:v1.30.2
extraMounts:
- hostPath: ./tests/e2e/k8s/containerd.config.toml
containerPath: /etc/containerd/config.toml
- hostPath: /dev/fuse
containerPath: /dev/fuse
18 changes: 15 additions & 3 deletions tests/helpers/kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ readonly root


KIND_VERSION=v0.23.0
KUBE_VERSION=v1.30.2
NYDUS_VERSION=v2.3.0
DOCKER_USER=testuser
DOCKER_PASSWORD=testpassword
Expand Down Expand Up @@ -47,7 +48,7 @@ cp -r misc/snapshotter/* ./

log::info "Building... docker image"
pwd
exec::docker build --build-arg NYDUS_VER="$NYDUS_VERSION" -t local-dev:e2e .
exec::docker build --build-arg NYDUS_VER="$NYDUS_VERSION" --build-arg KUBE_VER="$KUBE_VERSION" -t local-dev:e2e .

# Start local registry, and configure docker
log::info "Starting registry"
Expand All @@ -66,7 +67,7 @@ docker::login "$DOCKER_USER" "$DOCKER_PASSWORD" "$registry_url"
# Install dependencies
log::info "Installing host dependencies"
install::kind "$KIND_VERSION"
install::kubectl
install::kubectl "$KUBE_VERSION"
install::nydus "$NYDUS_VERSION"

# Convert a nydus image and push it
Expand All @@ -80,7 +81,7 @@ exec::nydusify convert \
# Create fresh cluster
log::info "Creating new cluster"
exec::kind delete cluster 2>/dev/null || true
exec::kind create cluster
exec::kind create cluster --config tests/e2e/k8s/kind.yaml --image "kindest/node:$KUBE_VERSION"
exec::kind load docker-image local-dev:e2e

# Deploy nydus
Expand All @@ -106,6 +107,17 @@ exec::kubectl create --namespace "$NAMESPACE" secret generic regcred \
if [ "$AUTH_TYPE" == "cri" ]; then
exec::docker exec kind-control-plane sh -c 'echo " --image-service-endpoint=unix:///run/containerd-nydus/containerd-nydus-grpc.sock" >> /etc/default/kubelet'
exec::docker exec kind-control-plane sh -c 'systemctl daemon-reload && systemctl restart kubelet'
# The API server may become briefly unavailable after the kubelet
# restart. Wait for it to recover before issuing kubectl commands.
log::info "Waiting for API server to recover"
for _ in $(seq 1 10); do
kubectl get --raw /healthz &>/dev/null && break
sleep 2
done
kubectl get --raw /healthz &>/dev/null || {
log::error "API server did not recover within 20s"
exit 1
}
fi

exec::kubectl apply -f tests/e2e/k8s/test-pod.yaml
Expand Down