Skip to content

Commit fd69662

Browse files
jeremyederclaude
andcommitted
feat: add kind-local overlay and kind-local-up target
- Add kind-local kustomize overlay for local development without Quay - Add make kind-local-up target for fully local dev workflow - Add vteam_public_api to load-images.sh and minikube _build-and-load - Fix OCI archive path bug in load-images.sh (colon in tag created nested path) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6945225 commit fd69662

File tree

6 files changed

+156
-7
lines changed

6 files changed

+156
-7
lines changed

Makefile

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
.PHONY: local-logs local-logs-backend local-logs-frontend local-logs-operator local-shell local-shell-frontend
55
.PHONY: local-test local-test-dev local-test-quick test-all local-url local-troubleshoot local-port-forward local-stop-port-forward
66
.PHONY: push-all registry-login setup-hooks remove-hooks check-minikube check-kind check-kubectl
7-
.PHONY: e2e-test e2e-setup e2e-clean deploy-langfuse-openshift
7+
.PHONY: e2e-test e2e-setup e2e-clean deploy-langfuse-openshift kind-local-up
88
.PHONY: setup-minio minio-console minio-logs minio-status
99
.PHONY: validate-makefile lint-makefile check-shell makefile-health
1010
.PHONY: _create-operator-config _auto-port-forward _show-access-info _build-and-load
@@ -606,6 +606,47 @@ kind-up: check-kind check-kubectl ## Start kind cluster with Quay.io images (pro
606606
@echo "Run tests:"
607607
@echo " make test-e2e"
608608

