Skip to content

feat(k8s): run the project review for each complete week #4736

Open

Description

@dan-petty

Update 2026-11-26 (infra move): The monitoring and logging network policies are in dan-petty/homelab now.

This item keeps the WorkflowTemplate, the CronWorkflow, their egress policy and the due command. The ingress rules that admit the review pods are the homelab follow-up. Merge that one first.

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


Problem or Motivation

The owner asked that a job can run the project review. The owner decided on 2026-11-11 that the job reviews each complete ISO week, with narrative, and that version reviews run on demand. Argo cannot run pods in namespace devops today: rag-ingest never ran, it uses the singular schedule field that Argo v4 removed, and the controller runs with --namespaced (#4566).

Proposed Solution & Architectural Design

  • WorkflowTemplate project-review:
    • the Service image with the review extra;
    • the devops-cli Secret and the store write credential;
    • the Job labels of feat(roadmap): label Service Jobs by repository and item #4558;
    • a mutex;
    • activeDeadlineSeconds: 1800, longer than each inner timeout;
    • a network policy that allows egress only to GitHub, Prometheus, Loki, the gateway and the content store.
  • CronWorkflow with schedules: ['7 * * * *'] and concurrencyPolicy: Forbid. It runs devops roadmap review due --run: each complete ISO week of the last 30 days with no index entry, oldest first, at most 6 for each run.
  • For a version review, a person, an agent or the Service submits the template with -p window=....
  • Add the row to the ADR 0021 unit table.

Target Subsystem

Kubernetes manifests (k8s/devops/, Argo Workflows), with the due subcommand in src/devops_cli/roadmap/project_review/.

Existing Tool Considered

Argo Workflows (installed) runs the template and the schedule. The custom code is the due subcommand, which reads the store index. Cost (estimate): manifests and about 80-150 lines with tests, one issue-size item, about 0.33-0.50 USD on the DeepSeek implement path and 1-2 days elapsed. Run: about 3-6 min for a weekly review, 0.5-1 GiB memory peak and 1 CPU.

Acceptance Criteria

  • The CronWorkflow status shows a last-scheduled time within 1 h after the sync.
  • A deleted week index entry is made again at the next run.
  • A submitted version window publishes within 5 min.
  • No run is longer than 1,800 s.

Dependencies

Source: #4679

Alternatives check of 2026-11-29: in-use.
The repository already uses this tool.
Tool: Argo Workflows (https://github.com/argoproj/argo-workflows), Apache-2.0, last activity 2026-11-29, maintained.
Reason: Searches found Argo Workflows, which the issue already names: its CronWorkflow, template mutex, deadline and parameter submit cover the hourly schedule and both triggers, leaving only the custom due selector as code.

Covers:

  • Hourly CronWorkflow with the list field schedules and Forbid policy
  • WorkflowTemplate with mutex, activeDeadlineSeconds and parameters
  • On-demand submit of a window parameter through the argo CLI
  • Pod labels, secrets and retry of a failed run

Lacks:

  • Selects no complete ISO weeks; needs the custom due subcommand
  • Writes no review narrative and reads no store index entry
  • Ships no NetworkPolicy or Secret manifests for this cluster

Proposed design

Problem statement

No job runs the project review today. Argo cannot start pods in namespace devops until #4566. No schedule selects complete ISO weeks that have no review. This change adds the project-review WorkflowTemplate, an hourly CronWorkflow that runs devops roadmap review due --run, an on-demand version submit through a window parameter, the network policies, and the ADR 0021 unit row.

Acceptance criteria

Requirement: Project review WorkflowTemplate

The project-review WorkflowTemplate SHALL run the Service image ghcr.io/dan-petty/devops-cli/service, reference Secret devops-cli and Secret object-store-devops in namespace devops, and set the pod labels app.kubernetes.io/name: devops-cli-job, app.kubernetes.io/component: project-review, roadmap.devops-cli/owner and roadmap.devops-cli/repo.

Scenario: Rendered template image, secrets and labels

  • WHEN The operator runs kubectl -n devops get workflowtemplate project-review -o jsonpath='{.spec.templates[0].container.image}{" "}{..secretRef.name}{" "}{.spec.templates[0].metadata.labels}' after the sync.
  • THEN The command prints ghcr.io/dan-petty/devops-cli/service, devops-cli, object-store-devops and the four labels.

Requirement: Template deadline and mutex

The project-review WorkflowTemplate SHALL set activeDeadlineSeconds: 1800 and hold the mutex project-review.

Scenario: Rendered deadline and mutex

  • WHEN The operator runs kubectl -n devops get workflowtemplate project-review -o jsonpath='{.spec.activeDeadlineSeconds}{" "}{.spec.templates[0].synchronization.mutex.name}'.
  • THEN The command prints 1800 project-review.

Requirement: Due check CronWorkflow

The project-review CronWorkflow SHALL use the list field schedules: ['7 * * * *'] and concurrencyPolicy: Forbid.

Scenario: Rendered schedule

  • WHEN The operator runs kubectl -n devops get cronworkflow project-review -o jsonpath='{.spec.schedules}{" "}{.spec.concurrencyPolicy}{" "}{.spec.schedule}'.
  • THEN The command prints ["7 * * * *"] Forbid and an empty third field.

Requirement: Scheduled run

The project-review CronWorkflow MUST show a last-scheduled time within 1 h after Argo syncs it.

Scenario: First scheduled run

  • WHEN The operator waits up to 1 h after the sync and runs kubectl -n devops get cronworkflow project-review -o jsonpath='{.status.lastScheduledTime}'.
  • THEN The command prints a time less than 1 h before the current time.

Requirement: Due week selection

The devops roadmap review due --run command SHALL select each complete ISO week with no index entry, from the older of 30 days ago and the oldest index entry, oldest first, at most 6 for each run.

Scenario: Seven due weeks

  • WHEN A test gives the index an entry 8 weeks ago and no entry for the 7 complete weeks after it, and runs the selector with a fixed now.
  • THEN The selector returns the 6 oldest complete weeks in order and leaves the seventh week for a later run.

Requirement: Deleted week entry

The devops roadmap review due --run command SHALL select a complete ISO week again when its index entry is deleted.

Scenario: Deleted index entry

  • WHEN A test deletes the index entry of a complete week that is older than 30 days but after the oldest index entry, and runs the selector.
  • THEN The selector returns that week.

Requirement: On-demand version review

The project-review WorkflowTemplate SHALL declare a window parameter with an empty default, SHALL pass a non-empty value to devops roadmap review run --version, and SHALL run devops roadmap review due --run for the empty default.

Scenario: Version window submit

  • WHEN The operator runs argo submit -n devops --from workflowtemplate/project-review -p window=v1.0.0..v1.1.1 --dry-run -o yaml, and again with no window parameter.
  • THEN The first output runs review run --version v1.0.0..v1.1.1, and the second output runs review due --run.

Requirement: Review egress

The project-review NetworkPolicy SHALL add egress only to Prometheus on TCP 9090 in namespace monitoring and Loki on TCP 3100 in namespace logging.

Scenario: Egress allowlist

  • WHEN The operator runs kubectl -n devops get networkpolicy project-review -o jsonpath='{.spec.egress}'.
  • THEN The output holds two rules, one for namespace monitoring port 9090 and one for namespace logging port 3100, and no other rule.

Requirement: Review pods admitted

The monitoring and logging NetworkPolicies SHALL admit the project-review pods on TCP 9090 and TCP 3100.

Scenario: Policies pass the Kubernetes checks

  • WHEN The change edits k8s/monitoring/networkpolicy.yaml and k8s/logging/networkpolicy.yaml, and the operator runs uv run devops ci --check --only k8s.
  • THEN The check exits 0 and reports no finding on the two policy files.

Requirement: ADR 0021 unit row

The ADR 0021 unit table SHALL list one row for the project review, with one complete ISO week of one repository as its unit and the hourly schedule and the on-demand version submit as its triggers.

Scenario: ADR table row

  • WHEN The change adds the row to docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, and the operator runs uv run devops ci --check --only docs.
  • THEN The docs check exits 0 and reports no finding on the ADR file.

Requirement: Pending a person after the merge

A person SHALL run uv run devops k8s push-secrets for the store write credential before the first scheduled run.

Scenario: Store write credential pushed

  • WHEN After the merge, a person runs uv run devops k8s push-secrets --only devops/object-store-devops and then uv run devops k8s push-secrets --only devops/object-store-devops --plan.
  • THEN The push exits 0 and the plan shows unchanged for every key.

Existing Tool Considered

Argo Workflows (argoproj/argo-workflows), verdict in-use: the alternatives check of 2026-11-23 in the issue body records the tool and what it covers and lacks. The change adds the missing due subcommand and the routing of an empty window to the weekly run: about 80-150 lines with tests, one issue-size item, about 0.33-0.50 USD on the DeepSeek implement path, and 1-2 days elapsed. A weekly run takes about 3-6 min, with a 0.5-1 GiB memory peak and 1 CPU.

Key questions

  • What is a complete ISO week, and which command resolves its window?: A complete ISO week runs from Monday 00:00 UTC to the next Monday 00:00 UTC. It is complete when its end is at or before now. Its id is YYYY-Www. devops roadmap review run --week YYYY-Www resolves that window through parse_window in src/devops_cli/roadmap/project_review/window.py. [sources: src/devops_cli/roadmap/project_review/window.py, docs/CLI_REFERENCE.md]
  • Which record tells the due command that a week already has a review?: The index entry that feat(roadmap): publish the project review and link it on GitHub #4733 writes for the published review of the week. The due command reads that entry and no other record. (best practice) [sources: src/devops_cli/roadmap/project_review/review.py, docs/adr/0023-the-project-brain-is-a-derived-index-in-two-cache-tiers-and-two-scheduled-runs-keep-it.md]
  • Which complete weeks are due, and how do the 30-day lookback and the 6-week cap fit together?: A week is due when it is complete and the index has no entry for it. The scan starts at the older of 30 days ago and the oldest index entry, so a deleted entry or a week after an outage is selected again. Each run takes the 6 oldest due weeks, oldest first, and leaves the rest for the next run. (best practice) [sources: src/devops_cli/roadmap/project_review/window.py, docs/CLI_REFERENCE.md]
    • Chosen: Index-bounded scan, oldest first, at most 6. The index says which weeks are done, the scan reaches a deleted entry or a week after an outage, and the cap of 6 bounds one run.
    • Rejected: Fixed 30-day lookback. 30 days hold at most 4 complete weeks, so the cap of 6 is unreachable and an older week is never remade.
    • Rejected: No cap. A first run or a long backlog can exceed the 1,800 s deadline.
    • Rejected: Newest first. The oldest missing weeks wait forever while new weeks arrive.
  • Which cadence does the CronWorkflow use for the weekly review?: The CronWorkflow checks every hour at minute 7 (7 * * * *), and due selects only complete weeks. A week is reviewed within 1 h of its end, no partial week is reviewed, and a missed run catches up from the index. The owner decided on 2026-11-11 that each complete ISO week gets a review and that version reviews run on demand. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: Hourly due check. The check is frequent enough to review a week within 1 h of its end, and due keeps partial weeks out.
    • Rejected: Weekly CronWorkflow on Monday. A missed run waits a week, and the schedule must know the time zone and the week boundary.
    • Rejected: Daily schedule. It checks 7 times for each week and adds runs with nothing due.
    • Rejected: On-demand only. It leaves complete weeks without a review.
  • Which Argo CronWorkflow field schedules the hourly due check?: Use the list field schedules: ['7 * * * *']. Do not use the singular schedule field, which Argo v4.0 removed; k8s/devops/cronworkflow-rag-ingest.yaml still uses it and therefore never schedules. [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, k8s/devops/cronworkflow-rag-ingest.yaml]
  • How does the CronWorkflow prevent overlapping runs?: Set concurrencyPolicy: Forbid on the CronWorkflow and give the WorkflowTemplate the project-review mutex. The policy stops a second scheduled run, and the mutex also stops an on-demand submit while a run holds it. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, k8s/devops/roadmap-service/cronjob-planner-run.yaml]
    • Chosen: Forbid and the template mutex. The policy stops a second scheduled run, and the mutex also covers an on-demand submit.
    • Rejected: concurrencyPolicy: Forbid alone. It governs only the Jobs of the schedule, so an on-demand submit can run at the same time.
    • Rejected: Allow. Two runs can write the same week entry.
    • Rejected: Replace. It cancels a running review and loses the week.
  • What deadline and network egress does the run use?: Set activeDeadlineSeconds: 1800, longer than each inner timeout, because ADR 0021 requires each inner limit to stop before the limit around it. The devops-default-perimeter already allows DNS, the LLM gateway, Valkey, Qdrant, the OTel collector, public HTTPS to GitHub and the content store. The project-review policy adds only Prometheus (monitoring:9090) and Loki (logging:3100). The monitoring and logging perimeters admit neither port to a devops pod today, so both policies get a rule for the review pods. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md, k8s/monitoring/networkpolicy.yaml, k8s/logging/networkpolicy.yaml]
    • Chosen: 1,800 s and least-privilege egress. The deadline bounds a stuck run without breaking the inner time limits, and the policy adds only the two services that the review reads beyond the perimeter.
    • Rejected: No deadline and default egress. A stuck run holds the mutex, and the pod reaches services that the review does not need.
    • Rejected: Raise the deadline to cover 6 weeks. It breaks the 1,800 s bound; due leaves the remaining weeks for the next run.
    • Rejected: One broad egress rule. It admits every port of the cluster and loses the least-privilege property of the perimeter.
  • How does a person, an agent or the Service submit a version review?: Submit the same project-review WorkflowTemplate with -p window=A..B. A non-empty value runs devops roadmap review run --version A..B through the existing parser, and the empty default runs devops roadmap review due --run. The template keeps the same image, Secret, labels, mutex and deadline. (best practice) [sources: src/devops_cli/roadmap/project_review/window.py, docs/CLI_REFERENCE.md]
    • Chosen: Same template with a window parameter. It reuses the image, Secret, labels, mutex and deadline, and the empty default keeps the weekly due run.
    • Rejected: Separate version WorkflowTemplate. It duplicates the pod configuration and can drift from the weekly run.
    • Rejected: Second CronWorkflow for versions. Version reviews run on demand, not on a schedule.
    • Rejected: Run the review outside the template. It bypasses the deadline, the mutex, the Secret and the labels.
  • Which image and pod labels does the WorkflowTemplate use?: The Service image ghcr.io/dan-petty/devops-cli/service, with the review extra. The pod carries app.kubernetes.io/name: devops-cli-job so the stack network policies select it, app.kubernetes.io/component: project-review so the monitoring and logging ingress rules name only these pods, and the roadmap.devops-cli/owner and roadmap.devops-cli/repo labels of feat(roadmap): label Service Jobs by repository and item #4558. (best practice) [sources: pyproject.toml, docs/CLUSTER.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: Service image ghcr.io/dan-petty/devops-cli/service. The body names it with the review extra, and it holds the roadmap commands that the job runs.
    • Rejected: A separate review image. It duplicates the roadmap commands and the Service configuration, and it drifts from the Service release.
  • Which Secret holds the store write credential, and does the change create it?: Secret object-store-devops in namespace devops holds the store write credential. The change references that Secret and creates no new Secret. A person runs uv run devops k8s push-secrets after the merge if the plan shows a change. [sources: docs/CLUSTER.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4733, #4726, #4566

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/k8s
    status/new
    value/medium
    effort/medium
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P2-Medium. It is a planned feature with three open dependencies and no user-facing breakage if deferred.
    • Value: Medium. It removes the manual step of triggering each weekly review and guarantees a review exists for every complete ISO week.
    • Effort: Medium. The body estimates 80 to 150 lines of code with tests plus manifests, about 1 to 2 days elapsed.
    • Related: feat(k8s): let Argo Workflows run roadmap pods in devops #4566, which asks for a different change. Both target Argo Workflows in the devops namespace, but dan-petty/devops-cli#4566 enables the controller and namespace access while this item adds a specific CronWorkflow and due subcommand for weekly reviews.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches and the repository facts point to Argo Workflows, which the issue already names as installed: it supplies the WorkflowTemplate/CronWorkflow machinery (multiple schedules, concurrencyPolicy: Forbid, activeDeadlineSeconds, synchronization/mutex, on-demand submit with parameters) that the manifests need. It does not supply the per-ISO-week due selection that reads the store index, nor the narrative and publishing steps, which stay custom code, so it covers only part of the issue.

    The repository already uses this tool.

    Tool: argoproj/argo-workflows (https://github.com/argoproj/argo-workflows)

    • License: Apache-2.0
    • Last activity: 2026-11-14
    • Maintained: yes

    Covers:

    • Runs the review as a pod from a WorkflowTemplate, with the Service image, secrets, labels and a synchronization mutex
    • Supports activeDeadlineSeconds on the template so no run exceeds 1,800 s
    • A CronWorkflow takes a list of schedules in Argo v4 and concurrencyPolicy: Forbid for one run at a time
    • An on-demand version review is submitted from the same template with a parameter (-p window=...) by a person, an agent or the Service
    • The controller and CLI are installed and maintained (v4.x releases, active repository)

    Lacks:

    Tools considered:

    Searches run:

    • Argo Workflows CronWorkflow multiple schedules concurrencyPolicy Forbid, results: 5
    • Kubernetes CronJob schedule recurring job concurrencyPolicy Forbid activeDeadlineSeconds, results: 5
    • argo-workflows.readthedocs.io cron workflows concurrencyPolicy Forbid, results: 5
    • "CronWorkflow" argo workflows "concurrencyPolicy" documentation, results: 5
    • Argo Workflows CronWorkflow "schedules" field documentation v4, results: 5
    • Kubernetes CronJob concurrency policy Forbid documentation kubernetes.io, results: 5
    • argoproj argo-workflows cron workflows docs github, results: 5
    • site:github.com argoproj argo-workflows docs cron-workflows, results: 5

    Sources:

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

  6. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Owner question: Who creates the store write credential Secret before the CronWorkflow runs? (a person decides)

    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

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: k8s/argo-workflows/values.yaml, k8s/devops/cronworkflow-rag-ingest.yaml.

  7. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions 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

  8. dan-petty commented on Nov 21, 2026

    @dan-petty
    OwnerAuthor

    Answer to the owner question "Who sets the review base URL and the content store write credential?":

    1. The base URL: I set the repository variable PROJECT_REVIEW_URL before the merge of ci(release): link the project review from each release #4741. This replaces "before the first release after the merge" in ci(release): link the project review from each release #4741, because about 19 releases run each day. I use the Settings page or uv run devops gh api -X POST repos/dan-petty/devops-cli/actions/variables -f name=PROJECT_REVIEW_URL -f value=<base URL>. The value stays out of git. The release step of ci(release): link the project review from each release #4741 fails closed while the variable is empty. The URL works only after the files host of dan-petty/homelab#341 exists.
    2. The write credential: the review job uses no new credential. It runs in namespace devops and uses Secret devops/object-store-devops of identity devops from feat(k8s): apply store buckets, keys and rules from git #4756. That identity writes reports and reports-private, which the review needs, and also cache. I push that Secret before the merge of feat(k8s): apply store buckets, keys and rules from git #4756.
    3. Before the merge of feat(k8s): run the project review for each complete week #4736, an agent runs uv run devops k8s push-secrets --only devops/object-store-devops --plan. Merge only when every key shows unchanged. No new push is necessary.

    The same answer applies to the question of #4736.

  9. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions 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

  10. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    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.

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/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions