# Kubernetes Operator taste of a platform engineer who wants reconcilers that never surprise anyone
- Build operators in Go with Kubebuilder and controller-runtime; do not hand-roll informers and work queues. Confidence: 0.90
- Write an operator only when a resource has real lifecycle logic; use Helm or Kustomize for plain configuration. Confidence: 0.85
- Design the CRD spec as desired state and the status as observed state; never write user intent into status. Confidence: 0.95
- Version CRDs from the start (v1alpha1, then v1beta1, v1) and add a conversion webhook before changing field meaning. Confidence: 0.85
- Validate the spec with OpenAPI schema markers and CEL validation rules before reaching for an admission webhook. Confidence: 0.85
- Make Reconcile idempotent: read the current state, compute the difference, apply it, and return; running it twice must change nothing. Confidence: 0.95
- Never keep state in controller memory between reconciles; everything needed must be in the API server. Confidence: 0.90
- Set owner references on every child object so garbage collection cleans up after deletion. Confidence: 0.90
- Use finalizers only for cleanup outside the cluster, and always remove them even when the external call reports not found. Confidence: 0.90
- Apply child objects with server-side apply and a dedicated field manager instead of get-modify-update loops. Confidence: 0.80
- Report progress with standard status conditions (Ready, Progressing, Degraded) and set observedGeneration on each. Confidence: 0.90
- Return errors to get exponential backoff and use RequeueAfter only for planned periodic checks. Confidence: 0.85
- Watch child resources with Owns() and filter noisy updates with GenerationChangedPredicate. Confidence: 0.80
- Emit Kubernetes Events for user-visible changes and failures, not for every reconcile. Confidence: 0.75
- Run with leader election on and at least two replicas in production. Confidence: 0.85
- Give the manager the narrowest RBAC possible, generated from kubebuilder:rbac markers and reviewed in every PR. Confidence: 0.90
- Test reconcilers with envtest against a real API server, and keep a small kind-based end-to-end suite for upgrades. Confidence: 0.85
- Expose controller-runtime metrics and add counters for reconcile results per resource kind. Confidence: 0.80
- Log with structured logr fields (namespace, name, generation) and never log secret values. Confidence: 0.90
- Ship the operator with an upgrade path: old CRs must keep working after the controller is updated. Confidence: 0.85
- Document every spec field with an example in the CRD description so kubectl explain is useful. Confidence: 0.75
- Prefer a few well-defined CRDs over one giant CRD with dozens of optional knobs. Confidence: 0.70
Comments & Questions (0)
No comments yet
Be the first to comment!