609+
kind-local-up: check-kind check-kubectl ## Start kind cluster with locally built images
610+
@echo "$(COLOR_BOLD)Starting kind cluster with locally built images$(COLOR_RESET)"
611+
@echo ""
612+
@echo "$(COLOR_BLUE)$(COLOR_RESET) Step 1/6: Creating kind cluster..."
613+
@cd e2e && CONTAINER_ENGINE=$(CONTAINER_ENGINE) ./scripts/setup-kind.sh
614+
@for i in 1 2 3 4 5 6 7 8 9 10; do \
615+
if kubectl cluster-info >/dev/null 2>&1; then \
616+
echo "$(COLOR_GREEN)$(COLOR_RESET) API server ready"; \
617+
break; \
618+
fi; \
619+
if [ $$i -eq 10 ]; then \
620+
echo "$(COLOR_RED)$(COLOR_RESET) Timeout waiting for API server"; \
621+
exit 1; \
622+
fi; \
623+
sleep 3; \
624+
done
625+
@echo "$(COLOR_BLUE)$(COLOR_RESET) Step 2/6: Building all images locally..."
626+
@$(MAKE) --no-print-directory build-all
627+
@echo "$(COLOR_BLUE)$(COLOR_RESET) Step 3/6: Loading images into kind cluster..."
628+
@cd e2e && CONTAINER_ENGINE=$(CONTAINER_ENGINE) ./scripts/load-images.sh
629+
@echo "$(COLOR_BLUE)$(COLOR_RESET) Step 4/6: Deploying with local images..."
630+
@kubectl apply --validate=false -k components/manifests/overlays/kind-local/
631+
@echo "$(COLOR_BLUE)$(COLOR_RESET) Step 5/6: Waiting for pods..."
632+
@cd e2e && ./scripts/wait-for-ready.sh
633+
@echo "$(COLOR_BLUE)$(COLOR_RESET) Step 6/6: Initializing MinIO and extracting test token..."
634+
@cd e2e && ./scripts/init-minio.sh
635+
@cd e2e && CONTAINER_ENGINE=$(CONTAINER_ENGINE) ./scripts/extract-token.sh
636+
@echo "$(COLOR_GREEN)$(COLOR_RESET) Kind cluster ready with local images!"
637+
@echo ""
638+
@echo "$(COLOR_BOLD)Access the platform:$(COLOR_RESET)"
639+
@echo " Run in another terminal: $(COLOR_BLUE)make kind-port-forward$(COLOR_RESET)"
640+
@echo ""
641+
@echo " Then access:"
642+
@echo " Frontend: http://localhost:8080"
643+
@echo " Backend: http://localhost:8081"
644+
@echo ""
645+
@echo " Get test token: kubectl get secret test-user-token -n ambient-code -o jsonpath='{.data.token}' | base64 -d"
646+
@echo ""
647+
@echo "Run tests:"
648+
@echo " make test-e2e"
649+
609650
kind-down: ## Stop and delete kind cluster
610651
@echo "$(COLOR_BLUE)$(COLOR_RESET) Cleaning up kind cluster..."
611652
@cd e2e && CONTAINER_ENGINE=$(CONTAINER_ENGINE) ./scripts/cleanup.sh
@@ -700,21 +741,26 @@ _build-and-load: ## Internal: Build and load images
700741
@$(CONTAINER_ENGINE) build $(PLATFORM_FLAG) -t $(OPERATOR_IMAGE) components/operator $(QUIET_REDIRECT)
701742
@echo " Building runner ($(PLATFORM))..."
702743
@$(CONTAINER_ENGINE) build $(PLATFORM_FLAG) -t $(RUNNER_IMAGE) -f components/runners/claude-code-runner/Dockerfile components/runners $(QUIET_REDIRECT)
744+
@echo " Building public-api ($(PLATFORM))..."
745+
@$(CONTAINER_ENGINE) build $(PLATFORM_FLAG) -t $(PUBLIC_API_IMAGE) components/public-api $(QUIET_REDIRECT)
703746
@echo " Tagging images with localhost prefix..."
704747
@$(CONTAINER_ENGINE) tag $(BACKEND_IMAGE) localhost/$(BACKEND_IMAGE) 2>/dev/null || true
705748
@$(CONTAINER_ENGINE) tag $(FRONTEND_IMAGE) localhost/$(FRONTEND_IMAGE) 2>/dev/null || true
706749
@$(CONTAINER_ENGINE) tag $(OPERATOR_IMAGE) localhost/$(OPERATOR_IMAGE) 2>/dev/null || true
707750
@$(CONTAINER_ENGINE) tag $(RUNNER_IMAGE) localhost/$(RUNNER_IMAGE) 2>/dev/null || true
751+
@$(CONTAINER_ENGINE) tag $(PUBLIC_API_IMAGE) localhost/$(PUBLIC_API_IMAGE) 2>/dev/null || true
708752
@echo " Loading images into minikube..."
709753
@mkdir -p /tmp/minikube-images
710754
@$(CONTAINER_ENGINE) save -o /tmp/minikube-images/backend.tar localhost/$(BACKEND_IMAGE)
711755
@$(CONTAINER_ENGINE) save -o /tmp/minikube-images/frontend.tar localhost/$(FRONTEND_IMAGE)
712756
@$(CONTAINER_ENGINE) save -o /tmp/minikube-images/operator.tar localhost/$(OPERATOR_IMAGE)
713757
@$(CONTAINER_ENGINE) save -o /tmp/minikube-images/runner.tar localhost/$(RUNNER_IMAGE)
758+
@$(CONTAINER_ENGINE) save -o /tmp/minikube-images/public-api.tar localhost/$(PUBLIC_API_IMAGE)
714759
@minikube image load /tmp/minikube-images/backend.tar $(QUIET_REDIRECT)
715760
@minikube image load /tmp/minikube-images/frontend.tar $(QUIET_REDIRECT)
716761
@minikube image load /tmp/minikube-images/operator.tar $(QUIET_REDIRECT)
717762
@minikube image load /tmp/minikube-images/runner.tar $(QUIET_REDIRECT)
763+
@minikube image load /tmp/minikube-images/public-api.tar $(QUIET_REDIRECT)
718764
@rm -rf /tmp/minikube-images
719765
@echo "$(COLOR_GREEN)$(COLOR_RESET) Images built and loaded"
720766

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Patch backend to use IfNotPresent for dynamically created resources
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: backend-api
6+
spec:
7+
template:
8+
spec:
9+
containers:
10+
- name: backend-api
11+
env:
12+
- name: IMAGE_PULL_POLICY
13+
value: "IfNotPresent"
14+
- name: CONTENT_SERVICE_IMAGE
15+
value: "docker.io/library/vteam_backend:latest"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Patch to set imagePullPolicy: IfNotPresent for kind-local cluster
2+
# Uses locally built and loaded images, not pulled from a registry
3+
- op: replace
4+
path: /spec/template/spec/containers/0/imagePullPolicy
5+
value: IfNotPresent
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
# Build on top of the kind overlay (inherits base, secrets, test-user, etc.)
5+
resources:
6+
- ../kind
7+
8+
# Override patches for kind-local environment
9+
patches:
10+
# Use locally built runner/state-sync images with IfNotPresent
11+
- path: operator-env-patch.yaml
12+
target:
13+
kind: Deployment
14+
name: agentic-operator
15+
# Override backend env vars to use local images and IfNotPresent
16+
- path: backend-env-patch.yaml
17+
target:
18+
kind: Deployment
19+
name: backend-api
20+
21+
# JSON patches to override imagePullPolicy to IfNotPresent
22+
patchesJson6902:
23+
- target:
24+
group: apps
25+
version: v1
26+
kind: Deployment
27+
name: backend-api
28+
path: image-pull-policy-patch.yaml
29+
- target:
30+
group: apps
31+
version: v1
32+
kind: Deployment
33+
name: frontend
34+
path: image-pull-policy-patch.yaml
35+
- target:
36+
group: apps
37+
version: v1
38+
kind: Deployment
39+
name: agentic-operator
40+
path: image-pull-policy-patch.yaml
41+
- target:
42+
group: apps
43+
version: v1
44+
kind: Deployment
45+
name: public-api
46+
path: image-pull-policy-patch.yaml
47+
48+
# Kind-local overlay: Use locally built images loaded via `kind load`
49+
# Images are imported with docker.io/library/ prefix by ctr
50+
images:
51+
- name: quay.io/ambient_code/vteam_backend
52+
newName: docker.io/library/vteam_backend
53+
newTag: latest
54+
- name: quay.io/ambient_code/vteam_frontend
55+
newName: docker.io/library/vteam_frontend
56+
newTag: latest
57+
- name: quay.io/ambient_code/vteam_operator
58+
newName: docker.io/library/vteam_operator
59+
newTag: latest
60+
- name: quay.io/ambient_code/vteam_public_api
61+
newName: docker.io/library/vteam_public_api
62+
newTag: latest
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Patch operator to use locally built runner/state-sync images
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: agentic-operator
6+
spec:
7+
template:
8+
spec:
9+
containers:
10+
- name: agentic-operator
11+
env:
12+
- name: AMBIENT_CODE_RUNNER_IMAGE
13+
value: "docker.io/library/vteam_claude_runner:latest"
14+
- name: STATE_SYNC_IMAGE
15+
value: "docker.io/library/vteam_state_sync:latest"
16+
- name: IMAGE_PULL_POLICY
17+
value: "IfNotPresent"
18+
- name: POD_FSGROUP
19+
value: "0"

