Conversation
Signed-off-by: Eric Pickard <piceri@github.com>
Signed-off-by: Eric Pickard <piceri@github.com>
There was a problem hiding this comment.
Pull request overview
Adds Makefile targets to streamline local development by spinning up a kind cluster, deploying a local echo server to mimic artifact metadata responses, and deploying deployment-tracker into the cluster.
Changes:
- Introduces
run-localto orchestrate cluster creation, image build/load, echo server setup, and deployment. - Adds
cluster/cluster-deletetargets for kind lifecycle and namespace setup. - Adds
deploy,echo, andecho-deletetargets for deploying the app and echo server.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .PHONY: run-local | ||
| run-local: cluster-delete cluster build docker kind-load-image echo deploy |
There was a problem hiding this comment.
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.
| .PHONY: deploy | ||
| deploy: | ||
| @echo "Deploying deployment-tracker to cluster..." | ||
| kubectl apply -f deploy/manifest.yaml |
There was a problem hiding this comment.
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).
| 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 |
| 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" |
There was a problem hiding this comment.
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.
| 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" |
| 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" |
There was a problem hiding this comment.
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.
Added to Makefile to make local development easier. Runs a local kind cluster with a echo server to mimic artifact metadata response