Development Workflow
Daily development workflow for Bindy contributors.
Development Cycle
- Create feature branch
git checkout -b feature/my-feature
- Make changes
- Edit code in
src/ - If modifying CRDs, edit Rust types in
src/crd.rs - Add tests
- Update documentation
- Regenerate CRDs (if modified)
# If you modified src/crd.rs, regenerate YAML files
cargo run --bin crdgen
# or
make crds
- Test locally
cargo test
cargo clippy -- -D warnings
cargo fmt
- Validate CRDs
# Ensure generated CRDs are valid
kubectl apply --dry-run=client -f deploy/crds/
- Commit changes
git add .
git commit -m "Add feature: description"
- 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
- 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>,
}
}
- Regenerate YAML files:
cargo run --bin crdgen
# or
make crds
- 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
- Update documentation to describe the new field
Adding New CRDs
- Define the CustomResource in
src/crd.rs - Add to crdgen in
src/bin/crdgen.rs:
#![allow(unused)]
fn main() {
generate_crd::<MyNewResource>("mynewresources.crd.yaml", output_dir)?;
}
- Regenerate YAMLs:
make crds - Export the type in
src/lib.rsif 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'