e2e/scripts/load-images.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ IMAGES=(
4747
"vteam_operator:latest"
4848
"vteam_claude_runner:latest"
4949
"vteam_state_sync:latest"
50+
"vteam_public_api:latest"
5051
)
5152

5253
echo ""
@@ -67,19 +68,20 @@ for IMAGE in "${IMAGES[@]}"; do
6768
echo " ⚠️ Image is $IMAGE_ARCH, host is $EXPECTED_ARCH (may be slow)"
6869
fi
6970

70-
# Save as OCI archive
71-
$CONTAINER_ENGINE save --format oci-archive -o "/tmp/${IMAGE//://}.oci.tar" "$IMAGE"
72-
71+
# Save as OCI archive (replace : with - for flat filename)
72+
ARCHIVE="/tmp/${IMAGE//:/-}.oci.tar"
73+
$CONTAINER_ENGINE save --format oci-archive -o "$ARCHIVE" "$IMAGE"
74+
7375
# Import into kind node with docker.io/library prefix so kubelet can find it
74-
cat "/tmp/${IMAGE//://}.oci.tar" | \
76+
cat "$ARCHIVE" | \
7577
$CONTAINER_ENGINE exec -i ambient-local-control-plane \
7678
ctr --namespace=k8s.io images import --no-unpack \
7779
--index-name "docker.io/library/$IMAGE" - 2>&1 | grep -q "saved" && \
7880
echo "$IMAGE loaded" || \
7981
echo " ⚠️ $IMAGE may have failed"
80-
82+
8183
# Cleanup temp file
82-
rm -f "/tmp/${IMAGE//://}.oci.tar"
84+
rm -f "$ARCHIVE"
8385
done
8486

8587
echo ""

0 commit comments

Comments
 (0)