@@ -3,6 +3,9 @@ TAG ?= latest
33IMG := $(REPOSITORY ) :$(TAG )
44CLUSTER = kind
55
6+ .PHONY : run-local
7+ run-local : cluster-delete cluster build docker kind-load-image echo deploy
8+
69.PHONY : build
710build :
811 go build -o deployment-tracker cmd/deployment-tracker/main.go
@@ -15,6 +18,13 @@ docker:
1518kind-load-image :
1619 kind load docker-image ${IMG} --name ${CLUSTER}
1720
21+ .PHONY : deploy
22+ deploy :
23+ @echo " Deploying deployment-tracker to cluster..."
24+ kubectl apply -f deploy/manifest.yaml
25+ @echo " Deployment complete. Waiting for deployment to be ready..."
26+ kubectl rollout status deployment/deployment-tracker -n deployment-tracker --timeout=60s
27+
1828fmt :
1929 go fmt ./...
2030
@@ -26,3 +36,35 @@ integration-test:
2636
2737test-short :
2838 go test -short ./...
39+
40+ .PHONY : cluster
41+ cluster :
42+ @echo " Creating kind cluster: ${CLUSTER} "
43+ kind create cluster --name ${CLUSTER}
44+ @echo " Creating namespaces..."
45+ kubectl create namespace test1 --dry-run=client -o yaml | kubectl apply -f -
46+ kubectl create namespace test2 --dry-run=client -o yaml | kubectl apply -f -
47+ kubectl create namespace test3 --dry-run=client -o yaml | kubectl apply -f -
48+ @echo " Kind cluster '${CLUSTER} ' created with namespaces: test1, test2, test3"
49+
50+ .PHONY : cluster-delete
51+ cluster-delete :
52+ @echo " Deleting kind cluster: ${CLUSTER} "
53+ kind delete cluster --name ${CLUSTER}
54+
55+ # adds an echo server to the cluster that deployment tracker can point to to simulate 200 response
56+ .PHONY : echo
57+ echo :
58+ @echo " Deploying echo server to artifact-registry namespace..."
59+ kubectl create namespace artifact-registry --dry-run=client -o yaml | kubectl apply -f -
60+ kubectl run artifact-registry --image=ealen/echo-server:latest --port=80 -n artifact-registry --restart=Always --labels=" app=artifact-registry"
61+ kubectl expose pod artifact-registry --port=9090 --target-port=80 --name=artifact-registry -n artifact-registry --type=ClusterIP
62+ @echo " Echo server deployed and reachable at http://artifact-registry.artifact-registry.svc.cluster.local:9090"
63+
64+ .PHONY : echo-delete
65+ echo-delete :
66+ @echo " Deleting echo server from artifact-registry namespace..."
67+ kubectl delete service artifact-registry -n artifact-registry --ignore-not-found=true
68+ kubectl delete pod artifact-registry -n artifact-registry --ignore-not-found=true
69+ kubectl delete namespace artifact-registry --ignore-not-found=true
70+ @echo " Echo server deleted"
0 commit comments