-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (59 loc) · 1.72 KB
/
Makefile
File metadata and controls
68 lines (59 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Makefile for Sentinel - Kubernetes Controller
# Variables
BINARY_NAME=sentinel
DOCKER_IMAGE=sentinel:latest
KIND_CLUSTER=homelab
# Default target - shows available commands
.PHONY: help
help:
@echo "Available commands:"
@echo " make build - Build the Go binary"
@echo " make docker - Build Docker image"
@echo " make deploy - Build Docker image and deploy to KIND cluster"
@echo " make clean - Remove built binary"
@echo " make test - Run tests"
@echo " make run - Run locally (requires kubeconfig)"
# Build the Go binary
.PHONY: build
build:
@echo "Building $(BINARY_NAME)..."
go build -o $(BINARY_NAME)
@echo "✅ Binary built: ./$(BINARY_NAME)"
# Build Docker image
.PHONY: docker
docker:
@echo "Building Docker image $(DOCKER_IMAGE)..."
docker build -t $(DOCKER_IMAGE) .
@echo "✅ Docker image built: $(DOCKER_IMAGE)"
# Build and deploy to KIND cluster
.PHONY: deploy
deploy: docker
@echo "Loading image into KIND cluster $(KIND_CLUSTER)..."
kind load docker-image $(DOCKER_IMAGE) --name $(KIND_CLUSTER)
@echo "Deploying to Kubernetes..."
kubectl apply -f manifests/install/sentinel.yaml
@echo "✅ Deployed to KIND cluster"
@echo ""
@echo "Check status with: kubectl get pods -n kube-system -l app=sentinel-controller"
# Run locally (useful for development)
.PHONY: run
run: build
@echo "Running $(BINARY_NAME) locally..."
./$(BINARY_NAME) start -v=2
# Clean build artifacts
.PHONY: clean
clean:
@echo "Cleaning build artifacts..."
rm -f $(BINARY_NAME)
@echo "✅ Cleaned"
# Run tests
.PHONY: test
test:
@echo "Running tests..."
go test ./...
# Update dependencies
.PHONY: deps
deps:
@echo "Updating dependencies..."
go mod tidy
@echo "✅ Dependencies updated"