Skip to content

fix(k8s): run infra-drift on Argo v4 with API server egress - #7410

Merged
dan-petty merged 5 commits into
mainfrom
fix/7364-infra-drift-schedules-and-executor
Nov 27, 2026
Merged

dan-petty merged 5 commits into
mainfrom
fix/7364-infra-drift-schedules-and-executor

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The Argo Workflows controller v4.1.7 now manages namespace devops. It refuses CronWorkflow infra-drift, which sets the singular field schedule, so the daily drift check does not run. The WorkflowTemplate sets the singular mutex, which the controller does not read. The executor has no account with a token, and no policy lets a Workflow pod reach the API server, so each Workflow ends in Error.

The CronWorkflow now uses schedules. The WorkflowTemplate uses mutexes and executor.serviceAccountName: argo-executor. The pod keeps the account devops-cli, which mounts no token. The new policy argo-workflow-egress selects each pod with the label workflows.argoproj.io/workflow and lets it reach the API server on TCP 6443 only, as roadmap-service-egress does. The k8s row pins these two policies and refuses any other policy with TCP 6443.

Closes #7364

Change: openspec/changes/archive/2026-11-27-7364-infra-drift-schedules-and-executor/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/k8s Kubernetes commands, Helm charts, pods, services, and policies labels Nov 27, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Evidence of the change (head b74c2f3d2)

Premise (read-only commands on the live cluster, 2026-11-27)

  • kubectl -n argo-workflows get deploy: workflow-controller:v4.1.7 with --namespaced --managed-namespace devops.
  • The controller log: level=ERROR msg="invalid cron workflow" component=cron cronWorkflow=devops/infra-drift error="cron workflow must have at least one schedule" (13:20:20 UTC and every 20 minutes). No infra-drift Workflow exists.
  • kubectl auth can-i --as=system:serviceaccount:devops:argo-executor -n devops create workflowtaskresults.argoproj.io: yes. The same for patch: yes. For get secrets: no.
  • The endpoint of Service kubernetes listens on port 6443.

Checks on the branch

Command Result
uv run devops ci --check --only k8s,kube-linter,lint,format,typecheck,docs,openspec,test-tree 9 rows pass; k8s: 186 cases, 0 failed
uv run devops ci fail-to-pass --base origin/main failed on base, passed on head: k8s runner.check_only_the_service_pod_and_the_workflow_pods_may_reach_the_api_server (1 of 186 cases failed on base, 0 of 186 on head)
uv run devops k8s validate k8s/devops/networkpolicy.yaml all manifests are valid schemas
uv run devops openspec archive 7364-infra-drift-schedules-and-executor every spec and change validates

kubectl kustomize k8s/devops renders:

  • CronWorkflow infra-drift: schedules: ['0 6 * * *'], no schedule, concurrencyPolicy: Forbid.
  • WorkflowTemplate infra-drift: synchronization: {"mutexes": [{"name": "infra-drift"}]}, executor: {"serviceAccountName": "argo-executor"}, serviceAccountName: devops-cli.
  • NetworkPolicy argo-workflow-egress: podSelector: {"matchExpressions": [{"key": "workflows.argoproj.io/workflow", "operator": "Exists"}]}, policyTypes: ["Egress"], one rule: TCP 6443 to 0.0.0.0/0 except 169.254.169.254/32.
  • The policies with egress on TCP 6443: argo-workflow-egress and roadmap-service-egress, and no other.

A changed security check

The k8s row held check_only_the_service_pod_may_reach_the_api_server, which allowed exactly one policy with TCP 6443. The new policy makes that check fail, so the change replaces it with check_only_the_service_pod_and_the_workflow_pods_may_reach_the_api_server. It pins the selector, the type and the rules of both policies, and it still fails on any other policy with TCP 6443 and on TCP 6443 in the perimeter. The label check of the Job pod templates now also fails on the label workflows.argoproj.io/workflow. The rule for the Workflow pods is the owner-approved part of #5289 (split of #4566, 2026-11-21).

Pending a person after the merge

Argo CD syncs Application devops. Then submit one Workflow from cronwf/infra-drift in namespace devops, or wait for the run of 06:00 UTC, and run:

kubectl -n devops get workflow -l workflows.argoproj.io/cron-workflow=infra-drift -o jsonpath='{.items[*].status.phase}'

The command must print Succeeded. The controller log must show no invalid cron workflow line for devops/infra-drift.

@dan-petty

Copy link
Copy Markdown
Owner Author

Check results

Head commit: b74c2f3d29465ee70b4619185a7ea04bd22ee486

Check Conclusion Link
Tests & Coverage success run
devops-cli success run
zizmor success run
trivy-config success run
Plan Check skipped run
CodeQL success run
Changed-Test Independence success run
Test Job Duration skipped run
Tests on Main skipped run
Dependency Freshness skipped run
Image Pins success run
Tests & Coverage (shard 5 of 5) success run
Tests & Coverage (shard 1 of 5) success run
Changed-Test Independence (run 2 of 3) success run
Changed-Test Independence (run 1 of 3) success run
Runner Image success run
Static Analysis success run
Tests & Coverage (shard 4 of 5) success run
Tests & Coverage (shard 2 of 5) success run
Design Tokens success run
Tests & Coverage (shard 3 of 5) success run
Changed-Test Independence (run 3 of 3) success run
Service Image success run
Fail-to-Pass Check success run
Semantic PR title success run
Docs Site Build success run
Analyze (actions) success run
Analyze (python) success run

Fail-to-pass run: https://github.com/dan-petty/devops-cli/actions/runs/46009141017/job/140539849168

Skipped check: Plan Check
Skipped check: Test Job Duration
Skipped check: Tests on Main
Skipped check: Dependency Freshness

@dan-petty
dan-petty marked this pull request as ready for review November 27, 2026 13:49
@dan-petty
dan-petty merged commit 6546f84 into main Nov 27, 2026
28 checks passed
@dan-petty
dan-petty deleted the fix/7364-infra-drift-schedules-and-executor branch November 27, 2026 13:51
dan-petty-release Bot added a commit that referenced this pull request Nov 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.225.0](v0.224.3...v0.225.0)
(2026-11-27)


### Features

* **k8s:** move a claim to another storage class with volume move
([#7409](#7409))
([19bb409](19bb409))


### Bug Fixes

* **k8s:** run infra-drift on Argo v4 with API server egress
([#7410](#7410))
([6546f84](6546f84))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(k8s): Fix infra-drift CronWorkflow schedules and executor

1 participant