Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ TAG ?= latest
IMG := $(REPOSITORY):$(TAG)
CLUSTER = kind

.PHONY: run-local
run-local: cluster-delete cluster build docker kind-load-image echo deploy
Comment on lines +6 to +7
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run-local invokes the docker target, which currently builds a linux/arm64 image. This will fail to run on the common amd64 kind node images (and on most non-ARM developer machines). Consider making the build platform configurable (e.g., PLATFORM ?=) or building for the kind node architecture so run-local works across environments.

Copilot uses AI. Check for mistakes.

.PHONY: build
build:
go build -o deployment-tracker cmd/deployment-tracker/main.go
Expand All @@ -15,6 +18,13 @@ docker:
kind-load-image:
kind load docker-image ${IMG} --name ${CLUSTER}

.PHONY: deploy
deploy:
@echo "Deploying deployment-tracker to cluster..."
kubectl apply -f deploy/manifest.yaml
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new deploy target applies deploy/manifest.yaml, but that manifest hard-codes image: deployment-tracker:latest rather than using $(IMG). As a result, overriding TAG/REPOSITORY (or using a non-latest tag) will load one image into kind but deploy a different one. Consider templating/patching the manifest during make deploy (e.g., kustomize image override or kubectl set image) so it deploys the built $(IMG).

Suggested change
kubectl apply -f deploy/manifest.yaml
kubectl apply -f deploy/manifest.yaml
@echo "Updating deployment image to ${IMG}..."
kubectl set image deployment/deployment-tracker deployment-tracker=${IMG} -n deployment-tracker

Copilot uses AI. Check for mistakes.
@echo "Deployment complete. Waiting for deployment to be ready..."
kubectl rollout status deployment/deployment-tracker -n deployment-tracker --timeout=60s

fmt:
go fmt ./...

Expand All @@ -26,3 +36,35 @@ integration-test:

test-short:
go test -short ./...

.PHONY: cluster
cluster:
@echo "Creating kind cluster: ${CLUSTER}"
kind create cluster --name ${CLUSTER}
@echo "Creating namespaces..."
kubectl create namespace test1 --dry-run=client -o yaml | kubectl apply -f -
kubectl create namespace test2 --dry-run=client -o yaml | kubectl apply -f -
kubectl create namespace test3 --dry-run=client -o yaml | kubectl apply -f -
@echo "Kind cluster '${CLUSTER}' created with namespaces: test1, test2, test3"

.PHONY: cluster-delete
cluster-delete:
@echo "Deleting kind cluster: ${CLUSTER}"
kind delete cluster --name ${CLUSTER}

# adds an echo server to the cluster that deployment tracker can point to to simulate 200 response
.PHONY: echo
echo:
@echo "Deploying echo server to artifact-registry namespace..."
kubectl create namespace artifact-registry --dry-run=client -o yaml | kubectl apply -f -
kubectl run artifact-registry --image=ealen/echo-server:latest --port=80 -n artifact-registry --restart=Always --labels="app=artifact-registry"
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The echo target uses kubectl run ... --restart=Always and then kubectl expose pod artifact-registry .... With --restart=Always, kubectl run creates a Deployment (not a Pod), so kubectl expose pod artifact-registry is likely to fail, and echo-delete (which deletes a Pod) won’t clean up the created Deployment. Consider creating/exposing a Deployment explicitly (and deleting the Deployment), or use a Pod (--restart=Never) and keep the expose/delete commands consistent with the created resource type.

Suggested change
kubectl run artifact-registry --image=ealen/echo-server:latest --port=80 -n artifact-registry --restart=Always --labels="app=artifact-registry"
kubectl run artifact-registry --image=ealen/echo-server:latest --port=80 -n artifact-registry --restart=Never --labels="app=artifact-registry"

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The echo server image is referenced as ealen/echo-server:latest. Using latest makes local dev behavior non-reproducible and increases supply-chain risk because the content can change over time. Consider pinning to a specific version and (ideally) a digest, similar to how base images are pinned elsewhere in the repo.

Copilot uses AI. Check for mistakes.
kubectl expose pod artifact-registry --port=9090 --target-port=80 --name=artifact-registry -n artifact-registry --type=ClusterIP
@echo "Echo server deployed and reachable at http://artifact-registry.artifact-registry.svc.cluster.local:9090"

.PHONY: echo-delete
echo-delete:
@echo "Deleting echo server from artifact-registry namespace..."
kubectl delete service artifact-registry -n artifact-registry --ignore-not-found=true
kubectl delete pod artifact-registry -n artifact-registry --ignore-not-found=true
kubectl delete namespace artifact-registry --ignore-not-found=true
@echo "Echo server deleted"
Loading