Skip to content

Add Helm chart for Kubernetes deployment of CodeRAG#14

Merged
Neverdecel merged 2 commits into
masterfrom
claude/tender-bardeen-ccl6qz
Jun 16, 2026
Merged

Add Helm chart for Kubernetes deployment of CodeRAG#14
Neverdecel merged 2 commits into
masterfrom
claude/tender-bardeen-ccl6qz

Conversation

@Neverdecel

Copy link
Copy Markdown
Owner

Summary

This PR adds a production-ready Helm chart for deploying CodeRAG on Kubernetes, enabling teams to self-host the HTTP API and optional Streamlit UI with persistent indexing, git-sourced workspaces, and hardened security defaults.

Key Changes

  • Helm Chart (deploy/helm/coderag/): Complete chart with configurable deployments for the API server and optional UI

    • Server Deployment with single-replica, Recreate strategy to ensure safe SQLite/FAISS writes
    • Optional UI Deployment as an independent instance with its own data volume
    • PersistentVolumeClaims for index storage with helm.sh/resource-policy: keep to prevent accidental deletion
    • ConfigMap for engine configuration (provider, model, LLM settings)
    • Secret management for API keys (OpenAI, Anthropic)
    • Services for both server and UI with configurable types (ClusterIP, NodePort, LoadBalancer)
    • Ingress support for exposing services externally
  • Indexing Jobs: HTTP-driven indexing to maintain single-writer safety

    • Initial Job that builds the index on install/upgrade (revision-suffixed to avoid collisions)
    • Optional CronJob for scheduled re-indexing with git-sync sidecar support
  • Workspace Management:

    • Git init container for cloning repositories (with configurable depth, branch/tag)
    • Optional git-sync sidecar for keeping workspace fresh
    • Support for existing PVCs or emptyDir volumes
    • Read-only workspace mount in app containers
  • Security Hardening:

    • Non-root user (uid 10001)
    • Read-only root filesystem
    • Dropped capabilities
    • RuntimeDefault seccomp
    • Service account token not mounted by default
    • Comprehensive startup/readiness/liveness probes
  • Configuration & Values:

    • Extensive values.yaml with sensible defaults and detailed comments
    • Support for local embeddings (fastembed), OpenAI, Anthropic, and fake providers
    • Self-hosted LLM endpoints (Ollama, vLLM, etc.)
    • Model caching on persistent volume to avoid re-downloads
    • Resource requests/limits for both server and UI
  • Documentation:

    • Comprehensive deploy/README.md with architecture overview, quick start, and common scenarios
    • NOTES.txt template with post-install instructions
    • CI test values for default and full configurations
    • Helm chart linting and kubeconform validation workflow
  • CI/CD:

    • GitHub Actions workflow (helm.yml) for linting and schema validation across multiple Kubernetes versions (1.27, 1.29, 1.31)
  • Root README Update: Added Kubernetes/Helm section with quick reference

Notable Implementation Details

  • Single-writer safety: Chart enforces replicas: 1 and Recreate strategy since FAISS index writes are non-atomic
  • HTTP-driven indexing: Index jobs call POST /index on the running server rather than mounting the volume directly, ensuring exactly one process touches index files
  • Model caching: Embedding model (~130 MB) cached on data volume with generous startup probe to cover first download
  • Independent UI: When enabled, UI runs as a separate instance with its own volume and index, built via in-app "Reindex" button
  • Flexible workspace sources: Supports git cloning, existing PVCs, or emptyDir with custom init containers for private repos

https://claude.ai/code/session_011ehFw23bFYqnEPe7HJCgpL

claude added 2 commits June 16, 2026 11:42
Self-host the CodeRAG HTTP/REST API (and optional Streamlit UI) on Kubernetes
for teams who want a shared, always-on deployment.

The chart is built around CodeRAG's single-writer model (SQLite source of truth +
non-atomic FAISS cache):

- 1 replica, Recreate strategy, ReadWriteOnce PVC — never two writers on one index.
- Indexing is driven over HTTP (initial Job + optional reindex CronJob), so no
  second pod ever mounts the index volume.
- The embedding model is cached on the data volume (CODERAG_CACHE_DIR) and a
  generous startup probe covers the first download before liveness kicks in.
- Codebase sourced via a git init container (with optional git-sync sidecar),
  an existing PVC, or an emptyDir; mounted read-only into the engine.
- Hardened defaults: non-root (uid 10001), read-only rootfs with writable
  /tmp, /data, /home, dropped capabilities, RuntimeDefault seccomp, no SA token.
- ConfigMap/Secret for CODERAG_* config and OpenAI/Anthropic keys; optional
  Ingress; Helm test; NOTES with next steps.

Also adds:
- deploy/README.md: full guide (private repos, keys, ingress, UI, reindex,
  plain-kubectl via `helm template`).
- .github/workflows/helm.yml: helm lint + template + kubeconform (k8s 1.27/1.29/1.31).
- README + .dockerignore updates.

Validated with helm lint, helm template, and kubeconform (strict) across the
default and full value sets.

https://claude.ai/code/session_011ehFw23bFYqnEPe7HJCgpL
Make the chart easy to run inside any cluster:

- Standalone default: workspace.source now defaults to emptyDir, so
  `helm install ./deploy/helm/coderag` runs with ZERO required config — a healthy
  server on the cluster's default StorageClass with an empty index. Point it at code
  later via workspace.source=git (repository) or existingClaim. `source=git` still
  requires a repository (guarded with a clear error).

- Storage that fits common infrastructure:
  - storageClass "" uses the cluster default (EKS gp3, GKE standard-rwo, AKS managed-csi,
    k3s local-path, kind/minikube standard, …) — works out of the box.
  - storageClass "-" disables dynamic provisioning for static binding.
  - new persistence.volumeName / selector / annotations to bind a pre-provisioned PV
    (NFS, hostPath, local, Longhorn, …); mirrored under ui.persistence.
  - shared coderag.pvcSpec helper keeps server/ui PVCs consistent.

- Docs: deploy/README gains a Storage section (provider default classes, self-managed
  provisioners, static PV binding, existingClaim) and a zero-config quick start;
  NOTES.txt guides standalone users to attach their code.

- CI: also render the bare-defaults (standalone) path, and exercise the static-storage
  fields via the default value set.

Validated with helm lint + kubeconform (strict) across standalone, static-storage, and
full value sets on k8s 1.27/1.29/1.31.

https://claude.ai/code/session_011ehFw23bFYqnEPe7HJCgpL
@Neverdecel Neverdecel merged commit b0cddcf into master Jun 16, 2026
7 checks passed
@Neverdecel Neverdecel deleted the claude/tender-bardeen-ccl6qz branch June 18, 2026 08:01
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.

2 participants