Skip to content

feat(k8s): Trigger RAG ingest on default-branch pushes #5402

Open

Description

@devops-cli-service

Update 2026-11-26 (infra move): The cluster side of this trigger belongs to dan-petty/homelab.

This item keeps the product part: the Sensor for rag-ingest and its network policy in k8s/devops/, the Secret row of this workload, and the rag-push-check command of the design. Argo Events, the GitHub EventSource, its public route and its ingress policy are the homelab follow-up, which comes first.

Follow-up: dan-petty/homelab#299.


Split from #3589.

Problem: A default-branch push does not start an ingest. The index waits for the next poll. Why deferred: The cluster does not install Argo Events. A GitHub webhook needs an event source, a Sensor, a public endpoint and a webhook secret. These are outside the scheduled lane. Acceptance criteria: Argo Events event source receives a GitHub push webhook for a repository in service.repos. A Sensor creates one Workflow from WorkflowTemplate rag-ingest with mutex rag-ingest. The event source validates the webhook secret. NetworkPolicies admit the webhook route to the event source. k8s/README.md and the cluster checks describe the push trigger. uv run devops ci passes.

Proposed design

Problem statement

A default-branch push does not start a RAG ingest. The index waits for the next poll. The cluster side (Argo Events, the GitHub EventSource, its public route and its ingress policy) is in dan-petty/homelab#299. This item adds the product Sensor for rag-ingest, its NetworkPolicy, the webhook Secret row and the rag-push-check command. The poll stays the source of truth.

Acceptance criteria

Requirement: RAG ingest Sensor

The product k8s manifests SHALL define an Argo Events Sensor that creates one Workflow from WorkflowTemplate rag-ingest with mutex rag-ingest for a GitHub push event.

Scenario: Sensor manifest validation

  • WHEN uv run devops ci --check --only k8s runs after the Sensor manifest is registered in PRODUCT_MANIFESTS_BY_STACK.
  • THEN The command exits 0.

Requirement: Sensor NetworkPolicy

The product k8s manifests SHALL define an egress NetworkPolicy for the Sensor pods.

Scenario: NetworkPolicy validation

  • WHEN uv run devops ci --check --only k8s runs.
  • THEN The command exits 0 and the k8s check reports no dual-type NetworkPolicy.

Requirement: Webhook Secret row

The product Secret table SHALL define a row for the GitHub webhook secret in the argo-events namespace with a keyring generator.

Scenario: Secret row test

  • WHEN uv run pytest tests/commands/k8s/test_k8s.py -k webhook_secret runs.
  • THEN The test passes and the row names the keyring key rag_github_webhook_secret.

Requirement: Signed push check command

The rag-push-check command MUST build a GitHub HMAC SHA-256 signature from the webhook secret and send it in the X-Hub-Signature-256 header.

Scenario: Command unit test

  • WHEN uv run pytest tests/commands/k8s/test_k8s.py -k rag_push_check runs.
  • THEN The test passes and the fake EventSource receives the signed push payload.

Requirement: Pending a person after the merge

The live rag-push-check proof MUST create one rag-ingest Workflow after dan-petty/homelab#299 is done.

Scenario: Live signed push check

  • WHEN A person runs uv run devops k8s rag-push-check --test after the merge and after dan-petty/homelab#299.
  • THEN The command exits 0 and prints the name of exactly one created rag-ingest Workflow.

Requirement: Push trigger documentation

k8s/README.md SHALL describe the product Sensor, the webhook Secret row and the homelab EventSource dependency.

Scenario: Documentation validation

  • WHEN uv run devops ci --check --only docs runs.
  • THEN The command exits 0.

Requirement: Full CI

The change SHALL pass uv run devops ci.

Scenario: Full CI run

  • WHEN uv run devops ci runs.
  • THEN The command exits 0.

Existing Tool Considered

No alternatives check has run. The open, maintained tool is Argo Events: its Sensor creates one Workflow from WorkflowTemplate rag-ingest on a GitHub push event. It lacks the GitHub EventSource, its public route and its ingress policy; dan-petty/homelab#299 provides them. The change adds only the product Sensor, its NetworkPolicy, the webhook Secret row and the rag-push-check command. The command is a thin signed-HTTP client: about 150 lines, 8k tokens to build, 2k tokens to keep, and 2 hours.

