-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload-images-to-kind.sh
More file actions
executable file
·67 lines (53 loc) · 2.25 KB
/
Copy pathload-images-to-kind.sh
File metadata and controls
executable file
·67 lines (53 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# Load Docker images into Kind cluster
# Makes locally built images available to Kind
set -e
echo "========================================="
echo "Loading Images into Kind"
echo "========================================="
CLUSTER_NAME="mathwizz-cluster"
# Determine container runtime and image prefix
USE_PODMAN=false
IMAGE_PREFIX=""
if command -v podman &> /dev/null && [ -n "$KIND_EXPERIMENTAL_PROVIDER" ]; then
USE_PODMAN=true
IMAGE_PREFIX="localhost/"
fi
# Function to load image
load_image() {
local service=$1
local source_image="${IMAGE_PREFIX}mathwizz/${service}:latest"
local target_image="mathwizz/${service}:latest"
echo "Loading ${service} image..."
if [ "$USE_PODMAN" = true ]; then
# With Podman, we need to retag to remove localhost/ prefix,
# then save to tar and load as archive
# Clean up any leftover tar file from previous failed runs
rm -f /tmp/${service}.tar
# Create tag without localhost/ prefix (overwrites if exists)
podman tag ${source_image} ${target_image} || {
echo "Warning: Failed to tag ${source_image} as ${target_image}"
echo "This might happen if the image was deleted. Rebuilding..."
return 1
}
podman save -o /tmp/${service}.tar ${target_image}
kind load image-archive /tmp/${service}.tar --name $CLUSTER_NAME || echo "Warning: Image load reported error, but may have succeeded"
rm -f /tmp/${service}.tar
# Note: We don't clean up the ${target_image} tag - it's harmless and
# prevents issues with cached builds on subsequent runs
else
# With Docker, use direct docker-image load (requires BuildKit to be disabled)
# This is more reliable than tar archives when BuildKit is off
# Note: May report errors in Docker-in-Docker (act) but often still works
kind load docker-image mathwizz/${service}:latest --name $CLUSTER_NAME || echo "Warning: Image load reported error, but may have succeeded"
fi
echo "✓ ${service} image loaded"
}
# Load all images
load_image "database"
load_image "message-queue"
load_image "web-server"
load_image "history-worker"
load_image "frontend"
echo ""
echo "All images loaded into Kind successfully!"