For basic guidelines around contributing, see the CONTRIBUTING document.
- Go 1.25+ (see go.mod for the exact version)
- Docker (builds run inside containers by default)
- Make
All dependencies are managed as Go modules. To build:
make kube-routerBy default, builds run inside Docker for consistency. To build locally:
BUILD_IN_DOCKER=false make kube-router(Adding BUILD_IN_DOCKER=false will work for most other steps that utilize docker as well)
make containerThis compiles kube-router and builds a Docker image tagged with the current branch and architecture.
make pushBy default this pushes to the official cloudnativelabs/kube-router Docker Hub repository which most users will likely
not have access to.
Push to a different registry by setting image options:
make container IMG_FQDN=quay.io IMG_NAMESPACE=youruser IMG_TAG=customSpecify the target architecture with GOARCH:
GOARCH=arm64 make kube-router
GOARCH=s390x make containerSupported architectures: amd64 (default), arm64, arm, s390x, ppc64le, riscv64.
Run the full test suite:
make testOr with formatted output (easier to understand for humans, uses gotestsum):
make test-prettyCheck formatting:
make gofmtAuto-fix formatting:
make gofmt-fixRun all linters (golangci-lint + markdownlint):
make lintWhen modifying interfaces that have associated mocks, regenerate them:
make gomoqsOr regenerate a specific mock:
make pkg/controllers/proxy/linux_networking_moq.goThis project uses Conventional Commits.
Every commit message should follow the format <type>(<scope>): <description>.
Common types: feat, fix, doc, test, build, chore, fact (refactor).
The following scope abbreviations are used for the main controllers:
- NSC -- Network Services Controller (
pkg/controllers/proxy/) - NRC -- Network Routes Controller (
pkg/controllers/routing/) - NPC -- Network Policy Controller (
pkg/controllers/netpol/)
Examples:
feat(gobgp): add kube_router_bgp_peer_info metric
fix(aws.go): load region before attempting to assume a role
test(NSC): add comprehensive TCPMSS unit tests
git checkout -b feature_x
# Make changes...
make clean
make gofmt-fix
makeRun make help for a full list of available targets.
See RELEASE.md for more information.
kube-router uses Go modules. See the upstream documentation for more information.