Repository navigation
feat(helm): add optional KB/RAG indexing (kb plugin + CronJob) - #601
Conversation
Wire the existing context-injection KB plugin into the Helm chart, all default-OFF so existing deploys are unaffected: - values.yaml: new `kb` block (embedding model/base_url/dim, corpus, search_corpora, max_distance) + `kb.index` CronJob knobs. - configmap: when kb.enabled, append "kb" to plugins and render [kb] with db_path on the data PVC (separate from docs lancedb); embedding_base_url/max_distance omitted when empty. - cronjob-kb-index.yaml (new, gated kb.enabled && kb.index.enabled): git-clones repos via a GIT_USERNAME/GIT_PASSWORD askpass helper and runs `kb index --corpus`, writing to the shared data PVC. Carries the chart selectorLabels so the NetworkPolicy covers it, and mounts the same rendered agent.toml ConfigMap as the Deployment so `kb index` reads the values-driven [kb] config (embedding dim/model/db_path) instead of the image-baked default. - SiliconFlow embedding key reaches pods as OPENAI_API_KEY via the existing agent.secretRef/secretEnv; coexists with the LLM's AGENT_API_KEY without collision. - values-example.yaml: placeholder-only KB example incl. the git-host extraEgress entry (real topology stays in private values). - tests/deploy: render contracts for default-off, [kb] config, CronJob PVC/env/netpol-labels, and CronJob<->ConfigMap mount agreement. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughAdds an optional knowledge base ( ChangesKnowledge Base Helm Feature
Sequence Diagram(s)sequenceDiagram
participant Scheduler as Kubernetes Scheduler
participant CronJob as kb-index CronJob
participant Shell as /bin/sh script
participant Git as git clone
participant KBTool as kb index CLI
participant PVC as Persistent Volume
Scheduler->>CronJob: trigger on schedule (concurrencyPolicy: Forbid)
CronJob->>Shell: exec container command
Shell->>Shell: mktemp -d temp workspace
Shell->>Shell: trap cleanup on EXIT
alt GIT_USERNAME and GIT_PASSWORD present
Shell->>Shell: generate git-askpass helper
end
loop each repo in kb.index.repos
Shell->>Git: git clone --depth 1 --branch <branch> <url> <tmpdir>
Shell->>KBTool: kb index --corpus <corpus> <tmpdir>
KBTool->>PVC: write index data to db_path
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
* fix(helm): give kb-index Job a dedicated egress NetworkPolicy The #601 kb-index CronJob carried the agent selectorLabels, so it was covered by the agent NetworkPolicy. That policy's anti-SSRF egress (default-deny private ranges via a publicHttps `except` list) blocks the Job from cloning the git host on a private/mesh range, and an extraEgress allow does not reliably override the `except` on all CNIs (observed: the covered pod times out connecting to the git host even with an explicit /32:443 allow rule present). Fix: relabel the index Job pod (app.kubernetes.io/name "<name>-kb-index", component "kb-index") so it is NOT selected by the agent policy, and add a dedicated NetworkPolicy that restricts the Job to exactly DNS + tcp/443 (forgejo private clone + embedding API public) — no `except`, no other ports. The Job runs a fixed trusted pipeline (git clone + kb index), not untrusted tool/LLM calls, so it does not need the agent's full lockdown, but it stays scoped rather than fully unrestricted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(helm): run kb-index Job unrestricted (drop unworkable dedicated netpol) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
What
Wires the existing context-injection KB plugin into the Helm chart so an o6n personal-agent deploy can use SRE + Obsidian-vault corpora as RAG, with an in-cluster indexing CronJob. Default OFF — zero blast radius on existing deploys.
This is roadmap step ③ (helm kb wiring). Vault access = Option A: vault lives in a private git repo, an in-cluster CronJob clones SRE+vault and runs
kb index.Changes
kbblock (embedding model/base_url/dim, corpus, search_corpora, max_distance) +kb.indexCronJob knobs (schedule, gitRef, repos, gitSecretName).kb.enabled, append"kb"to plugins and render[kb]withdb_pathon the data PVC (separate from docs lancedb);embedding_base_url/max_distanceomitted when empty.kb.enabled && kb.index.enabled): git-clones repos via aGIT_USERNAME/GIT_PASSWORDaskpass helper, runskb index --corpus, writes to the shared data PVC. Carries chartselectorLabelsso the NetworkPolicy covers it, and mounts the same renderedagent.tomlConfigMap as the Deployment sokb indexreads the values-driven[kb]config instead of the image-baked default.OPENAI_API_KEYvia existingagent.secretRef/secretEnv; coexists with the LLM'sAGENT_API_KEY.extraEgressentry. Real topology stays in private values (chore(deploy): genericize o6n deployment config out of public repo #600 boundary).[kb]config, CronJob PVC/env/netpol-labels, and CronJob↔ConfigMap mount agreement.Verification
helm lintclean;helm templaterenders clean for default + kb-enabled.uv run pytest tests/deploy/→ 44 passed.kb indexwould use wrong embedding dim/model and off-PVC db_path; fixed + agreement test added).Operator follow-up (private values, not in repo)
OPENAI_API_KEY; git token (GIT_USERNAME/GIT_PASSWORD) for clone.networkPolicy.extraEgress(Forgejo is on a private/CGNAT range the default egressexceptblocks).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Tests