Skip to content

feat(operator): delegate KapeTool memory provisioning to QdrantCluster CRD - #145

Merged
dzungtr merged 1 commit into
mainfrom
feat/13-kapetool-db-crd
Jul 19, 2026
Merged

dzungtr merged 1 commit into
mainfrom
feat/13-kapetool-db-crd

Conversation

@dzungtr

@dzungtr dzungtr commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replaces raw StatefulSet/Service provisioning with upstream qdrant-operator CRD delegation (QdrantCluster.qdrant.io/v1alpha1)
  • Adds QdrantClusterPort interface and QdrantClusterAdapter in operator/infra/qdrant/ with CRD discovery, create/update, and status polling
  • ToolReconciler.reconcileMemory() now surfaces MemoryReady=False/OperatorNotInstalled when the CRD is absent, QdrantClusterNotReady while provisioning, and Ready=True once the cluster is up
  • Connection URL resolved from status.url (or predictable in-cluster DNS fallback) is injected into handler Deployments as QDRANT_URL via tool.Status.QdrantEndpoint
  • Updated README: removed infra/qdrant/ from Empty Scaffolds, updated ports/adapters tables and reconciler description

Test plan

  • go test ./operator/... — all new tests pass (6 new QdrantClusterAdapter tests + 3 new ToolReconciler memory-type tests)
  • Build confirms: go build ./operator/... succeeds
  • Existing operator tests unchanged and passing
  • Verify OperatorNotInstalled condition when qdrant-operator not installed (no CRD)
  • Verify QdrantClusterNotReady condition while QdrantCluster is provisioning
  • Verify QDRANT_URL env var injected into handler Deployment once cluster is ready

Closes #13

🤖 Generated with Claude Code

…r CRD

Replace raw StatefulSet provisioning with upstream qdrant-operator CRD
delegation. The ToolReconciler now creates a QdrantCluster CRD (qdrant.io/v1alpha1)
with an owner reference back to the KapeTool, polls its status.conditions
for Ready=True, surfaces a MemoryReady condition with OperatorNotInstalled
when the CRD is missing, and threads the resolved connection URL into handler
Deployments as QDRANT_URL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dzungtr
dzungtr force-pushed the feat/13-kapetool-db-crd branch from fff9592 to 6f2bfed Compare July 19, 2026 14:21
@dzungtr

dzungtr commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

Autonomous review + merge pass (rebased onto current main, resolving conflicts in operator/controller/reconcile/tool.go and operator/infra/k8s/deployment.go to preserve both #143's external-URL/SecretRef path and #145's CRD-delegation path).

Gates verified locally:

  • go build ./... clean
  • go vet ./operator/... clean
  • go test ./operator/... all pass (11 ToolReconciler tests incl. 3 new memory-type + 3 external-URL; 6 new QdrantClusterAdapter tests)

Acceptance criteria for #13 verified in-diff:

  • QdrantCluster CRD delegation replaces raw StatefulSet/Service provisioning (controller/tool.go drops Owns(StatefulSet/Service); reconcileProvisionedMemory calls IsCRDInstalled → EnsureQdrantCluster → GetQdrantClusterStatus).
  • QdrantClusterPort interface defined in operator/infra/ports/tool.go; QdrantClusterAdapter implements it with discovery + unstructured client.
  • Reconciler branches on CRD presence: OperatorNotInstalled (30s requeue), QdrantClusterNotReady (15s requeue), Ready=True (30s requeue).
  • QDRANT_URL injected from status.url with in-cluster DNS fallback http://<name>.<ns>:6333 into handler Deployments via tool.Status.QdrantEndpoint.
  • Owner reference back to KapeTool set in buildQdrantCluster with controller=true.
  • README updated consistently (removed infra/qdrant from Empty Scaffolds, updated ports/adapters tables).

Coexistence with #143: external-URL path (reconcileExternalMemory + QDRANT_API_KEY SecretRef injection) and CRD-provisioned path both work; 3 external-URL tests pass unmodified in intent.

Non-blocking heads-up (NOT a change request — outside the gate spec):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KapeTool memory: provision via database-operator CRDs and poll for readiness

1 participant