Skip to content

feat(k8s): refuse the Workflow pod label on each Service Job #7412

Backlog

Description

@dan-petty

Problem or Motivation

PR #7410 (#7364) adds the policy argo-workflow-egress in namespace devops. It lets each pod with the label workflows.argoproj.io/workflow reach the API server on TCP 6443. The Argo Workflows controller sets this label on each Workflow pod.

The ValidatingAdmissionPolicy roadmap-service-jobs checks each Job that the roadmap Service creates. It does not refuse this label on the pod template of a Job. A Job of the Service that carries the label would get the same egress rule as a Workflow pod. The k8s gate row of #7410 checks only the pod templates of the CronJobs devops-cli, devops-cli-runner and roadmap-stage, not the Jobs that the Service makes at run time.

The Job pod mounts no token, so this is defense in depth, not an open path.

Proposed Solution & Architectural Design

Add one validation to roadmap-service-jobs: refuse a Job whose pod template has the label key workflows.argoproj.io/workflow. Prove it with the existing admission policy tests of the k8s check.

Acceptance Criteria

  • roadmap-service-jobs refuses a Job whose pod template carries the label key workflows.argoproj.io/workflow.
  • uv run devops ci --check --only k8s exits zero.

Dependencies

Alternatives check of 2026-11-27: in-use.
The repository already uses this tool.
Tool: kubernetes/kubernetes (https://github.com/kubernetes/kubernetes), Apache-2.0, last activity 2026-11-27, maintained.
Reason: The built-in ValidatingAdmissionPolicy, already run as roadmap-service-jobs, expresses this refusal in one CEL rule on the Job pod template; Kyverno would only duplicate it, so no new tool is needed.

Covers:

  • CEL validations deny a Job whose pod template carries a label key
  • Runs at admission, so run-time Service Jobs are checked, not only CronJob templates
  • The repository already deploys the policy, so the change is one more rule

Lacks:

  • No built-in test runner for policy rules; the project keeps its own
  • Refusals surface only as events and audit annotations, with no dashboard
  • No re-check of Jobs created before the rule; admission only sees new ones

Proposed design

Problem statement

The roadmap-service-jobs ValidatingAdmissionPolicy admits a Job whose pod template carries the label key workflows.argoproj.io/workflow. Such a Job would get the Workflow pod egress rule of the argo-workflow-egress policy. The change adds one CEL rule that denies the label at admission, so run-time Service Jobs are checked. The Job pod mounts no token, so this is defense in depth.

Acceptance criteria

Requirement: Deny the Workflow label

The roadmap-service-jobs ValidatingAdmissionPolicy SHALL deny a Job whose pod template carries the label key workflows.argoproj.io/workflow.

Scenario: A Service Job with the Workflow label

  • WHEN uv run devops ci --check --only k8s runs the admission policy tests with a Job that has the label key workflows.argoproj.io/workflow in its pod template
  • THEN the test reports the denial of that Job by roadmap-service-jobs, and the command exits zero

Requirement: Admit a Service Job without the label

The roadmap-service-jobs ValidatingAdmissionPolicy MUST still admit a Job whose pod template has no workflows.argoproj.io/workflow label key.

Scenario: A Service Job with no Workflow label

  • WHEN uv run devops ci --check --only k8s runs the admission policy tests with the existing allowed Service Job
  • THEN the test reports the admission of that Job, and the command exits zero

Existing Tool Considered

The alternatives block of the issue records the verdict in-use for kubernetes/kubernetes (Apache-2.0, maintained). The built-in ValidatingAdmissionPolicy, already deployed as roadmap-service-jobs, covers the refusal in one CEL rule on the Job pod template. The block lists what the tool covers and lacks; read it in the issue body. This proposal adds the rule and proves it with the project's own policy test runner, which the block names as a lack of the tool. The change writes no new tool code.

Key questions

  • How does the policy refuse the Workflow label on a Job pod template?: Add one CEL validation rule to the existing roadmap-service-jobs policy. The rule denies a Job when the labels of its pod template hold the key workflows.argoproj.io/workflow. Admission then checks each Job that the Service creates at run time, so no CronJob template list changes. The alternatives block records the verdict in-use for kubernetes/kubernetes. (best practice) [sources: AGENTS.md, k8s/README.md]
    • Chosen: One CEL rule on the existing policy. The policy already matches the Jobs of the Service, so one more rule covers run-time Jobs with no new component.
    • Rejected: A second ValidatingAdmissionPolicy. It repeats the Job match of the existing policy and splits one refusal across two objects.
    • Rejected: A Kyverno policy. The alternatives block states that Kyverno would only duplicate the built-in policy, and it adds a new engine.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#7364

Activity

  1. added
    type/feature
    scope/k8s
    source/agent
    status/new
    on Nov 27, 2026
  2. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor
  3. added
    value/medium
    effort/low
    priority/p2-medium
    on Nov 27, 2026
  4. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (10)

    Tools considered:

    Searches run:

    • Kubernetes ValidatingAdmissionPolicy CEL deny label pod template, results: 5
    • Kyverno validate rule deny label on pod template of Job, results: 5
    • Kyverno policy engine Kubernetes admission controller, results: 5
    • Gatekeeper OPA Kubernetes admission policy, results: 5
    • kyverno github repository, results: 5
    • open-policy-agent gatekeeper, results: 5
    • kyverno.io validate labels pod template job, results: 5
    • ValidatingAdmissionPolicy Kubernetes documentation, results: 5
    • Kyverno deny label key on Job pod template policy example, results: 5
    • kyverno, results: 5

    Sources:

  5. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  6. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See 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/lowpriority/p2-mediumscope/k8ssource/agentstatus/readytype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions