-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (81 loc) · 2.33 KB
/
Makefile
File metadata and controls
98 lines (81 loc) · 2.33 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.PHONY: build run test clean docker-build docker-push lint
# Variables
BINARY_NAME=xds-controller
DOCKER_REPO?=your-ecr-repo
DOCKER_TAG?=latest
GO_FILES=$(shell find . -name '*.go' -type f)
# Build the binary
build:
go build -ldflags="-w -s" -o bin/$(BINARY_NAME) ./cmd/controller
# Run locally (requires ECS_CLUSTER_NAME env var)
run: build
./bin/$(BINARY_NAME)
# Run with mock data for testing
run-mock:
ECS_CLUSTER_NAME=mock-cluster \
ECS_HOSTNAME_SUFFIX=.example.com \
LOG_LEVEL=debug \
./bin/$(BINARY_NAME)
# Run tests
test:
go test -v -race ./...
# Run tests with coverage
test-coverage:
go test -v -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
# Format code
fmt:
go fmt ./...
# Lint code
lint:
golangci-lint run
# Tidy dependencies
tidy:
go mod tidy
# Clean build artifacts
clean:
rm -rf bin/
rm -f coverage.out coverage.html
# Build Docker image
docker-build:
docker build -f deployments/docker/Dockerfile -t $(DOCKER_REPO)/$(BINARY_NAME):$(DOCKER_TAG) .
# Push Docker image
docker-push: docker-build
docker push $(DOCKER_REPO)/$(BINARY_NAME):$(DOCKER_TAG)
# Run Envoy locally for testing (requires xDS controller running)
run-envoy:
docker run --rm -it \
-p 10000:10000 \
-p 9901:9901 \
-v $(PWD)/envoy/bootstrap.yaml:/etc/envoy/envoy.yaml:ro \
-e XDS_CONTROLLER_HOST=host.docker.internal \
-e XDS_CONTROLLER_PORT=18000 \
envoyproxy/envoy:v1.29-latest \
-c /etc/envoy/envoy.yaml \
--log-level debug
# Generate mocks for testing
generate-mocks:
go generate ./...
# Download dependencies
deps:
go mod download
# Verify dependencies
verify:
go mod verify
# Help
help:
@echo "Available targets:"
@echo " build - Build the xDS controller binary"
@echo " run - Run the xDS controller locally"
@echo " run-mock - Run with mock configuration for testing"
@echo " test - Run tests"
@echo " test-coverage - Run tests with coverage report"
@echo " fmt - Format code"
@echo " lint - Run linter"
@echo " tidy - Tidy go modules"
@echo " clean - Clean build artifacts"
@echo " docker-build - Build Docker image"
@echo " docker-push - Push Docker image"
@echo " run-envoy - Run Envoy locally for testing"
@echo " deps - Download dependencies"
@echo " verify - Verify dependencies"