Implement Phase 1 of KAT (#1)
**Phase 1: State Management & Leader Election** * **Goal**: A functional embedded etcd and leader election mechanism. * **Tasks**: 1. Implement the `StateStore` interface (RFC 5.1) with an etcd backend (`internal/store/etcd.go`). 2. Integrate embedded etcd server into `kat-agent` (RFC 2.2, 5.2), configurable via `cluster.kat` parameters. 3. Implement leader election using `go.etcd.io/etcd/client/v3/concurrency` (RFC 5.3). 4. Basic `kat-agent init` functionality: * Parse `cluster.kat`. * Start single-node embedded etcd. * Campaign for and become leader. * Store initial cluster configuration (UID, CIDRs from `cluster.kat`) in etcd. * **Milestone**: * A single `kat-agent init --config cluster.kat` process starts, initializes etcd, and logs that it has become the leader. * The cluster configuration from `cluster.kat` can be verified in etcd using an etcd client. * `StateStore` interface methods (`Put`, `Get`, `Delete`, `List`) are testable against the embedded etcd. Reviewed-on: #1
This commit is contained in:
38
Makefile
38
Makefile
@ -1,24 +1,46 @@
|
||||
# File: Makefile
|
||||
.PHONY: all generate clean test
|
||||
.PHONY: all generate clean test test-unit test-integration build lint
|
||||
|
||||
# Variables
|
||||
GOLANGCI_LINT_VERSION := v1.55.2 # Or your preferred version
|
||||
GOLANGCI_LINT_VERSION := v1.55.2
|
||||
|
||||
all: generate test
|
||||
all: generate test build
|
||||
|
||||
generate:
|
||||
@echo "Generating Go code from Protobuf definitions..."
|
||||
@./scripts/gen-proto.sh
|
||||
|
||||
# Placeholder for future commands
|
||||
clean:
|
||||
@echo "Cleaning up generated files and build artifacts..."
|
||||
@rm -f ./api/v1alpha1/*.pb.go
|
||||
@rm -f kat-agent katcall
|
||||
|
||||
# Run all tests
|
||||
test: generate
|
||||
@echo "Running tests..."
|
||||
@go test ./...
|
||||
@echo "Running all tests..."
|
||||
@go test -count=1 ./...
|
||||
|
||||
# Run unit tests only (faster, no integration tests)
|
||||
test-unit:
|
||||
@echo "Running unit tests..."
|
||||
@go test -count=1 -short ./...
|
||||
|
||||
# Run integration tests only
|
||||
test-integration:
|
||||
@echo "Running integration tests..."
|
||||
@go test -count=1 -run Integration ./...
|
||||
|
||||
# Run tests for a specific package
|
||||
test-package:
|
||||
@echo "Running tests for package $(PACKAGE)..."
|
||||
@go test -v ./$(PACKAGE)
|
||||
|
||||
kat-agent:
|
||||
@echo "Building kat-agent..."
|
||||
@go build -o kat-agent ./cmd/kat-agent/main.go
|
||||
|
||||
build: generate kat-agent
|
||||
@echo "Building all binaries..."
|
||||
|
||||
lint:
|
||||
@echo "Running linter..."
|
||||
@ -27,7 +49,3 @@ lint:
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION); \
|
||||
fi
|
||||
@golangci-lint run
|
||||
|
||||
# Add to go.mod if not already present by go install
|
||||
# go get google.golang.org/protobuf/cmd/protoc-gen-go
|
||||
# go get google.golang.org/grpc/cmd/protoc-gen-go-grpc (if you plan to use gRPC services soon)
|
||||
|
Reference in New Issue
Block a user