Key questions

  • Which open tool turns a GitHub push into a RAG ingest Workflow?: Argo Events. Its Sensor creates one Workflow from WorkflowTemplate rag-ingest on a GitHub push event. The homelab follow-up installs Argo Events and the GitHub EventSource. (best practice) [sources: k8s/README.md]
    • Chosen: Argo Events. It is open, maintained, and its Sensor creates Workflows from event sources.
    • Rejected: GitHub Actions repository_dispatch. It adds a second CI path and no cluster-local Sensor.
    • Rejected: Custom webhook service. It needs code for signature validation, filtering and Workflow creation.
  • Where do the Sensor and its NetworkPolicy live?: In k8s/devops/argo-events/, registered in PRODUCT_MANIFESTS_BY_STACK. The product base ships them, and the homelab follow-up installs the Argo Events controller. (best practice) [sources: k8s/README.md, k8s/devops/alerts/inbox.yaml]
    • Chosen: k8s/devops/argo-events/. The product base groups product manifests by component and registers each path in PRODUCT_MANIFESTS_BY_STACK.
    • Rejected: k8s/devops/ root. It mixes the Sensor with unrelated product manifests.
    • Rejected: dan-petty/homelab. The issue update keeps the product Sensor and its NetworkPolicy in this repository.
  • What traffic does the Sensor NetworkPolicy allow?: The policy has type Egress. It allows the Sensor to reach the Argo Events event bus and the Kubernetes API. It allows no ingress. (best practice) [sources: k8s/README.md]
    • Chosen: Egress-only policy to the event bus and the API. The Sensor subscribes to the event bus and creates Workflows through the Kubernetes API.
    • Rejected: Ingress policy from the ingress controller. The ingress controller reaches the EventSource, not the Sensor; the homelab follow-up owns that route.
    • Rejected: No NetworkPolicy. The cluster uses NetworkPolicies and the issue asks for one.
  • How does the EventSource get the GitHub webhook secret?: Add a product row to src/devops_cli/k8s/cluster_secrets.py for the argo-events namespace. The row reads the keyring key rag_github_webhook_secret and generates the value when the keyring has none. The homelab EventSource reads that Secret. (best practice) [sources: k8s/README.md, src/devops_cli/k8s/cluster_secrets.py]
    • Chosen: Product Secret row from the keyring. The k8s README says every cluster Secret comes from the keyring and a product row holds its generator.
    • Rejected: Manual kubectl create secret. It has no durable source and a second cluster gets no secret.
    • Rejected: GitHub Actions secret. The cluster cannot read a GitHub Actions secret.
  • How does the webhook endpoint reach the EventSource?: The homelab follow-up dan-petty/homelab#299 adds the public route and its ingress policy. This item adds no ingress. (best practice) [sources: k8s/README.md]
    • Chosen: Homelab follow-up route. The k8s README says the environment tree of the cluster lives only in dan-petty/homelab.
    • Rejected: Product base Ingress. It puts a cluster route in the product base, which the issue update moves to homelab.
    • Rejected: NodePort. It exposes a node port and does not use the existing tunnel.
  • Does the push trigger replace the scheduled poll?: No. The scheduled poll stays the source of truth and the fallback. The push trigger only cuts the delay. (best practice) [sources: k8s/README.md]
    • Chosen: Keep the poll. A missed webhook would stop the ingest with no fallback.
    • Rejected: Remove the poll. It makes the webhook the only trigger and loses the fallback.
  • How does rag-push-check sign the test payload?: It reads the same keyring secret and sends an HMAC SHA-256 signature in the X-Hub-Signature-256 header, as GitHub does. (best practice) [sources: src/devops_cli/k8s/cluster_secrets.py]
    • Chosen: HMAC SHA-256 signature. GitHub signs each webhook delivery with HMAC SHA-256 and the EventSource validates that signature.
    • Rejected: Unsigned test payload. The EventSource would reject it and the check would prove nothing.
  • Can the implement job register the GitHub webhook and the production secret?: No. The repository webhook is a repository setting and the secret comes from the keyring. The homelab follow-up dan-petty/homelab#299 holds that person step. (best practice) [sources: AGENTS.md, k8s/README.md]
    • Chosen: Defer to homelab#299. Only a person changes repository settings and secrets, and the issue update moves the EventSource and route to homelab.
    • Rejected: Automate with the existing GitHub App. The repository does not show that the app holds the webhook admin permission.

Fit

Fits in one pull request.

Suspected block

dan-petty/homelab#299 installs Argo Events, the GitHub EventSource, its public route and its ingress policy. This item waits for it.

Dependencies

None.

Activity

  1. added
    type/feature
    source/agent
    scope/k8s
    status/new
    value/medium
    effort/high
    on Nov 13, 2026
  2. devops-cli-service commented on Nov 13, 2026

    @devops-cli-service
    ContributorAuthor
  3. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    ContributorAuthor

    Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.

  4. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

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/highpriority/p2-mediumscope/k8ssource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions