Operator Design¶
Design and implementation of the Bindy operator.
Operator Pattern¶
Bindy implements the Kubernetes operator pattern:
- Watch - Monitor CRD resources
- Reconcile - Ensure actual state matches desired
- Update - Apply changes to Kubernetes resources
Reconciliation Loop¶
loop {
// Get resource from work queue
let resource = queue.pop();
// Reconcile
match reconcile(resource).await {
Ok(_) => {
// Success - requeue with normal delay
queue.requeue(resource, Duration::from_secs(300));
}
Err(e) => {
// Error - retry with backoff
queue.requeue_with_backoff(resource, e);
}
}
}
State Management¶
Operator maintains no local state - all state in Kubernetes: - CRD resources (desired state) - Deployments, Services, ConfigMaps (actual state) - Status fields (observed state)
Error Handling¶
- Transient errors: Retry with exponential backoff
- Permanent errors: Update status, log, requeue
- Resource conflicts: Retry with latest version