Skip to content

Commit bbf666a

Browse files
committed
PR feedback
1 parent bfac73b commit bbf666a

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

.github/workflows/cloud-runner-integrity.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ jobs:
4747
# Stop any existing LocalStack containers
4848
docker stop localstack-k3d 2>/dev/null || true
4949
docker rm localstack-k3d 2>/dev/null || true
50-
# Start LocalStack with port exposed, listening on all interfaces
50+
# Start LocalStack using host network mode so it's directly accessible
51+
# This ensures it's accessible from k3d pods via host.k3d.internal
5152
docker run -d --name localstack-k3d \
52-
-p 0.0.0.0:4566:4566 \
53+
--network host \
5354
-e SERVICES=s3,cloudformation,ecs,kinesis,cloudwatch,logs \
5455
-e DEBUG=1 \
5556
-e DOCKER_HOST=unix:///var/run/docker.sock \
@@ -67,6 +68,9 @@ jobs:
6768
done
6869
# Verify LocalStack is accessible
6970
curl -s http://localhost:4566/_localstack/health | head -5 || echo "LocalStack health check"
71+
# Show network info
72+
echo "LocalStack container network info:"
73+
docker inspect localstack-k3d | grep -i network -A 5 || true
7074
- name: Install awscli-local
7175
run: |
7276
pip install awscli-local || pip3 install awscli-local || echo "awslocal installation skipped"
@@ -96,11 +100,23 @@ jobs:
96100
kubectl get storageclass
97101
# Show node resources
98102
kubectl describe nodes | grep -A 5 "Allocated resources" || true
99-
# Test LocalStack connectivity from cluster
100-
echo "Testing LocalStack connectivity from k3d cluster via host.k3d.internal:4566..."
101-
kubectl run test-localstack --image=curlimages/curl --rm -i --restart=Never --timeout=10s -- \
102-
curl -s --max-time 5 http://host.k3d.internal:4566/_localstack/health 2>&1 | head -10 || \
103-
echo "Note: If this fails, LocalStack may need additional network configuration"
103+
# Get host gateway IP that k3d uses
104+
HOST_IP=$(docker inspect k3d-unity-builder-agent-0 | grep -i gateway | head -1 | grep -oE '"Gateway":"[^"]*"' | cut -d'"' -f4 || echo "")
105+
if [ -z "$HOST_IP" ]; then
106+
# Try alternative method
107+
HOST_IP=$(docker network inspect k3d-unity-builder | grep -i gateway | head -1 | grep -oE '"Gateway":"[^"]*"' | cut -d'"' -f4 || echo "")
108+
fi
109+
echo "Host gateway IP: $HOST_IP"
110+
echo "Testing LocalStack from host (should work):"
111+
curl -s --max-time 5 http://localhost:4566/_localstack/health | head -5 || echo "Host connectivity failed"
112+
echo "Testing LocalStack from k3d cluster via host.k3d.internal:4566..."
113+
kubectl run test-localstack-dns --image=curlimages/curl --rm -i --restart=Never --timeout=10s -- \
114+
curl -v --max-time 5 http://host.k3d.internal:4566/_localstack/health 2>&1 | head -15 || echo "DNS-based connectivity test completed"
115+
if [ -n "$HOST_IP" ]; then
116+
echo "Testing LocalStack from k3d cluster via host IP $HOST_IP:4566..."
117+
kubectl run test-localstack-ip --image=curlimages/curl --rm -i --restart=Never --timeout=10s -- \
118+
curl -v --max-time 5 http://$HOST_IP:4566/_localstack/health 2>&1 | head -15 || echo "IP-based connectivity test completed"
119+
fi
104120
- uses: actions/setup-node@v4
105121
with:
106122
node-version: 20

0 commit comments

Comments
 (0)