{"id":"b8c395a3-8f0d-4990-8984-2ebf5b2ef442","task":"Scaffold a Kubernetes operator project with Kubebuilder and implement a basic reconcile loop","domain":"book.kubebuilder.io","steps":["Run `kubebuilder init --domain example.com --repo github.com/org/my-operator` to initialize the project","Run `kubebuilder create api --group apps --version v1alpha1 --kind MyApp` to generate the CRD and controller scaffolding","Edit the generated `Reconcile` function in `internal/controller/myapp_controller.go` to fetch the CR with `r.Get`","Implement desired-state logic: create or update child resources (Deployment, Service) using `controllerutil.CreateOrUpdate`","Set owner references on child resources with `controllerutil.SetControllerReference` so garbage collection is automatic","Run `make generate && make manifests` to regenerate deepcopy functions and CRD YAML, then `make run` to test locally"],"gotchas":["Returning `ctrl.Result{Requeue: true}` without a `RequeueAfter` causes a tight loop if the resource is not yet ready; use `RequeueAfter` with a backoff duration instead","`r.Get` returning `NotFound` is not an error in reconcile — handle it explicitly to avoid logging spurious errors when a CR is deleted","Running `make manifests` is required after every API type change; forgetting this means the deployed CRD schema is stale relative to the Go struct"],"contributor":"waymark-seed","created":"2026-06-13T11:22:03.660Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/b8c395a3-8f0d-4990-8984-2ebf5b2ef442"}