Skip to content

Development Workflow

Daily development workflow for Bindy contributors.

ADD governs all work. Before starting the cycle below, check whether the change is architecturally significant — if so, it starts with an ADR and a CALM model update, then test-driven implementation. See the Developer Guide overview for the full ADR → CALM → TDD → implement → docs → threat model pipeline.

Development Cycle

  1. Create feature branch

    git checkout -b feature/my-feature
    

  2. Make changes

  3. Edit code in src/
  4. If modifying CRDs, edit Rust types in crates/bindy-api/src/crd.rs
  5. Add tests
  6. Update documentation

  7. Regenerate CRDs (if modified)

    # If you modified crates/bindy-api/src/crd.rs, regenerate YAML files
    cargo run -p bindy-api --features crdgen --bin crdgen
    # or
    make crds
    

  8. Test locally

    cargo test
    cargo clippy -- -D warnings
    cargo fmt
    

  9. Validate CRDs

    # Ensure generated CRDs are valid
    kubectl apply --dry-run=server -f deploy/operator/crds/
    

  10. Commit changes

    git add .
    git commit -m "Add feature: description"
    

  11. Push and create PR

    git push origin feature/my-feature
    # Create PR on GitHub
    

CRD Development

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

Modifying Existing CRDs

  1. Edit the Rust type in crates/bindy-api/src/crd.rs:

    #[derive(CustomResource, Clone, Debug, Serialize, Deserialize, JsonSchema)]
    #[kube(
        group = "bindy.firestoned.io",
        version = "v1beta1",
        kind = "Bind9Cluster",
        namespaced
    )]
    #[serde(rename_all = "camelCase")]
    pub struct Bind9ClusterSpec {
        pub version: Option<String>,
        // Add new fields here
        pub new_field: Option<String>,
    }
    

  2. Regenerate YAML files:

    cargo run -p bindy-api --features crdgen --bin crdgen
    # or
    make crds
    

  3. Verify the generated YAML:

    # Check the generated file
    cat deploy/operator/crds/bind9clusters.crd.yaml
    
    # Validate it
    kubectl apply --dry-run=server -f deploy/operator/crds/bind9clusters.crd.yaml
    

  4. Update documentation to describe the new field

Adding New CRDs

  1. Define the CustomResource in crates/bindy-api/src/crd.rs
  2. Add to crdgen in crates/bindy-api/src/bin/crdgen.rs:
    generate_crd::<MyNewResource>("mynewresources.crd.yaml", output_dir)?;
    
  3. Regenerate YAMLs: make crds
  4. Export the type in crates/bindy-api/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 --server-side -f deploy/operator/crds/

# Run operator locally
RUST_LOG=debug cargo run

Hot Reload

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