3232allow_k8s_contexts (['kind-kube-startup-cpu-boost' ])
3333
3434# Configure default registry for Kind cluster
35- # Explicitly set registry to avoid auto-detection from ConfigMap
36- # The registry is set up by scripts/setup_kind.py as 'kind-registry' on localhost:5001
37- # host_from_cluster uses the container name 'kind-registry:5001' which Docker DNS resolves
38- # Note: Both host and container use port 5001 to avoid conflict with macOS AirPlay Receiver (port 5000)
39- default_registry (
40- 'localhost:5001' , # Registry host as seen from local machine (port 5001)
41- host_from_cluster = 'kind-registry:5001' # Registry host as seen from within Kind cluster (container port 5001)
42- )
35+ # Containerd mirrors localhost:5001 to kind-registry:5000 automatically
36+ # We use localhost:5001 everywhere - containerd handles the translation
37+ default_registry ('localhost:5001' )
4338
4439# Suppress warning for custom_build image that uses full registry path
4540# We use custom_build with explicit registry path, so Tilt won't find the image name in manifests
@@ -115,15 +110,13 @@ local_resource(
115110BINARY_PATH = 'bin/manager'
116111IMAGE_NAME = 'kube-startup-cpu-boost'
117112# Registry as seen from host (for docker push)
113+ # Containerd will mirror localhost:5001 to kind-registry:5000 automatically
118114REGISTRY_HOST = 'localhost:5001'
119- # Registry as seen from inside Kind cluster (for Kubernetes image pull)
120- REGISTRY_CLUSTER = 'kind-registry:5001'
121- FULL_IMAGE_NAME_HOST = '%s/%s' % (REGISTRY_HOST , IMAGE_NAME )
122- FULL_IMAGE_NAME_CLUSTER = '%s/%s' % (REGISTRY_CLUSTER , IMAGE_NAME )
115+ FULL_IMAGE_NAME = '%s/%s' % (REGISTRY_HOST , IMAGE_NAME )
123116# Use unique tag per build to prevent Kubernetes from using cached images
124117# Git hash ensures each build has a unique image tag
125118IMAGE_TAG = 'tilt-' + str (local ('git rev-parse --short HEAD 2>/dev/null || echo unknown' )).strip ()
126- IMAGE_REF = '%s:%s' % (FULL_IMAGE_NAME_HOST , IMAGE_TAG )
119+ IMAGE_REF = '%s:%s' % (FULL_IMAGE_NAME , IMAGE_TAG )
127120
128121# Build and push Docker image using local_resource
129122# This explicitly builds and pushes the image, ensuring it's available before deployment
@@ -207,7 +200,7 @@ custom_build(
207200# which matches the kustomize-to-helm conversion that helmify performs.
208201# The chart structure is compatible with both helmify generation and manual helm template usage.
209202k8s_yaml (
210- local ('helm template kube-startup-cpu-boost %s/charts/kube-startup-cpu-boost --namespace kube-startup-cpu-boost-system --set controllerManager.manager.image.repository=%s --set controllerManager.manager.image.tag=%s' % (PROJECT_DIR , FULL_IMAGE_NAME_CLUSTER , IMAGE_TAG ))
203+ local ('helm template kube-startup-cpu-boost %s/charts/kube-startup-cpu-boost --namespace kube-startup-cpu-boost-system --set controllerManager.manager.image.repository=%s --set controllerManager.manager.image.tag=%s' % (PROJECT_DIR , FULL_IMAGE_NAME , IMAGE_TAG ))
211204)
212205
213206# Configure controller manager resource
@@ -256,11 +249,10 @@ local_resource(
256249# Build Docker image for the demo Java app
257250# Uses the Dockerfile in demo-app directory
258251DEMO_APP_IMAGE_NAME = 'spring-demo-app'
259- DEMO_APP_FULL_IMAGE_NAME_HOST = '%s/%s' % (REGISTRY_HOST , DEMO_APP_IMAGE_NAME )
260- DEMO_APP_FULL_IMAGE_NAME_CLUSTER = '%s/%s' % (REGISTRY_CLUSTER , DEMO_APP_IMAGE_NAME )
252+ DEMO_APP_FULL_IMAGE_NAME = '%s/%s' % (REGISTRY_HOST , DEMO_APP_IMAGE_NAME )
261253# Use unique tag per build
262254DEMO_APP_IMAGE_TAG = 'tilt-' + str (local ('git rev-parse --short HEAD 2>/dev/null || echo unknown' )).strip ()
263- DEMO_APP_IMAGE_REF = '%s:%s' % (DEMO_APP_FULL_IMAGE_NAME_HOST , DEMO_APP_IMAGE_TAG )
255+ DEMO_APP_IMAGE_REF = '%s:%s' % (DEMO_APP_FULL_IMAGE_NAME , DEMO_APP_IMAGE_TAG )
264256
265257# Build and push Docker image for demo app
266258local_resource (
@@ -287,7 +279,7 @@ local_resource(
287279# Note: We don't add resource_deps here because custom_build doesn't support it
288280# Instead, the k8s_resource for spring-demo-app has resource_deps that includes docker-build-demo-app
289281custom_build (
290- DEMO_APP_FULL_IMAGE_NAME_HOST ,
282+ DEMO_APP_FULL_IMAGE_NAME ,
291283 'docker tag %s $EXPECTED_REF && docker push $EXPECTED_REF' % DEMO_APP_IMAGE_REF ,
292284 deps = [], # No file deps - image is already built by docker-build-demo-app
293285 tag = DEMO_APP_IMAGE_TAG ,
@@ -315,7 +307,7 @@ custom_build(
315307# deployment waits for docker-build-demo-app, even if YAML is generated early
316308# The image tag is computed at Tiltfile load time, so it will be consistent
317309k8s_yaml (
318- local ('kubectl kustomize %s/demo-app | python3 -c \' import sys, yaml; docs = list(yaml.safe_load_all(sys.stdin)); filtered = [d for d in docs if d.get("kind") != "StartupCPUBoost"]; print(yaml.dump_all(filtered, default_flow_style=False))\' | sed "s|ghcr.io/google/spring-demo-app:latest|%s:%s|g"' % (PROJECT_DIR , DEMO_APP_FULL_IMAGE_NAME_CLUSTER , DEMO_APP_IMAGE_TAG )),
310+ local ('kubectl kustomize %s/demo-app | python3 -c \' import sys, yaml; docs = list(yaml.safe_load_all(sys.stdin)); filtered = [d for d in docs if d.get("kind") != "StartupCPUBoost"]; print(yaml.dump_all(filtered, default_flow_style=False))\' | sed "s|ghcr.io/google/spring-demo-app:latest|%s:%s|g"' % (PROJECT_DIR , DEMO_APP_FULL_IMAGE_NAME , DEMO_APP_IMAGE_TAG )),
319311)
320312
321313# Wait for webhook service to be ready
0 commit comments