Skip to content

Contributing

Development Setup

Prerequisites

  • JDK 21
  • Gradle 8.12+
  • Docker (for building images)
  • minikube (for integration/E2E tests)
  • clang/llvm (for compiling BPF programs locally)
  • kotlin-ebpf-dsl as a sibling directory

Clone

git clone https://github.com/pjs7678/kpod-metrics.git
git clone https://github.com/pjs7678/kotlin-ebpf-dsl.git

Build

cd kpod-metrics
./gradlew build -PebpfDslPath=../kotlin-ebpf-dsl

Run Tests

./gradlew test -PebpfDslPath=../kotlin-ebpf-dsl

Docker Build

# From parent directory containing both repos
docker build -f kpod-metrics/Dockerfile -t kpod-metrics .

Pull Request Process

  1. Create a feature branch from main
  2. Make your changes with tests
  3. Run ./gradlew test detekt to verify
  4. Run helm lint helm/kpod-metrics if modifying Helm templates
  5. If adding new Helm values: update helm/kpod-metrics/values.schema.json
  6. Push and open a PR against main
  7. CI must pass (unit tests, detekt, Helm lint)

Code Style

  • Kotlin with Detekt static analysis
  • Follow existing patterns in src/main/kotlin/
  • New collectors should follow the same structure as existing ones in collector/
  • Tests use MockK for mocking and SimpleMeterRegistry for metric verification