Repository navigation
feat: KapeTool memory — support external user-managed database URL - #143
Conversation
Adds an optional `external` field to `MemorySpec` so users can point a KapeTool at a pre-existing Qdrant instance instead of having KAPE provision one. When `spec.memory.external` is set, the reconciler skips StatefulSet/Service/PVC provisioning and publishes the external URL directly into `status.QdrantEndpoint` (which the TOML renderer already reads for handler pod wiring). The provisioning path is unchanged when `external` is absent. Closes #12 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
606fefd to
21e9b13
Compare
|
Review — requesting changes (admin cannot use the request-changes API on own PR, so posting findings here) Thanks for this — the overall structure is clean and tests pass locally ( Finding 1 —
But the implementation does not do this. Issue #12 acceptance criterion: "set → skip provisioning, pass Options: (a) wire Finding 2 — external URL has no format validation
Suggested: add Notes on what is already correct
Verdict: FIX-ROUND-NEEDED — please address Finding 1 (wire |
…143) Finding 1: ExternalMemorySpec.SecretRef was declared but never wired into the handler pod. The deployment builder now injects a QDRANT_API_KEY env var with a SecretKeySelector referencing the user-specified Secret (name=ext.SecretRef.Name, key=apiKey default) when the chosen memory tool points at an external database with a SecretRef. Finding 2: ExternalMemorySpec.URL only had MinLength=1; a value without an http(s):// scheme would be silently published into status.QdrantEndpoint. Added a +kubebuilder:validation:Pattern on URL (regenerated CRD) and a defense-in-depth scheme check in reconcileExternalMemory that sets Ready=False / Reason=InvalidExternalURL and returns an error. Tests: - TestBuildDeployment_ExternalMemorySecretRef_InjectsAPIKeyEnv - TestBuildDeployment_ExternalMemoryNoSecretRef_OmitsAPIKeyEnv - TestToolReconciler_ExternalMemory_MalformedURL_ReportsError Refs issue #12.
Summary
ExternalMemorySpectype withURL(required) andSecretRef(optional) fields tooperator/infra/api/v1alpha1/kapetool_types.goExternal *ExternalMemorySpecfield toMemorySpec(json:"external,omitempty")reconcileMemory: whenexternalis set, skips Qdrant StatefulSet/Service/PVC provisioning and publishes the external URL intostatus.QdrantEndpoint; whenexternalis nil, existing provisioning path is unchangedzz_generated.deepcopy.goandcrds/kape.io_kapetools.yamlregenerated viamake generateexternalfield description and example YAMLTest plan
TestToolReconciler_ExternalMemory_SetsReadyWithExternalURL— skips StatefulSet, setsQdrantEndpointfrom URL,Ready=True/ExternalDatabaseTestToolReconciler_ExternalMemory_WithSecretRef_SetsReady— same with SecretRef presentTestToolReconciler_ProvisionedMemory_ExternalNil_StillProvisions— confirms provisioning path unchanged whenexternalis nilgo test ./operator/...)Closes #12
🤖 Generated with Claude Code