Skip to content

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

Done

Description

@devops-cli-service

Split from #5289.

k8s/devops/cronworkflow-infra-drift.yaml sets the singular schedule field. Controller v4.1.7 gives that CronWorkflow the condition SpecError and does not run it. k8s/devops/workflowtemplate-infra-drift.yaml sets the singular mutex field, which the controller does not read. Its executor has no service account. Its Workflow pods have no API server egress on TCP 6443. Issue #5289 changes the rag-ingest manifests only, so this part gets its own item. This item must merge before dan-petty/homelab#418 merges, else Application devops holds two CronWorkflows in SpecError until the change is live. Acceptance criteria: (1) The CronWorkflow sets schedules and sets no schedule; uv run devops ci --check --only k8s exits zero. (2) The WorkflowTemplate sets synchronization.mutexes and spec.executor.serviceAccountName: argo-executor; uv run devops ci --check --only k8s exits zero. (3) The Workflow pods get one egress rule on TCP 6443 to the API server; uv run devops ci --check --only k8s exits zero. (4) A person runs kubectl -n devops get workflow -l workflows.argoproj.io/cron-workflow=infra-drift -o jsonpath='{.items[*].status.phase}' after the merge; the command prints Succeeded.

Proposed design

Problem statement

The infra-drift Argo manifests use fields that controller v4.1.7 does not read, so the CronWorkflow stays in SpecError and the WorkflowTemplate executor lacks its service account and API server egress. The change aligns the manifests with the controller schema and the network policy. It must merge before dan-petty/homelab#418 merges.

Acceptance criteria

Requirement: CronWorkflow uses schedules

The infra-drift CronWorkflow SHALL set spec.schedules and SHALL NOT set spec.schedule.

Scenario: The k8s validator accepts the CronWorkflow

  • WHEN uv run devops ci --check --only k8s runs on the changed k8s/devops/cronworkflow-infra-drift.yaml
  • THEN the command exits zero and reports no error for the CronWorkflow

Requirement: WorkflowTemplate uses mutexes and executor account

The infra-drift WorkflowTemplate SHALL set spec.synchronization.mutexes and spec.executor.serviceAccountName: argo-executor, and SHALL NOT set spec.synchronization.mutex.

Scenario: The k8s validator accepts the WorkflowTemplate

  • WHEN uv run devops ci --check --only k8s runs on the changed k8s/devops/workflowtemplate-infra-drift.yaml
  • THEN the command exits zero and reports no error for the WorkflowTemplate

Requirement: Workflow pods reach the API server on TCP 6443

The infra-drift Workflow pods SHALL have one egress rule that permits TCP 6443 to the Kubernetes API server.

Scenario: The k8s validator accepts the NetworkPolicy

  • WHEN uv run devops ci --check --only k8s runs on the changed NetworkPolicy for the infra-drift pod labels
  • THEN the command exits zero

Requirement: Pending a person after the merge

After the merge, the infra-drift CronWorkflow SHALL produce a Workflow that reaches the phase Succeeded.

Scenario: A person checks the latest Workflow phase

  • WHEN a person runs kubectl -n devops get workflow -l workflows.argoproj.io/cron-workflow=infra-drift -o jsonpath='{.items[*].status.phase}' after the merge
  • THEN the command prints Succeeded

Existing Tool Considered

No alternatives check has run. Argo Workflows v4.1.7, an open and maintained controller already in use, covers the CronWorkflow schedules and WorkflowTemplate synchronization.mutexes schema; Kubernetes NetworkPolicy covers the TCP 6443 egress rule. The change writes no new code, so it has no build cost.

