Repository navigation
Description
Split from #5498.
ProblemnThe admission policy roadmap-service-jobs admits envFrom for a runner Job. A Job made before the sync of #6520 keeps envFrom, and the Service patches the deadline of a runner Job and resumes a waiting fix-checks Job. The policy checks an UPDATE as a CREATE, so a policy that refuses envFrom would refuse those patches.nnn## Why deferrednThe change waits until no Job with envFrom is left. The deadline cap is 14400 s, plus roadmap.fix_checks.max_wait_minutes for a waiting fix Job. No template of the Service uses envFrom today.nnn## Acceptance criterian- uv run devops ci --check --only k8s passes and the policy check refuses a Job that carries envFrom.n- tests/gate/k8s_checks/job_admission_policy.py fails on a fixture Job with envFrom.n- The Service patches a running runner Job after the policy change and the API server admits the patch. The issue comment gives the Job name and the result.
Proposed design
Problem statement
The policy roadmap-service-jobs must refuse envFrom in each Job of the Service. The Service patches a running runner Job and resumes a waiting fix-checks Job. The policy applies the CREATE rules to an UPDATE. So an envFrom rule refuses the patch of a Job that an old template made. This change refuses envFrom on CREATE only, because a Job keeps its pod template for its life. No wait for the old Jobs is necessary.
Acceptance criteria
Requirement: envFrom refused on create
The policy roadmap-service-jobs SHALL refuse a Job of the Service that carries envFrom in a container when the Service creates it.
Scenario: A new runner Job with envFrom
- WHEN A fixture runner Job adds
envFromto itsagentcontainer. - THEN
uv run devops ci --check --only k8spasses and the policy returns one refusal whose message namesenvFrom.
Requirement: envFrom refused in the stage and fix-checks Jobs
The policy SHALL refuse envFrom in the stage Job and in the fix-checks Job, as it does in the runner Job.
Scenario: A stage Job and a fix Job with envFrom
- WHEN A fixture stage Job and a fixture fix-checks Job each add
envFromto a container. - THEN
uv run devops ci --check --only k8spasses and the policy returns one refusal that namesenvFromfor each Job.
Requirement: the deadline patch of a legacy runner Job is admitted
The policy SHALL admit the UPDATE that the Service sends to a runner Job that already carries envFrom.
Scenario: The deadline patch of a legacy runner Job
- WHEN A fixture runner Job carries
envFromand the Service patches itsactiveDeadlineSeconds. - THEN
uv run devops ci --check --only k8spasses and the policy returns no refusal for the UPDATE.
Requirement: the resume of a waiting fix Job is admitted
The policy SHALL admit the UPDATE that resumes a suspended fix-checks Job that carries envFrom.
Scenario: The resume of a legacy fix Job
- WHEN A fixture fix-checks Job carries
envFromand is suspended, and the Service setssuspendto false. - THEN
uv run devops ci --check --only k8spasses and the policy returns no refusal for the UPDATE.
Existing Tool Considered
No alternatives check has run. The Kubernetes ValidatingAdmissionPolicy API with CEL covers the need: the repository ships the policy roadmap-service-jobs, and tests/gate/k8s_checks/job_admission_policy.py evaluates each expression offline with cel-expr-python. No new library and no new code are needed. The API server has no offline evaluator, so the gate test supplies one.
Key questions
- How does the policy refuse envFrom and still admit the patch of a Job that already carries it?: Add
request.operation == "CREATE"to the envFrom validation. A Job keeps its pod template for its life. So an UPDATE cannot addenvFrom. The Service creates each Job, so no Job withenvFromappears. (best practice) [sources: tests/gate/k8s_checks/job_admission_policy.py]- Chosen: CREATE-only guard. A Job's
spec.templateis immutable, so an UPDATE cannot addenvFrom. The guard keeps the CREATE refusal and admits each patch. - Rejected: Exempt an UPDATE that keeps the same envFrom. It compares two pod templates and adds no protection over the CREATE-only guard.
- Rejected: Wait until no Job with envFrom is left. It blocks the item for up to 14400 s plus the fix-checks wait, and it adds no protection.
- Chosen: CREATE-only guard. A Job's
- Which Jobs does the policy cover?: The policy matches each Job in namespace
devopsthat the Service account creates. So it covers the runner, the stage and the fix-checks Jobs. The gate test builds each of these Jobs from its template. [sources: tests/gate/k8s_checks/job_admission_policy.py, src/devops_cli/k8s/cluster_job.py] - Does the change need a live check on the cluster?: No. The API server runs the same CEL expression that the gate test evaluates with
request.operationset toUPDATE. The gate test proves that the patch is admitted. The plan keeps the live check as a task step. (best practice) [sources: tests/gate/k8s_checks/job_admission_policy.py]- Chosen: Gate test only. It evaluates the policy expression with the CEL runtime, so it shows the answer of the API server for the same request.
- Rejected: Live check on a running runner Job. It needs a runner Job on the cluster and gives no answer that the gate test does not give.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 25, 2026
Both modify the roadmap-service-jobs admission policy, but #2696 created the policy and the candidate adds a new rule that refuses envFrom.devops-cli-service commentedon Nov 25, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.