Development Setup¶
Set up your local environment for 5-Spot development.
Prerequisites¶
Required¶
- Rust: 1.75 or later (install via rustup)
- kubectl: Configured with cluster access
- Docker: For container builds
Optional¶
- kind: For local Kubernetes clusters
- minikube: Alternative local cluster
- cargo-watch: For development hot-reload
Installation¶
Clone the Repository¶
Install Rust Dependencies¶
# Install Rust if not already installed
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Ensure you have the latest stable Rust
rustup update stable
Install Development Tools¶
# Code formatting
rustup component add rustfmt
# Linting
rustup component add clippy
# Watch mode (optional)
cargo install cargo-watch
Building¶
Debug Build¶
Release Build¶
Generate CRDs¶
Generate API Documentation¶
Running Locally¶
Prerequisites¶
- A Kubernetes cluster (kind, minikube, or remote)
- CAPI installed on the cluster
kubectlconfigured to access the cluster
Install CRDs¶
Run the Operator¶
# Development mode with debug logging
RUST_LOG=debug cargo run
# Or with cargo-watch for auto-reload
cargo watch -x run
Testing¶
Run All Tests¶
Run Specific Tests¶
# Run tests matching a pattern
cargo test schedule
# Run tests in a specific module
cargo test --lib crd_tests
Run with Output¶
Code Quality¶
Format Code¶
Lint Code¶
Check All¶
IDE Setup¶
VS Code¶
Recommended extensions: - rust-analyzer - Even Better TOML - crates
Settings (.vscode/settings.json):
IntelliJ IDEA / RustRover¶
- Install Rust plugin
- Enable rustfmt on save
- Configure clippy as external linter
Local Kubernetes¶
kind¶
# Create cluster
kind create cluster --name 5spot-dev
# Install CAPI
clusterctl init
# Apply CRDs
kubectl apply -f deploy/crds/
minikube¶
# Start cluster
minikube start --cpus 4 --memory 8g
# Install CAPI
clusterctl init
# Apply CRDs
kubectl apply -f deploy/crds/
Related¶
- Building - Detailed build instructions
- Testing - Testing strategies
- Contributing - Contribution guidelines