Key questions

  • Which CronWorkflow field holds the schedule in controller v4.1.7?: spec.schedules holds the schedule as a list. The singular spec.schedule field is invalid and causes SpecError. [sources: k8s/devops/cronworkflow-infra-drift.yaml]
  • Which WorkflowTemplate field holds the mutex in controller v4.1.7?: spec.synchronization.mutexes holds the mutex as a list. The singular synchronization.mutex field is not read. [sources: k8s/devops/workflowtemplate-infra-drift.yaml, docs/SERVICE_PATTERNS.md:52]
  • Which service account does the executor use?: The executor uses the dedicated argo-executor service account at spec.executor.serviceAccountName. (best practice) [sources: k8s/devops/workflowtemplate-infra-drift.yaml]
    • Chosen: Dedicated argo-executor service account. It gives the executor its own identity and meets the required value.
    • Rejected: Reuse the devops-cli workflow service account. It gives the executor the workflow permissions and does not meet the required value.
  • How do the Workflow pods get API server egress on TCP 6443?: A NetworkPolicy egress rule selects the infra-drift pod labels and permits TCP 6443 to the Kubernetes API server. (best practice) [sources: k8s/devops/workflowtemplate-infra-drift.yaml]
    • Chosen: Allow TCP 6443 egress to the API server only. It gives the least egress that the executor needs.
    • Rejected: Allow all egress from the Workflow pods. It is broader than the need and weakens the network policy.
    • Rejected: Use host network. It bypasses the pod network and is not required.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

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

    @devops-cli-service
    ContributorAuthor
    • Priority: The CronWorkflow is in SpecError and does not run, which is a service job failure.
    • Related: feat(infra): run drift in the cluster and plan infra PRs #5129, which asks for a different change. #5129 delivered the infra-drift CronWorkflow and WorkflowTemplate; this candidate fixes field errors in those manifests.
  3. added
    priority/p0-critical
    on Nov 27, 2026
  4. changed the title [-]fix(k8s): move the infra-drift CronWorkflow to plural schedules and the executor account[/-] [+]fix(k8s): Fix infra-drift CronWorkflow schedules and executor[/+] on Nov 27, 2026
  5. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    ContributorAuthor

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

    • Before: fix(k8s): move the infra-drift CronWorkflow to plural schedules and the executor account
    • Source of the summary: the background model
  6. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

  7. dan-petty commented on Nov 27, 2026

    @dan-petty
    Owner

    Evidence of 2026-11-27: the API server egress gap stops each Workflow in devops, not only infra-drift.

    For dan-petty/homelab#335 I ran one Workflow in devops from a test copy of WorkflowTemplate devops-cli-version, with spec.executor.serviceAccountName: argo-executor. The main container ran (devops-cli 0.224.0). The wait container then failed:

    wait: Error (exit code 64): Post "https://10.43.0.1:443/apis/argoproj.io/v1alpha1/namespaces/devops/workflowtaskresults": dial tcp 10.43.0.1:443: connect: connection refused
    

    So the Workflow ended in Error. In devops, only roadmap-service-egress (pods app.kubernetes.io/name: roadmap-service) allows TCP 6443. devops-default-perimeter-egress allows TCP 443 to public addresses only. The controller gives each Workflow pod the label workflows.argoproj.io/workflow, so one rule for that label would cover infra-drift, rag-ingest (#5289) and each later template. I deleted the test objects.

  8. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 27, 2026
  9. removed
    status/in-review
    owner/agent
    on Nov 27, 2026
  10. dan-petty commented on Nov 27, 2026

    @dan-petty
    Owner

    Live check of 2026-11-27, release 0.225.0 (Argo CD synced Application devops after dan-petty/homelab#546, merged at 15:25 UTC).

    • The controller takes CronWorkflow infra-drift: spec.schedules is ["0 6 * * *"], it has no condition, and the controller log of the last 15 minutes has no must have at least one schedule line for it.
    • WorkflowTemplate infra-drift has executor.serviceAccountName: argo-executor and synchronization.mutexes, and policy argo-workflow-egress exists.
    • argo submit -n devops --from cronwf/infra-drift at 15:35 UTC made Workflow infra-drift-proof-szwrx and its pod. The pod stayed in Init:0/1: FailedMount: MountVolume.SetUp failed for volume "ssh-key" : secret "infra-ssh-key" not found. I deleted the Workflow.

    So criterion 4 (Succeeded) is not proved. The stop is a gap of #5129, not of this change: push-secrets has no row for devops/infra-ssh-key, so a person cannot write it. #7428 holds it. The executor path (API egress, task results) is proved only after a pod of a Workflow runs.

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

    @devops-cli-service
    ContributorAuthor

    Live since 2026-11-27 15:40 UTC

  12. dan-petty commented on Nov 27, 2026

    @dan-petty
    Owner

    Live proof, 2026-11-27 19:26 UTC, after the owner pushed Secret devops/infra-ssh-key (#7428):

    • Workflow infra-drift-manual-nsc84, submitted from cronwf/infra-drift, ran from 19:25:59 to 19:26:09 UTC and ended Succeeded, with exit 0. The pod mounted ssh-key with no FailedMount event.
    • The wait container of the executor wrote the task result through the API server. Before this change, the same write failed with dial tcp 10.43.0.1:443: connect: connection refused. So executor.serviceAccountName: argo-executor and policy argo-workflow-egress work.

    Criterion 4 prints Succeeded, but the run checked no repository: the cluster config has no infra.repos, and drift --all then exits 0. #7460 holds that gap.

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/lowpriority/p0-criticalscope/k8ssource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions