Guide for developers contributing to Workload-Variant-Autoscaler.
- Go 1.23.0+
- Docker 17.03+
- kubectl 1.32.0+
- Kind (for local testing)
- Make
-
Clone the repository:
git clone https://github.com/llm-d-incubation/workload-variant-autoscaler.git cd workload-variant-autoscaler -
Install dependencies:
go mod download
-
Install development tools:
make setup-envtest make controller-gen make kustomize
workload-variant-autoscaler/
├── api/v1alpha1/ # CRD definitions
├── cmd/ # Main application entry points
├── config/ # Kubernetes manifests
│ ├── crd/ # CRD manifests
│ ├── rbac/ # RBAC configurations
│ ├── manager/ # Controller deployment
│ └── samples/ # Example resources
├── deploy/ # Deployment scripts
│ ├── kubernetes/ # K8s deployment
│ ├── openshift/ # OpenShift deployment
│ └── kind/ # Local development
├── docs/ # Documentation
├── internal/ # Private application code
│ ├── controller/ # Controller implementation
│ ├── collector/ # Metrics collection
│ ├── optimizer/ # Optimization logic
│ ├── actuator/ # Metric emission & scaling
│ └── modelanalyzer/ # Model analysis
├── pkg/ # Public libraries
│ ├── analyzer/ # Queue theory models
│ ├── solver/ # Optimization algorithms
│ ├── core/ # Core domain models
│ └── config/ # Configuration structures
├── test/ # Tests
│ ├── e2e/ # End-to-end tests
│ └── utils/ # Test utilities
└── tools/ # Development tools
└── vllm-emulator/ # Testing emulator
Option 1: Outside the cluster
# Run the controller on your machine (connects to configured cluster)
make runOption 2: In a Kind cluster
# Create a Kind cluster with emulated GPUs
make create-kind-cluster
# Deploy the controller
make deploy IMG=<your-image>
# Or deploy with llm-d infrastructure
make deploy-llm-d-wva-emulated-on-kind-
Create a feature branch:
git checkout -b feature/my-feature
-
Make your changes
-
Generate code if needed:
# After modifying CRDs make manifests generate -
Run tests:
make test -
Run linter:
make lint
make buildThe binary will be in bin/manager.
make docker-build IMG=<your-registry>/wva-controller:tagmake docker-push IMG=<your-registry>/wva-controller:tagPLATFORMS=linux/arm64,linux/amd64 make docker-buildx IMG=<your-registry>/wva-controller:tag# Run all unit tests
make test
# Run specific package tests
go test ./internal/optimizer/...
# With coverage
go test -cover ./...# Run all E2E tests
make test-e2e
# Run specific tests
make test-e2e FOCUS="single VA"
# Skip specific tests
make test-e2e SKIP="multiple VA"# Run E2E tests on OpenShift cluster
make test-e2e-openshift
# With custom image
make test-e2e-openshift IMG=<your-registry>/wva-controller:tag
# Run specific OpenShift tests
make test-e2e-openshift FOCUS="HPA integration"Prerequisites for OpenShift E2E:
- Access to an OpenShift cluster (OCP 4.12+)
ocCLI tool configured and authenticated- Cluster admin permissions
- Prometheus operator installed
See Testing Guide for more details.
-
Deploy to Kind cluster:
make deploy-llm-d-wva-emulated-on-kind IMG=<your-image>
-
Create test resources:
kubectl apply -f config/samples/
-
Monitor controller logs:
kubectl logs -n workload-variant-autoscaler-system \ deployment/workload-variant-autoscaler-controller-manager -f
# Generate deepcopy, CRD manifests, and RBAC
make manifests generatemake crd-docsOutput will be in docs/user-guide/crd-reference.md.
Create .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Controller",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/main.go",
"env": {
"KUBECONFIG": "${env:HOME}/.kube/config"
},
"args": []
}
]
}# Build debug image
go build -gcflags="all=-N -l" -o bin/manager cmd/main.go
# Deploy and attach debugger (e.g., Delve)kubectl logs -n workload-variant-autoscaler-system \
-l control-plane=controller-manager --tail=100 -f- Modify
api/v1alpha1/variantautoscaling_types.go - Run
make manifests generate - Update tests
- Run
make crd-docs - Update user documentation
- Define metric in
internal/metrics/metrics.go - Emit metric from appropriate controller location
- Update Prometheus integration docs
- Add to Grafana dashboards (if applicable)
- Update code in
pkg/solver/orpkg/analyzer/ - Add/update unit tests
- Run
make test - Update design documentation if algorithm changes
After code changes, update relevant docs in:
docs/user-guide/- User-facing changesdocs/design/- Architecture/design changesdocs/integrations/- Integration guide updates
Verify all commands and examples in documentation work:
# Test installation steps
# Test configuration examples
# Test all code snippetsSee Releasing Guide (coming soon) for the release process.
- Check CONTRIBUTING.md
- Review existing code and tests
- Ask in GitHub Discussions
- Attend community meetings
# Format code
make fmt
# Vet code
make vet
# Run linter
make lint
# Fix linting issues
make lint-fix
# Clean build artifacts
rm -rf bin/ dist/
# Reset Kind cluster
make destroy-kind-cluster
make create-kind-cluster- Read Testing Guide
- Review Code Style Guidelines
- Check out Good First Issues