Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Development Workflow

Daily development workflow for Bindy contributors.

Development Cycle

  1. Create feature branch
git checkout -b feature/my-feature
  1. Make changes
  • Edit code in src/
  • If modifying CRDs, edit Rust types in src/crd.rs
  • Add tests
  • Update documentation
  1. Regenerate CRDs (if modified)
# If you modified src/crd.rs, regenerate YAML files
cargo run --bin crdgen
# or
make crds
  1. Test locally
cargo test
cargo clippy -- -D warnings
cargo fmt
  1. Validate CRDs
# Ensure generated CRDs are valid
kubectl apply --dry-run=client -f deploy/crds/
  1. Commit changes
git add .
git commit -m "Add feature: description"
  1. Push and create PR
git push origin feature/my-feature
# Create PR on GitHub

CRD Development

IMPORTANT: src/crd.rs is the source of truth. CRD YAML files in deploy/crds/ are auto-generated.

Modifying Existing CRDs

  1. Edit the Rust type in src/crd.rs:
#![allow(unused)]
fn main() {
#[derive(CustomResource, Clone, Debug, Serialize, Deserialize, JsonSchema)]
#[kube(
    group = "bindy.firestoned.io",
    version = "v1alpha1",
    kind = "Bind9Cluster",
    namespaced
)]
#[serde(rename_all = "camelCase")]
pub struct Bind9ClusterSpec {
    pub version: Option<String>,
    // Add new fields here
    pub new_field: Option<String>,
}
}
  1. Regenerate YAML files:
cargo run --bin crdgen
# or
make crds
  1. Verify the generated YAML:
# Check the generated file
cat deploy/crds/bind9clusters.crd.yaml

# Validate it
kubectl apply --dry-run=client -f deploy/crds/bind9clusters.crd.yaml
  1. Update documentation to describe the new field

Adding New CRDs

  1. Define the CustomResource in src/crd.rs
  2. Add to crdgen in src/bin/crdgen.rs:
#![allow(unused)]
fn main() {
generate_crd::<MyNewResource>("mynewresources.crd.yaml", output_dir)?;
}
  1. Regenerate YAMLs: make crds
  2. Export the type in src/lib.rs if needed

Generated YAML Format

All generated CRD files include:

  • Copyright header
  • SPDX license identifier
  • Auto-generated warning

Never edit YAML files directly - they will be overwritten!

Local Testing

# Start kind cluster
kind create cluster --name bindy-dev

# Deploy CRDs (regenerate first if modified)
make crds
kubectl apply -k deploy/crds/

# Run controller locally
RUST_LOG=debug cargo run

Hot Reload

# Auto-rebuild on changes
cargo watch -x 'run --release'