Repository navigation
Description
Update 2026-11-26 (infra move): the Argo CD project is now in dan-petty/homelab.
- The orphan glob of step 5 is a follow-up issue there (
k8s/argocd/apps/projects.yaml). - The template, the limits, the NetworkPolicy and the test stay here in
k8s/devops/. - Argo Workflows and Gitea values are also in homelab.
Follow-up: dan-petty/homelab#273.
Problem or Motivation
In the census week (2026-11-04 to 2026-11-11), 630 of 1,211 pull request CI runs ran on heads that were not final. One GitHub round takes a median of 4.6 min in the queue (p90 27.3 min) and 25.5 min of wall clock (p90 53.1 min). No place in the cluster runs the full checks of a change before a push.
The owner decided on 2026-11-11 that the iteration lane runs on the Argo cluster gate, with no Gitea for now (OD1 a). The gates run on the large node <build-node>, with a semaphore of 2 and 16 CPUs (OD2).
Proposed Solution & Architectural Design
- Spike first: run the gate on 20 recent heads.
- Add the WorkflowTemplate
devops-ci-gateunderk8s/devops/. After fix(k8s): the Argo controller manages namespace devops for rag-ingest #5289 and feat(k8s): let Argo Workflows run roadmap pods in devops #4566, the controller watches onlydevops, so a gate inargo-workflowsdoes not run:- The runner image by digest.
- No token and no Secret in the main container, and the restricted security profile.
- 16 CPUs (request = limit) and
PYTEST_XDIST_AUTO_NUM_WORKERS=16. - The gate runs the full
devops ci --checkon the squash-merge tree, in a fresh offline venv from the image wheels of perf(k8s): put the dependencies in their own image layers #4550. - A run deadline of 1,200 s inside a Workflow deadline of 2,400 s, and a TTL of 1 day.
- Add the ConfigMap
ci-gate-limitswith the semaphoregate: 2. - Take the gate pods out of the podSelector of
devops-default-perimeter(theNotInlist, as forcrawl4aiandrenovate). A NetworkPolicy can only add allowed traffic, so the gate pods cannot stay in the perimeter and refuse some of its ports. Add a NetworkPolicy of their own that allows DNS, public TCP 443 outside the private ranges, and the API server on TCP 6443.uv auditneeds OSV. - Add the gate Workflows to the Argo CD orphan glob (follow-up issue in dan-petty/homelab).
- Add a structural test of the timeout chain: test < row < run deadline < Workflow deadline. The client queue limit (900 s) and the run deadline fit inside the Workflow deadline.
- Add an ADR: the gate is a tool run before a push, not a roadmap unit. It amends ADR 0014.
A transport seam keeps the bundle input replaceable by a Gitea branch later.
Target Subsystem
Kubernetes & Minikube Automation (k8s/devops/, the runner image).
Existing Tool Considered
Argo Workflows (installed) covers the need: WorkflowTemplate, a ConfigMap semaphore, activeDeadlineSeconds and ttlStrategy. Kubernetes NetworkPolicy covers the egress. ArgoCRDService.submit_workflow and await_workflow exist. Rejected: Gitea Actions with the Gitea runner (the gitea-forge spec keeps Actions off, and the runner had 30 releases and 4 major versions in 4 months). Cost (estimate): about 300,000 tokens and 5 hours to build with the spike, about 10,000 tokens a month to keep, about 40,000 tokens to fix.
Acceptance Criteria
- Spike: p90 wall clock at most 12 min on 16 CPUs.
- Spike: at least 19 of 20 heads agree with the GitHub required result.
- Argo CD syncs the template, the ConfigMap and the NetworkPolicy.
- The timeout-chain test passes, and it fails on a broken chain.
- A gate pod has no service account token and no Secret.
- A test proves that a gate pod cannot reach the gateway on TCP 4000 or Valkey on TCP 6379.
Dependencies
- perf(k8s): seed the uv cache of a runner pod from the image #4814
- feat(k8s): let Argo Workflows run roadmap pods in devops #4566 (the controller in
devopsand thedevops-cli-nooptemplate)
Source: #4667
Alternatives check of 2026-11-26: in-use.
The repository already uses this tool.
Tool: argoproj/argo-workflows (https://github.com/argoproj/argo-workflows), Apache-2.0, last activity 2026-11-26, maintained.
Reason: Searches found Argo Workflows is a Kubernetes-native workflow engine with WorkflowTemplate, ConfigMap semaphores, deadlines and TTL, covering the whole gate need; the issue already names it as installed and in use.
Covers:
- WorkflowTemplate with parameterized bundle input
- ConfigMap semaphore limits concurrency to two
- activeDeadlineSeconds and ttlStrategy on the Workflow
- Pod spec with digest image and restricted profile
- Submit and await through ArgoCRDService
Lacks:
- NetworkPolicy egress is Kubernetes, not Argo
- No offline uv environment or wheel handling
- No structural timeout-chain test
- No Argo CD orphan glob for gate Workflows
Proposed design
Problem statement
Pull request CI runs often start on heads that are not final, and no cluster job runs the full checks before a push. The change adds the Argo Workflows gate devops-ci-gate under k8s/devops/, the ConfigMap ci-gate-limits, the gate NetworkPolicy, the structural timeout-chain check and the ADR. The gate uses the large node <build-node>, semaphore 2 and 16 CPUs. It runs the full devops ci --check on the squash-merge tree with no service account token and no Secret. The 20-head spike is a separate issue, and the Argo CD orphan glob is follow-up dan-petty/homelab#273.
Acceptance criteria
Requirement: Gate WorkflowTemplate is added
The change SHALL add WorkflowTemplate devops-ci-gate under k8s/devops/.
Scenario: The k8s row accepts the gate WorkflowTemplate
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes and the rendered
k8s/devops/kustomization contains WorkflowTemplatedevops-ci-gate.
Requirement: Runner image is pinned
The gate main container MUST use the runner image by digest.
Scenario: Runner image has a digest
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes and the gate WorkflowTemplate main container image reference contains
@sha256:.
Requirement: Gate pod has no credentials
The gate pod MUST run with no service account token and no Secret reference in the main container.
Scenario: Gate pod spec has no credentials
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes and the gate pod spec sets
automountServiceAccountTokento false and has no Secret reference in the main container.
Requirement: Gate pod is restricted
The gate pod MUST use the restricted Pod Security profile.
Scenario: Gate pod security context is restricted
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes and the gate pod spec sets
runAsNonRootto true,allowPrivilegeEscalationto false, drops all capabilities and setsseccompProfiletoRuntimeDefault.
Requirement: Gate CPU and worker count
The gate main container SHALL request and limit 16 CPUs and set PYTEST_XDIST_AUTO_NUM_WORKERS to 16.
Scenario: Gate resources match 16 CPUs
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes with a CPU request and limit of 16 and
PYTEST_XDIST_AUTO_NUM_WORKERSset to 16.
Requirement: Gate check scope
The gate SHALL run the full devops ci --check on the squash-merge tree.
Scenario: Gate runs the full check
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes and the gate main container command runs
devops ci --checkwith no--skipand no--only.
Requirement: Gate uses the uv cache
The gate MUST get its offline Python environment from the uv cache in the runner image (#4814).
Scenario: Gate copies the uv cache
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes and the gate main container copies the runner image uv cache into the pod cache and runs
uv sync --locked --offline.
Requirement: Gate semaphore is two
The change SHALL add ConfigMap ci-gate-limits with semaphore gate: 2.
Scenario: Gate semaphore is two
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes and
ci-gate-limitshasdata.gateset to2.
Requirement: Gate pods leave the default perimeter
The change SHALL exclude the gate pods from the pod selector of NetworkPolicy devops-default-perimeter.
Scenario: Gate pods are outside the default perimeter
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes and the
podSelectorofdevops-default-perimeterhas aNotInmatch for the gate pod label.
Requirement: Gate egress policy
The gate NetworkPolicy SHALL allow DNS, public TCP 443 outside the private ranges, and the API server on TCP 6443.
Scenario: Gate egress allows DNS, public 443 and the API server
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes and the NetworkPolicy egress allows DNS to
kube-system, TCP 443 to0.0.0.0/0with10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,127.0.0.0/8and169.254.0.0/16inexcept, and TCP 6443 to the API server, and no other egress.
Requirement: Gate egress denies private services
The gate NetworkPolicy SHALL deny a gate pod access to the gateway on TCP 4000 and to Valkey on TCP 6379.
Scenario: Gate pod cannot reach private services
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes and the gate NetworkPolicy allows no egress to TCP 4000 or TCP 6379 in the private ranges.
Requirement: Gate deadline and TTL
The gate Workflow SHALL set a run deadline of 1,200 s inside a Workflow deadline of 2,400 s and a TTL of 1 day.
Scenario: Gate deadlines and TTL are set
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes with a run deadline of 1,200 s, a Workflow deadline of 2,400 s and a
ttlStrategythat removes the Workflow after 86,400 s.
Requirement: Timeout chain check
The change SHALL add a structural check that holds test < row < run deadline < Workflow deadline, with the client queue limit of 900 s and the run deadline inside the Workflow deadline.
Scenario: Broken timeout chain fails
- WHEN
uv run devops ci --check --only k8sruns with a fixture that sets the Workflow deadline below the run deadline. - THEN The check fails with a message that names the broken timeout chain.
Requirement: Gate bundle input is replaceable
The gate WorkflowTemplate MUST take the bundle input as a Workflow parameter or artifact.
Scenario: Gate bundle input is a parameter
- WHEN
uv run devops ci --check --only k8sruns. - THEN The check passes and the WorkflowTemplate takes the bundle input from a Workflow parameter or artifact.
Requirement: Gate ADR
The change SHALL add an ADR that records the gate as a pre-push tool, not a roadmap unit, and amends ADR 0043.
Scenario: ADR records the gate decision
- WHEN
uv run devops ci --check --only docsruns. - THEN The check passes and the ADR has
status: accepted, names the gate as a pre-push tool, and records that it amends ADR 0043.
Requirement: Pending a person after the merge
After the merge, a person SHALL confirm that the Argo CD Application devops is Synced.
Scenario: Argo CD syncs the gate manifests
- WHEN
kubectl get application devops -A -o jsonpath='{.items[0].status.sync.status}'runs after the merge. - THEN The command prints
Synced.
Existing Tool Considered
Use Argo Workflows (argoproj/argo-workflows); the alternatives check in the issue body gives verdict in-use, and the repository already uses the tool. The check records what the tool covers and lacks. The proposal adds the Kubernetes NetworkPolicy egress, the uv-cache offline environment from #4814, and the structural timeout-chain check in the k8s row. The Argo CD orphan glob is follow-up dan-petty/homelab#273. The ADR records the gate decision and amends ADR 0043.
Key questions
- Which lane runs the iteration gate?: Use the Argo cluster gate for the iteration lane, with no Gitea for now. The issue records owner decision OD1 a. (best practice) [sources: docs/adr/0008-argo-workflows-run-the-roadmap-jobs-after-a-measured-go.md]
- Chosen: Argo cluster gate. Argo Workflows is installed and ADR 0008 records it as the engine; the issue records OD1 a.
- Rejected: Gitea Actions with the Gitea runner. The owner decision OD1 a keeps Gitea off for now, and the runner changed often.
- Which node, concurrency and CPU does the gate use?: Use the large node
<build-node>, semaphore 2 and 16 CPUs. The issue records owner decision OD2. (best practice) [sources: k8s/devops/cronjob-runner.yaml, docs/CLUSTER.md]- Chosen: Large node, semaphore 2, 16 CPUs. The issue records OD2, and the runner template ties the worker count to the CPU limit.
- Rejected: Default runner size of 2 CPUs. 2 CPUs cannot meet the 12 min p90 target.
- How does the gate get an offline Python environment?: Copy the uv cache from the runner image (perf(k8s): seed the uv cache of a runner pod from the image #4814) into the pod cache, then run
uv sync --locked --offline. (best practice) [sources: openspec/changes/archive/2026-11-11-4550-put-the-dependencies-in-their-own/design.md, openspec/changes/archive/2026-11-11-4550-put-the-dependencies-in-their-own/proposal.md, k8s/devops/cronjob-runner.yaml]- Chosen: uv cache from the runner image. The archived perf(k8s): put the dependencies in their own image layers #4550 design records a 9 s copy and a 2 s offline sync.
- Rejected: Wheel directory from perf(k8s): put the dependencies in their own image layers #4550. The archived perf(k8s): put the dependencies in their own image layers #4550 proposal records that
uv sync --locked --offlinedoes not readUV_FIND_LINKS, and--no-index --find-linksfails onpywin32.
- What timeout chain does the gate use?: Use a test bound of 600 s, a row bound of 900 s, a client queue limit of 900 s, a run deadline of 1,200 s, a Workflow deadline of 2,400 s and a TTL of 1 day. (best practice) [sources: pyproject.toml, docs/TESTING.md, src/devops_cli/argo/crd.py, src/devops_cli/config/defaults.py, src/devops_cli/config/constants.py, docs/guidelines/kubernetes.md]
- Chosen: 600 s test, 900 s row, 900 s client queue, 1,200 s run, 2,400 s Workflow, 1-day TTL. The chain holds 600 < 900 < 1,200 < 2,400, and the client queue limit stays below the run deadline.
- Rejected: One 2,400 s deadline only. It cannot fail the run before the Workflow ends and leaves no bound inside the Workflow.
- What egress does the gate NetworkPolicy allow?: Allow DNS, public TCP 443 outside the private ranges, and the API server on TCP 6443. Add no other egress. (best practice) [sources: k8s/devops/networkpolicy.yaml, tests/gate/k8s_checks/network_policies.py]
- Chosen: DNS, public 443 with private ranges excepted, and API server 6443. The gate needs DNS, OSV and the API server, and it must not reach private services.
- Rejected: Allow all egress. It is broader than the gate needs and lets a gate pod reach the private network.
- Which rows of
devops ci --checkcan the gate run?: Run the fulldevops ci --check. Thek8srow runs offline checks of the manifests and needs no service account token. (best practice) [sources: docs/TESTING.md, src/devops_cli/commands/ci.py, tests/gate/k8s_checks/network_policies.py]- Chosen: Run the full
devops ci --check. The issue requires the full check, and thek8srow is offline static checks. - Rejected: Skip the
k8srow. Thek8srow runs offline checks of the manifests, so the gate can run it without a token. - Rejected: Add a service account token to run
k8s. The issue requires no service account token in the gate pod.
- Chosen: Run the full
- How does the gate keep its bundle input replaceable by Gitea?: Use a Workflow parameter or artifact for the bundle input. Do not hard-code a Gitea branch. (best practice) [sources: src/devops_cli/argo/crd.py]
- Chosen: Workflow parameter or artifact. Argo Workflows passes
spec.arguments.parametersto the template, so the input changes without a template rewrite. - Rejected: Hard-coded Gitea branch. It couples the gate to Gitea now.
- Chosen: Workflow parameter or artifact. Argo Workflows passes
- Which ADR does the gate decision amend?: Add an ADR under
docs/adr/that records the gate as a pre-push tool, not a roadmap unit, and amends ADR 0043. ADR 0014 is superseded by ADR 0043, so it is not the current decision record. (best practice) [sources: docs/adr/0014-required-checks-gate-the-merge-and-the-pre-push-hook-runs-the-fast-static-checks.md]- Chosen: New ADR that amends 0043. ADR 0014 has
status: supersededandsuperseded-by0043, so 0043 is the decision in force. - Rejected: New ADR that amends 0014. ADR 0014 is superseded by ADR 0043.
- Rejected: No ADR. It leaves the gate status and the amendment unrecorded.
- Chosen: New ADR that amends 0043. ADR 0014 has
- Does this repository hold the Argo CD orphan glob for gate Workflows?: No. The Argo CD project is in dan-petty/homelab, and the orphan glob is follow-up
dan-petty/homelab#273. [sources: docs/CLUSTER.md, docs/adr/0008-argo-workflows-run-the-roadmap-jobs-after-a-measured-go.md]
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(k8s)scope of the title gives the scope.The owner made a decision and the problem wastes over half of CI runs, but it is a planned feature with a dependency on #4550.It stops 630 of 1,211 wasted CI runs and cuts median queue time from 4.6 minutes.The body lists a spike, template, ConfigMap, NetworkPolicy, Argo CD glob, timeout test, and ADR, estimated at about 5 hours.Both use Argo Workflows in k8s/argo-workflows/, but #4566 fixes roadmap pod scheduling while the candidate adds a new CI gate template.dan-petty commentedon Nov 11, 2026
The "fresh offline venv from the image wheels of #4550" cannot come from a wheel directory:
uv sync --locked --offlinedoes not readUV_FIND_LINKSfor a locked package (evidence in #4550). #4814 now holds that need: a uv cache in the runner image that the pod copies into its writable cache (measured: copy 9 s, offline sync 2 s).devops-cli-service commentedon Nov 14, 2026
Alternatives check: in-use
Reason: The searches turned up no other open tool for running a full pre-push CI gate in the cluster, and the issue itself already names Argo Workflows (installed) as the tool that covers the need. The repository facts confirm it is open, Apache-2.0 and maintained, and its WorkflowTemplate, semaphore synchronization, activeDeadlineSeconds and ttlStrategy are exactly the primitives the gate design asks for; only project-specific glue (runner image, wheel/uv cache from #4814, NetworkPolicy, Argo CD glob, timeout-chain test) is left to build.
The repository already uses this tool.
Tool: argoproj/argo-workflows (https://github.com/argoproj/argo-workflows)
Covers:
Lacks:
devops ci --checkon the squash-merge treeTools considered:
Searches run:
Sources:
Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 15, 2026
Refine cannot set this item to Ready at 46c62f3 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.
fix(roadmap): Hold back only the clause of a reverse phrase (#6451)
devops-cli-service commentedon Nov 21, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
devops-cli-service commentedon Dec 1, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.