Skip to content

[Initiative] Controller Manager Reconciliation Loop for Core Resources and CRDs #165

@juliuskrah

Description

@juliuskrah

Summary

Define a Kubernetes-style controller manager in gitstore-api that reconciles both core resources and CRD-defined kinds from unified API watch events while preserving strict ownership boundaries: .spec is Git-owned and .status is controller-owned.

This initiative establishes the runtime loop that consumes watch events, executes reconciliation handlers, and writes observed state back through the API contract.

Scope

In Scope

  • Define the controller manager runtime model (worker lifecycle, queueing, retry/backoff, idempotency).
  • Define reconcile contracts for core resources and CRD kinds with a shared handler interface.
  • Define list-then-watch startup flow for controllers (resourceVersion checkpointing and resume).
  • Define ownership boundaries for writes: .spec via Git pipeline, .status via API status mutation.
  • Define optimistic concurrency requirements for status updates using resourceVersion/preconditions.
  • Add integration tests for controller startup, disconnect/reconnect resume, and status write conflict handling.
  • Document operational runbooks (lagging controller, replay window exceeded, poisoned work item retries).

Out of Scope

  • Buyer-facing AI UX and storefront personalization.
  • Mutating admission controllers.
  • Replacing GraphQL with REST endpoints.
  • Public client-facing realtime subscriptions.

Acceptance Criteria

  • Controller manager lifecycle and reconcile interface are documented and implemented.
  • Core resources and CRD kinds can be reconciled through the same manager pipeline.
  • Controllers resume safely from persisted resourceVersion checkpoints after disconnect.
  • Status write path enforces optimistic concurrency and returns deterministic conflict errors.
  • Integration tests cover successful reconcile, retry, replay/resume, and conflict scenarios.
  • Runbooks exist for replay recovery and controller lag remediation.

Dependencies

Implementation Plan

  1. #180 — Controller manager runtime foundations
  2. #181 — Shared reconcile handler contract for core and CRD kinds (blocked by #180)
  3. #182 — Startup resume and resourceVersion checkpointing contract (blocked by #180)
  4. #183 — Integration tests and operations runbook (blocked by #181 and #182)

Tracking

  • Area: infra
  • Priority: p2 - high
  • Target Milestone / Release: TBD

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions