Skip to content

feat(k8s): Add an Argo workflow to keep the RAG index current #1653

Closed

Description

@dan-petty

Friction

Evidence

Checked at main 3dd7fa6.

Remedy

Acceptance criteria

  • Offline manifest tests: the template mounts the Qdrant Secret and no other, the NetworkPolicy selects only the ingest pods, and the CronWorkflow forbids overlap.
  • The template is deployed by devops k8s deploy-stack --stack all.
  • uv run devops ci passes.
  • Pending a person, once in-cluster jobs have a GitHub identity: one scheduled run indexes each managed repository, and a search scoped to a private repository returns its chunks.

Related

Alternatives check of 2026-11-01: not-applicable.
Tool: none found.

Proposed design

Problem statement

The RAG index of the managed repositories' default branches goes stale. No cluster job runs the ingestion pass on a schedule. This item adds an Argo WorkflowTemplate and a CronWorkflow that run the pass from #1389. The template holds one global mutex, and the CronWorkflow forbids overlap. The Qdrant credential reaches the ingest pods only, and a lag alert shows a stale index.

Acceptance criteria

Requirement: Qdrant Secret scoped to the ingest pods

The stack SHALL reference the Qdrant credential Secret from the ingest WorkflowTemplate only.

Scenario: Secret references of the stack

  • WHEN The offline manifest test renders k8s/devops and reads the secret references of every workload.
  • THEN The test asserts that only the ingest WorkflowTemplate names the Qdrant Secret.

Requirement: Network policy selects only the ingest pods

The stack MUST select only the ingest pods for traffic to Qdrant on port 6333, on egress from the ingest pods and on ingress to Qdrant.

Scenario: Pod selectors of the Qdrant rules

  • WHEN The offline manifest test reads the Qdrant egress and ingress rules and the pod labels of the stack.
  • THEN The test asserts that both rules select the ingest pods only and name TCP port 6333.

Requirement: One ingest run at a time

The ingest WorkflowTemplate MUST hold the global rag-ingest mutex, and the CronWorkflow MUST set concurrencyPolicy: Forbid.

Scenario: Overlap is impossible

  • WHEN The offline manifest test reads the WorkflowTemplate and the CronWorkflow.
  • THEN The test asserts that spec.synchronization.mutex.name is rag-ingest and spec.concurrencyPolicy is Forbid.

Requirement: Schedule follows the poll interval

The CronWorkflow MUST use the shortest whole-minute cron period that is not shorter than service.poll_interval_seconds.

Scenario: Default poll interval

  • WHEN service.poll_interval_seconds holds its default of 151 seconds.
  • THEN The test asserts that the rendered schedule is */3 * * * *.

Requirement: One embedding request at a time

The ingest template MUST set ai.gateway_concurrency.embedding to 1.

Scenario: Embedding concurrency of the template

  • WHEN The offline manifest test reads the environment of the ingest template.
  • THEN The test asserts that the template sets the embedding concurrency to 1.

Requirement: Lag alert

The stack MUST ship a RagIngestBehind alert on the ingest freshness metric.

Scenario: Alert rule present

  • WHEN The offline manifest test reads the alert rules of the stack.
  • THEN The test asserts that one rule named RagIngestBehind reads the freshness metric and fires after two schedule periods without a success.

Requirement: Stack command renders the resources

devops k8s deploy-stack --stack all MUST render the ingest WorkflowTemplate and the CronWorkflow.

Scenario: Rendered stack

  • WHEN The offline test renders the stack with --dry-run.
  • THEN The rendered output holds the WorkflowTemplate and the CronWorkflow in namespace devops.

Requirement: Full CI passes

The change MUST pass uv run devops ci.

Scenario: Full CI

  • WHEN A person runs uv run devops ci on the branch.
  • THEN Every check reports success.

Existing Tool Considered

The alternatives check of 2026-11-01 recorded not-applicable and named no tool. Argo Workflows covers the need. It is open under Apache-2.0, CNCF-graduated and actively maintained. A CronWorkflow with concurrencyPolicy: Forbid and a WorkflowTemplate with synchronization.mutex give the schedule, the single-run lock and the overlap ban. It lacks the ingestion command, which #1389 delivers, and the Qdrant credential scoping, which a Kubernetes Secret and a NetworkPolicy give. The project builds no scheduler of its own.

Key questions

  • Which engine runs the scheduled ingestion?: Argo Workflows. The owner chose it on 2026-10-09 in feat(k8s): the argo workflows controller runs in its own namespace under argo cd and deploy-stack, and a --version workflow measures start-up and api-server load for the go/no-go on moving the roadmap jobs onto it #1535. A CronWorkflow schedules the run, and a WorkflowTemplate holds its steps. (best practice) [sources: docs/adr/0008-argo-workflows-run-the-roadmap-jobs-after-a-measured-go.md]
  • What interval does the CronWorkflow use?: The poll interval is 151 seconds, and a cron schedule cannot express it. The CronWorkflow uses */3 * * * *, which is 180 seconds, the shortest whole-minute period that is not shorter than the setting. (best practice) [sources: src/devops_cli/config/defaults.py:969, src/devops_cli/config/settings.py:1129]
    • Chosen: */3 * * * *, 180 seconds. It is the shortest whole-minute cron period that is not shorter than the 151-second setting.
    • Rejected: */2 * * * *, 120 seconds. It runs sooner than the poll interval and re-indexes an unchanged repository.
    • Rejected: */1 * * * *, 60 seconds. It costs three times the runs of the chosen period for no fresher data.
  • How do the ingest pods authenticate to GitHub for a clone of a private repository?: The template reads GH_TOKEN from Secret devops/devops-cli with envFrom.secretRef, the same source the existing CronJob uses. The identity that the token carries is outside this item. [sources: k8s/devops/cronjob.yaml:48, k8s/devops/cronjob.yaml:49, k8s/devops/cronjob.yaml:50]
  • Is a schedule alone sufficient to keep the index current?: Yes. ADR 0003 makes polling the source of truth and a webhook only a latency cut, and ADR 0017 runs the update at once for each event while the poll reconciles. A missed event delays the index by at most one schedule period. [sources: docs/adr/0003-polling-is-how-the-roadmap-sees-changes.md]
  • What concurrency model prevents two ingest runs?: A global mutex named rag-ingest in the WorkflowTemplate, plus concurrencyPolicy: Forbid on the CronWorkflow. (proposed)
    • Chosen: Argo synchronization.mutex named rag-ingest. It holds across the CronWorkflow, a manual submit and any other trigger.
    • Rejected: concurrencyPolicy: Forbid alone. It governs the runs of the CronWorkflow only, not a manual submit.
    • Rejected: A Kubernetes Lease held by the pod. It needs new code in the image, and Argo already holds the lock.
  • How do the short-lived ingest pods report metrics?: The ingestion command pushes OTel metrics through the collector, and the template sets no Prometheus scrape annotation. The RagIngestBehind alert reads the freshness metric. (best practice) [sources: tests/ai/client/test_ai_client_telemetry.py]
    • Chosen: Push over OTLP to the collector. The AI client reports OTel telemetry, and a pod that ends in seconds is not scraped.
    • Rejected: Prometheus scrape annotations. A run shorter than a scrape interval leaves no sample.
  • How is the Qdrant credential scoped to the ingest pods?: A dedicated Qdrant Secret is mounted in the ingest template's pods only. A NetworkPolicy selects those pods for egress to Qdrant on 6333, with the matching ingress rule on the Qdrant side. (best practice) [sources: k8s/devops/networkpolicy.yaml, k8s/devops/roadmap-service/networkpolicy-egress.yaml]
    • Chosen: A separate Secret plus a pod-selecting NetworkPolicy. Only the ingest pods get the Qdrant key and the route to port 6333.
    • Rejected: The Service Secret and its NetworkPolicy. It gives every Service pod the Qdrant key and does not name the ingest pods.
  • What limits the embedding load of one ingest run?: The template sets ai.gateway_concurrency.embedding to 1, so a run sends one embedding request at a time. (best practice) [sources: src/devops_cli/config/defaults.py, src/devops_cli/config/settings.py]
    • Chosen: Set ai.gateway_concurrency.embedding to 1 in the template. It keeps a scheduled run from crowding the gateway slots that the roadmap jobs use.
    • Rejected: Keep the default concurrency. A run would take every embedding slot of the gateway while it holds the mutex.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#1389, #1535

Activity

  1. added
    source/agent
    type/feature
    on Oct 18, 2026
  2. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Type: type/feature. The candidate proposes a new feature to keep RAG indexes current using Argo Workflows.
    • Priority: P2-Medium. It is a scoped enhancement that blocks no filed item and has a clear owner direction.
    • Value: High. Improves the accuracy and relevance of search results for managed repositories.
    • Effort: Medium. Involves setting up Argo Workflows, CronWorkflows, NetworkPolicies, and integrating with Qdrant.
  3. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Refine cannot set this item to Ready at d509dba while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  4. added
    priority/p2-medium
    status/new
    effort/medium
    value/high
    scope/k8s
    on Oct 28, 2026
  5. devops-cli-service commented on Nov 1, 2026

    @devops-cli-service
    Contributor

    Alternatives check: not-applicable

    Tool: none found

    Checked on 2026-11-01. A person decides what this means for the item. The check changes no label and closes no issue.

  6. changed the title [-]feat(k8s): an argo workflow keeps the rag index of every managed repository's default branch current, on the poll schedule and on each default-branch push[/-] [+]feat(k8s): Add an Argo workflow to keep the RAG index current[/+] on Nov 6, 2026
  7. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 143 characters, and the limit is 60. The type and the scope stay.

    • Before: feat(k8s): an argo workflow keeps the rag index of every managed repository's default branch current, on the poll schedule and on each default-branch push
    • After: feat(k8s): Add an Argo workflow to keep the RAG index current
    • Source of the summary: the background model
  8. added
    status/ready
    and removed
    status/new
    on Nov 7, 2026
  9. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 72c52c6 (see proposed design in issue body).

    Moved to new items: #3949, #3950.

  10. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 8, 2026
  11. removed
    status/in-review
    on Nov 8, 2026
  12. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor
  13. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-08 21:00 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/k8ssource/agenttype/featurevalue/high

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions