44source scripts/dev/set_env_context.sh
55source scripts/funcs/install
66
7+
78set -Eeou pipefail
89
910set_limits () {
@@ -48,10 +49,10 @@ setup_local_registry_and_custom_image() {
4849 if [[ " ${ARCH} " == " ppc64le" ]]; then
4950 echo " >>> Setting up local registry and custom kicbase image for ppc64le..."
5051
51- # Check if local registry is running (with fallback for namespace issues )
52+ # Check if local registry is running (use 127.0.0.1 to avoid IPv6 fallback delay )
5253 registry_running=false
53- if curl -s http://localhost :5000/v2/_catalog > /dev/null 2>&1 ; then
54- echo " Registry detected via HTTP check (podman ps failed) "
54+ if curl -s --max-time 5 http://127.0.0.1 :5000/v2/_catalog > /dev/null 2>&1 ; then
55+ echo " Registry detected via HTTP check"
5556 registry_running=true
5657 fi
5758
@@ -61,15 +62,15 @@ setup_local_registry_and_custom_image() {
6162 # Clean up any existing registry first
6263 sudo podman rm -f registry 2> /dev/null || true
6364
64- if ! sudo podman run -d -p 5000:5000 --name registry --restart=always docker.io/library/registry:2; then
65+ if ! sudo podman run -d -p 127.0.0.1: 5000:5000 --name registry --restart=always docker.io/library/registry:2; then
6566 echo " ❌ Failed to start local registry - trying alternative approach"
6667 exit 1
6768 fi
6869
6970 # Wait for registry to be ready
7071 echo " Waiting for registry to be ready..."
7172 for _ in {1..30}; do
72- if curl -s http://localhost :5000/v2/_catalog > /dev/null 2>&1 ; then
73+ if curl -s --max-time 5 http://127.0.0.1 :5000/v2/_catalog > /dev/null 2>&1 ; then
7374 break
7475 fi
7576 sleep 1
@@ -78,31 +79,18 @@ setup_local_registry_and_custom_image() {
7879 echo " ✅ Local registry already running"
7980 fi
8081
81- # Configure podman to trust local registry (both user and root level for minikube )
82+ # Configure podman to trust local registry (rootful only since minikube uses sudo podman )
8283 echo " Configuring registries.conf to trust local registry..."
83-
84- # User-level config
85- mkdir -p ~ /.config/containers
86- cat > ~ /.config/containers/registries.conf << 'EOF '
87- [[registry]]
88- location = "localhost:5000"
89- insecure = true
90- EOF
91-
92- # Root-level config (since minikube uses sudo podman)
9384 sudo mkdir -p /root/.config/containers
9485 sudo tee /root/.config/containers/registries.conf << 'EOF ' >/dev/null
9586[[registry]]
9687location = "localhost:5000"
9788insecure = true
9889EOF
90+ echo " ✅ Registry configuration created"
9991
100- echo " ✅ Registry configuration created for both user and root"
101- custom_image_tag=" localhost:5000/kicbase:v0.0.47"
102-
103- # Determine image tag
104- custom_image_tag=" localhost:5000/kicbase:v0.0.47"
105- if curl -s http://localhost:5000/v2/kicbase/tags/list | grep -q " v0.0.47" ; then
92+ custom_image_tag=" localhost:5000/kicbase:v0.0.48"
93+ if curl -s --max-time 5 http://127.0.0.1:5000/v2/kicbase/tags/list | grep -q " v0.0.48" ; then
10694 echo " Custom kicbase image already exists in local registry"
10795 return 0
10896 fi
113101 # Build custom kicbase image
114102 mkdir -p " ${PROJECT_DIR:- .} /scripts/minikube/kicbase"
115103 cat > " ${PROJECT_DIR:- .} /scripts/minikube/kicbase/Dockerfile" << 'EOF '
116- FROM gcr.io/k8s-minikube/kicbase:v0.0.47
104+ FROM gcr.io/k8s-minikube/kicbase:v0.0.48
117105RUN if [ "$(uname -m)" = "ppc64le" ]; then \
118106 CRICTL_VERSION="v1.28.0" && \
119107 curl -L "https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-ppc64le.tar.gz" \
129117 echo " Failed to build custom image"
130118 return 1
131119 }
120+
121+ # Use 127.0.0.1 to avoid IPv6 issues with podman on ppc64le, we might bind to ipv6 and it might not work
122+ if ! curl -s --max-time 5 http://127.0.0.1:5000/v2/_catalog > /dev/null 2>&1 ; then
123+ echo " Registry not responding, restarting..."
124+ sudo podman rm -f registry 2> /dev/null || true
125+ sudo podman run -d -p 127.0.0.1:5000:5000 --name registry --restart=always docker.io/library/registry:2
126+ for _ in {1..15}; do
127+ if curl -s --max-time 5 http://127.0.0.1:5000/v2/_catalog > /dev/null 2>&1 ; then
128+ echo " Registry restarted successfully"
129+ break
130+ fi
131+ sleep 1
132+ done
133+ fi
134+
132135 sudo podman push " ${custom_image_tag} " --tls-verify=false || {
133136 echo " Failed to push to registry"
134137 return 1
139142 return 0
140143}
141144
142- # Start minikube with podman driver
145+ # Start minikube with podman driver (rootful mode for reliable networking)
143146start_minikube_cluster () {
144- echo " >>> Starting minikube cluster with podman driver..."
147+ echo " >>> Starting minikube cluster with podman driver (rootful mode)..."
148+
149+ if " ${PROJECT_DIR:- .} /bin/minikube" status & > /dev/null; then
150+ echo " ✅ Minikube is already running - verifying health..."
151+ if " ${PROJECT_DIR:- .} /bin/minikube" kubectl -- get nodes & > /dev/null; then
152+ echo " ✅ Minikube cluster is healthy - skipping setup"
153+ return 0
154+ else
155+ echo " ⚠️ Minikube running but unhealthy - will recreate"
156+ fi
157+ fi
145158
146159 # Clean up any existing minikube state to avoid cached configuration issues
147160 echo " Cleaning up any existing minikube state..."
@@ -153,19 +166,27 @@ start_minikube_cluster() {
153166 echo " Ensuring clean minikube state..."
154167 " ${PROJECT_DIR:- .} /bin/minikube" delete 2> /dev/null || true
155168
156- local start_args=(" --driver=podman" )
169+ # Clean up stale podman volumes
170+ echo " Cleaning up stale podman volumes..."
171+ sudo podman volume rm -f minikube 2> /dev/null || true
172+ sudo podman network rm -f minikube 2> /dev/null || true
173+
174+ # Use rootful podman - rootless has iptables/CNI issues on ppc64le and s390x
175+ local start_args=(" --driver=podman" " --container-runtime=containerd" " --rootless=false" )
157176 start_args+=(" --cpus=4" " --memory=8g" )
158177
159178 if [[ " ${ARCH} " == " ppc64le" ]]; then
160179 echo " Using custom kicbase image for ppc64le with crictl..."
161180
162- start_args+=(" --base-image=localhost:5000/kicbase:v0.0.47 " )
181+ start_args+=(" --base-image=localhost:5000/kicbase:v0.0.48 " )
163182 start_args+=(" --insecure-registry=localhost:5000" )
183+ # Use bridge CNI for ppc64le - kindnet doesn't have ppc64le images
184+ start_args+=(" --cni=bridge" )
185+ elif [[ " ${ARCH} " == " s390x" ]]; then
186+ # Use bridge CNI for s390x to avoid potential image availability issues
187+ start_args+=(" --cni=bridge" )
164188 fi
165189
166- # Use default bridge CNI to avoid Docker Hub rate limiting issues
167- # start_args+=("--cni=bridge")
168-
169190 echo " Starting minikube with args: ${start_args[*]} "
170191 if " ${PROJECT_DIR:- .} /bin/minikube" start " ${start_args[@]} " ; then
171192 echo " ✅ Minikube started successfully"
@@ -194,14 +215,6 @@ else
194215 exit 1
195216fi
196217
197- if [[ " ${ARCH} " == " ppc64le" ]]; then
198- echo " "
199- echo " >>> Note: crictl will be patched into the minikube container after startup"
200- else
201- echo " "
202- echo " >>> Using standard kicbase image (crictl included for x86_64/aarch64/s390x)"
203- fi
204-
205218# Start the minikube cluster
206219start_minikube_cluster
207220
0 commit comments