Skip to content

Commit

Permalink
push to registry
Browse files Browse the repository at this point in the history
Signed-off-by: Rajat Jindal <[email protected]>
  • Loading branch information
rajatjindal committed Apr 22, 2024
1 parent 20dbf69 commit 1cb79f0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ jobs:
- name: Extract containerd-shim-spin-linux-${{ env.ARCH }}
run: |
mkdir -p ./bin
wget https://github.com/spinkube/containerd-shim-spin/releases/download/v0.13.1/containerd-shim-spin-v2-linux-x86_64.tar.gz
tar -xvf containerd-shim-spin-v2-linux-x86_64.tar.gz -C ./bin
wget https://spin-shim-distro-tbejvvom.fermyon.app/static/containerd-shim-spin-v2 -O ./bin/containerd-shim-spin-v2
- name: install k3d
run: make install-k3d
working-directory: ./deployments/k3d
Expand Down
17 changes: 12 additions & 5 deletions scripts/up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,25 @@ IMAGES=("spin-hello-world" "spin-keyvalue" "spin-outbound-redis" "spin-multi-tri
# build the Docker image for the k3d cluster
docker build -t k3d-shim-test "$dockerfile_path"

k3d cluster create "$cluster_name" --image k3d-shim-test --api-port 6551 -p '8082:80@loadbalancer' --agents 2
k3d cluster create "$cluster_name" \
--image k3d-shim-test --api-port 6551 -p '8082:80@loadbalancer' --agents 2 \
--registry-create test-registry:0.0.0.0:5000

kubectl wait --for=condition=ready node --all --timeout=120s

# Iterate through the Docker images and build them
for i in "${!DOCKER_IMAGES[@]}"; do
docker buildx build -t "${IMAGES[$i]}:latest" "./images/${DOCKER_IMAGES[$i]}" --load
mkdir -p "${OUT_DIRS[$i]}"
docker save -o "${OUT_DIRS[$i]}/img.tar" "${IMAGES[$i]}:latest"
k3d image import "${OUT_DIRS[$i]}/img.tar" -c "$cluster_name"
## we can push images to localhost:5000 registry, and pull will still work using registry name
docker buildx build -t "localhost:5000/${IMAGES[$i]}:latest" "./images/${DOCKER_IMAGES[$i]}"
docker push "localhost:5000/${IMAGES[$i]}:latest"
done

sleep 5

## wait for middleware crd. without this intermittent failures occur on local setup
for run in {1..60}; do
kubectl get crd/middlewares.traefik.containo.us && break || echo "waiting for traefik crd. try #$run of 60"
sleep 1
done

echo ">>> cluster is ready"
10 changes: 5 additions & 5 deletions tests/workloads/workload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ spec:
runtimeClassName: wasmtime-spin
containers:
- name: testwasm
image: docker.io/library/spin-hello-world:latest
imagePullPolicy: Never # prevent k8s from pulling the image from a registry
image: test-registry:5000/spin-hello-world:latest
imagePullPolicy: IfNotPresent
command: ["/"]
resources: # limit the resources to 128Mi of memory and 100m of CPU
limits:
Expand Down Expand Up @@ -55,7 +55,7 @@ spec:
runtimeClassName: wasmtime-spin
containers:
- name: keyvalue
image: docker.io/library/spin-keyvalue:latest
image: test-registry:5000/spin-keyvalue:latest
command: ["/"]
imagePullPolicy: IfNotPresent
volumeMounts:
Expand Down Expand Up @@ -98,7 +98,7 @@ spec:
runtimeClassName: wasmtime-spin
containers:
- name: outbound-redis
image: docker.io/library/spin-outbound-redis:latest
image: test-registry:5000/spin-outbound-redis:latest
command: ["/"]
imagePullPolicy: IfNotPresent
env:
Expand Down Expand Up @@ -192,7 +192,7 @@ spec:
runtimeClassName: wasmtime-spin
containers:
- name: spin-multi-trigger-app
image: docker.io/library/spin-multi-trigger-app:latest
image: test-registry:5000/spin-multi-trigger-app:latest
imagePullPolicy: IfNotPresent
command: ["/"]
ports:
Expand Down

0 comments on commit 1cb79f0

Please sign in to comment.