Repository navigation
Description
Delivery bundle: B: Lifecycle correctness and status. See #397 and #368 for the four-PR stack.
Parent: #391
Roadmap: #368
Plan item: PR-03
Priority: P1
Dependencies: None
Kubernetes support: Rolling upstream-maintained minors; use the oldest/newest boundaries pinned in config/kubernetes-versions.env. See #368 for the current policy. Unrun jobs are not passed validation.
Problem Statement
Evidence: pkg/resources/reconciler.go:39 omits context from the component interface; pkg/resources/kafka/kafka.go:241, pkg/k8sutil/resource.go:46, and status helpers create background/TODO contexts.
Proposed Solution
Files: pkg/resources/reconciler.go, component implementations under pkg/resources/, pkg/k8sutil/resource.go, pkg/k8sutil/status.go, their callers/tests, controllers/kafkacluster_controller.go, relevant PKI/Kafka/scale adapters, and manager/chart configuration if exposing timeout controls.
Interface contract: Change ComponentReconciler.Reconcile(logr.Logger) error to Reconcile(context.Context, logr.Logger) error. Thread the caller's context through subordinate Kubernetes calls and context-capable external requests. Introduce a nonzero controller timeout only with a documented, validated budget.
- Add cancellation tests for component Kubernetes reads/writes, conflict waits, and context-capable external calls; cancellation must reach the operation rather than merely the top-level controller.
- Update the interface and all implementations/callers coherently; retain background contexts only for explicitly bounded shutdown cleanup.
- Bound Kafka transport/admin operations where the library cannot honor context directly. Do not wrap blocking mutations in detached goroutines and pretend they were cancelled.
- Add timeout configuration validation and test that the timeout metric becomes observable when the guardrail expires and reconciliation returns.
- Validate with
go test ./controllers ./pkg/resources/... ./pkg/k8sutil/... ./pkg/pki/... ./pkg/kafkaclient/... ./pkg/scale/...; run cancellation integration tests with envtest.
Done when: Reconcile cancellation propagates through the implemented path; timeout values and remaining non-context-capable operations are documented.
Delivery: Four consolidated PRs, approved November 16, 2026: A -> B -> C; D branches from A. Foundation is #395. The 22 PR-XX identifiers are work-item IDs, not separate PRs. Preserve every work-item acceptance criterion and native dependency. No gated experiment is automatically enabled, and no issue is complete merely because one PR references it. D must satisfy its native #375 gate, including lifecycle-domain signals assigned to B; branching from A does not waive that merge prerequisite. Write focused regression tests first; record exact commands/results and run make check plus this issue's real-cluster/measurement gates.
Alternatives Considered
Twenty-two individual PRs add unnecessary integration overhead, while one omnibus PR obscures correctness and rollout boundaries. Deliver this scope in its approved dependency-aligned bundle. Do not expand into deferred consistency, storage, or concurrency changes without their own decision gates.
Additional Context
Baseline: 95138e0d; detailed roadmap scope: #368, section PR-03. The roadmap #368 and its native sub-issues are the planning source of truth. No planning document is committed in the final PR diffs. Re-read affected source and overlapping work before implementation. Historical baseline test passes are not validation of this change.
Activity
amuraru commentedon Nov 17, 2026
Necessary cancellation moves into the retained failure paths in #391/#394. The repository-wide component-interface and timeout-configuration project is removed under #368; it is not a prerequisite for bounded topic deletion.