Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This devcontainer provides a complete development environment for the Galactic m
- **protoc 25.1** - Protocol Buffer compiler
- **protoc-gen-go** - Go code generation for protobuf
- **protoc-gen-go-grpc** - gRPC code generation for Go
- **make** - Build automation
- **task** - Build automation
- **gcc/build-essential** - C compiler for CGO dependencies
- **jq** - JSON processor
- **git** - Version control
Expand Down Expand Up @@ -93,37 +93,38 @@ After the container starts and post-create completes:

```bash
# Build the galactic binary
make build
task build

# Run unit tests
make test
task test

# Run the agent locally
make run-agent
task run-agent

# Lint Go code
make lint
task lint

# Format Go code
make fmt
task fmt
```

## Testing

### Unit Tests
```bash
make test
task test
```

### E2E Tests
```bash
# Automatically creates/tears down Kind cluster
make test-e2e
# Create a Kind cluster
kind create cluster --name galactic-e2e

# Or manually manage the cluster
make setup-test-e2e
# Run e2e tests
go test ./test/e2e/ -v -ginkgo.v
make cleanup-test-e2e

# Tear down
kind delete cluster --name galactic-e2e
```

## Network Development
Expand Down Expand Up @@ -153,7 +154,7 @@ Build and test containers inside the devcontainer:

```bash
# Build the galactic image
make docker-build
task docker-build

# Create a Kind cluster
kind create cluster --name galactic-dev
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

- uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build binary
run: make build
run: task build

- name: Verify binary
run: |
Expand Down Expand Up @@ -97,6 +102,11 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

- uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Kind
run: |
go install sigs.k8s.io/kind@latest
Expand All @@ -109,16 +119,9 @@ jobs:

- name: Build and load image
run: |
make docker-build IMG=galactic:e2e
task docker-build IMG=galactic:e2e
kind load docker-image galactic:e2e --name galactic-e2e

- name: Install CRDs
run: make install

- name: Verify CRDs
run: |
kubectl get crd network-attachment-definitions.k8s.cni.cncf.io

- name: Cleanup
if: always()
run: kind delete cluster --name galactic-e2e
14 changes: 7 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ Galactic is the SRv6 data plane for multi-cloud VPC networking. It consists of a
## Development Workflow

```
make build # produces bin/galactic
make test # fmt + vet + unit tests with coverage
make lint # golangci-lint; lint-fix applies safe auto-fixes
make run-agent # run agent (requires root / CAP_NET_ADMIN)
task build # produces bin/galactic
task test # fmt + vet + unit tests with coverage
task lint # golangci-lint; lint-fix applies safe auto-fixes
task run-agent # run agent (requires root / CAP_NET_ADMIN)
```

**Before every PR:** `make lint test`.
**Before every PR:** `task lint test`.

## Code Standards

Expand All @@ -55,12 +55,12 @@ See `lab/README.md` for quick-start commands and prerequisites for each environm

## New Developer Entry Points

1. Run `make build` to verify toolchain; run `make test` to confirm unit tests pass.
1. Run `task build` to verify toolchain; run `task test` to confirm unit tests pass.
2. Read `internal/cni/cni.go` (cmdAdd/cmdDel) to understand the container attach path.
3. Read `internal/agent/srv6/srv6.go` to understand the agent entry point and how it manages SRv6 routes and VRFs.
4. Read `pkg/proto/local/local.go` to understand the gRPC interface between the CNI and the agent.
5. Explore `pkg/common/` for shared utilities (VRF management, sysctl helpers, CNI types).

**Likely trip-ups:**
- `make run-agent` requires elevated privileges (netlink, VRF, SRv6 operations need `CAP_NET_ADMIN`).
- `task run-agent` requires elevated privileges (netlink, VRF, SRv6 operations need `CAP_NET_ADMIN`).
- There is no operator or webhook in this repository; those components are in a separate project.
4 changes: 2 additions & 2 deletions CONVENTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Generated protobuf files (`*.pb.go`, `*_grpc.pb.go` in `pkg/proto/local/`) must

### Linting

Run `make lint` before every PR. All linters listed in `.golangci.yml` must pass. Suppressions require a comment explaining why. Notable active linters: `errcheck`, `staticcheck`, `govet`, `revive`, `gocyclo`, `dupl`, `unused`.
Run `task lint` before every PR. All linters listed in `.golangci.yml` must pass. Suppressions require a comment explaining why. Notable active linters: `errcheck`, `staticcheck`, `govet`, `revive`, `gocyclo`, `dupl`, `unused`.

Exclusions by path:
- `lll` is excluded from `internal/*`
Expand Down Expand Up @@ -161,7 +161,7 @@ Fixes #42
Before opening a pull request, run all of the following and ensure they pass:

```sh
make lint test
task lint test
```

Agent and CNI kernel-path code is not covered by unit tests. New code in those paths should prefer integration or e2e tests over mock-heavy unit tests.
183 changes: 0 additions & 183 deletions Makefile

This file was deleted.

32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,38 @@ Two ContainerLab environments are available under [`lab/`](./lab/):

See the [DevContainer](./.devcontainer/) for development environment setup.

## Development

This project uses [Task](https://taskfile.dev) as its build tool. All build, test, lint, and lab operations are defined in `Taskfile.yaml` files at the repo root and under each `lab/` subdirectory.

### Install Task

```bash
# macOS
brew install go-task

# Linux (official installer)
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin

# Go toolchain
go install github.com/go-task/task/v3/cmd/task@latest
```

See [taskfile.dev/installation](https://taskfile.dev/installation/) for the full list of options.

### Usage

```bash
task # list available tasks
task build # build the galactic binary
task test # run tests (fmt + vet + unit)
task lint # run golangci-lint
task lint-fix # auto-fix lint issues
task clean # remove build artifacts
```

Lab environments have their own `Taskfile.yaml`; run `task` from the relevant directory (`lab/network/` or `lab/gvpc/`) to see available tasks.

## License

See [LICENSE](./LICENSE) for details.
Expand Down
Loading
Loading