Repository navigation
Description
Problem Description
The two NetworkPolicies of the MCP server select the client pods by the label app.kubernetes.io/name: devops-cli-runner. A runner Job that the Service or devops k8s run-job makes does not carry that label. So the policies would block the Job pods when roadmap.implement.mcp is on.
Reproduction Steps
- Read
build_jobinsrc/devops_cli/k8s/cluster_job.py. It setsapp.kubernetes.io/name: devops-cli-jobon the pod template of every Job it makes, and this replaces the label of the CronJob template. - Read
k8s/devops/roadmap-service/admissionpolicy.yaml. It requires the pod labeldevops-cli-jobfor a Job of the Service. - Read
k8s/devops/mcp-server/networkpolicy.yaml(ingress) andnetworkpolicy-client.yaml(egress). They nameroadmap-serviceanddevops-cli-runner, and notdevops-cli-job.
Expected vs Actual Behavior
Expected: a runner Job that calls /implementation/mcp can reach TCP 8001 of the server, and no other pod can.
Actual: only the pods of the runner CronJob (label devops-cli-runner) match. A Job of the Service (label devops-cli-job) matches neither policy, so its connection is dropped. Issue #3600 asked for ingress from devops-cli-job.
Environment Diagnostics
devops-cli 0.107.0, k8s stack devops. Both client switches are off today, so no call fails yet. The fix needs a decision: allow the label devops-cli-job, which also covers the generic Jobs, or give the runner Jobs of the Service a second label for the policy.
Logs, Traces, or Terminal Output
None. This is read from the manifests and the code.
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Proposed design
Problem statement
The two NetworkPolicies of the MCP server select client pods by the label app.kubernetes.io/name: devops-cli-runner. A runner Job that the Service or devops k8s run-job makes carries the label devops-cli-job instead, because build_job replaces the CronJob label. So the policies would drop the connection of every runner Job to TCP 8001 of the MCP server when roadmap.implement.mcp is on.
Acceptance criteria
Requirement: Runner Job pods carry the MCP client label
The function build_job SHALL set the label devops-cli/mcp-client: "true" on the pod template and the Job when the template is the runner template, and SHALL keep the label app.kubernetes.io/name: devops-cli-job.
Scenario: Runner template
- WHEN
build_jobruns withRUNNER_TEMPLATEon a runner CronJob fixture - THEN The pod template labels hold
devops-cli/mcp-clientwith the valuetrueandapp.kubernetes.io/namewith the valuedevops-cli-job.
Requirement: Generic Job pods get no MCP client label
The function build_job MUST NOT set the label devops-cli/mcp-client when the template is the default template.
Scenario: Default template
- WHEN
build_jobruns withDEFAULT_TEMPLATEon a CronJob fixture - THEN The pod template labels hold no key
devops-cli/mcp-client.
Requirement: Ingress policy admits the runner Job label
The NetworkPolicy mcp-server-ingress SHALL admit TCP 8001 from pods that carry the label devops-cli/mcp-client: "true" and from the roadmap Service pods only.
Scenario: Ingress selectors
- WHEN A test renders
k8s/devops/mcp-server/networkpolicy.yaml - THEN The
fromlist selects the labeldevops-cli/mcp-clientandapp.kubernetes.io/name: roadmap-service, and the only port is TCP 8001.
Requirement: Egress policy admits the runner Job label
The egress NetworkPolicy in k8s/devops/mcp-server/networkpolicy-client.yaml SHALL select the pods that carry the label devops-cli/mcp-client: "true" and allow TCP 8001 to the MCP server.
Scenario: Egress selector
- WHEN A test renders
k8s/devops/mcp-server/networkpolicy-client.yaml - THEN The pod selector matches the label
devops-cli/mcp-client, and the egress rule allows TCP 8001 to the podsapp.kubernetes.io/name: mcp-server.
Requirement: The Job still passes the admission policy
A runner Job with the new label SHALL pass the ValidatingAdmissionPolicy roadmap-service-jobs.
Scenario: Admission with the extra label
- WHEN The test in
tests/gate/k8s_checks/job_admission_policy.pyevaluates the policy on the Job thatbuild_jobmakes from the runner CronJob - THEN Every validation passes.
Existing Tool Considered
Kubernetes NetworkPolicy and ValidatingAdmissionPolicy already cover the need. The change adds one label to build_job and edits two manifests. No other open tool or library is needed. Building it costs a small change of about 40 lines with tests, and about one hour.
Key questions
- Which label do the MCP server policies use to select the runner Job pods?: Use a second label,
devops-cli/mcp-client: "true".build_jobsets it for the runner template only. The two policies select it. The name labeldevops-cli-jobstays as it is. (best practice) [sources: src/devops_cli/k8s/cluster_job.py, k8s/devops/roadmap-service/admissionpolicy.yaml, k8s/devops/mcp-server/networkpolicy.yaml]- Rejected: Select
app.kubernetes.io/name: devops-cli-job. It also admits the generic Jobs ofdevops k8s run-job, which have no need of the MCP server. The issue asks that no other pod can reach the server. - Chosen: Add a second label for runner Jobs only. It keeps the name label that the admission policy and the egress policies require. It admits only the runner Jobs.
build_jobalready accepts extra labels, and the admission policy does not forbid them.
- Rejected: Select
- Does the admission policy refuse a Job pod with an extra label?: No. The policy checks only that
app.kubernetes.io/nameequalsdevops-cli-job. A test still evaluates it on the new Job. [sources: k8s/devops/roadmap-service/admissionpolicy.yaml, tests/gate/k8s_checks/job_admission_policy.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 10, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(k8s)scope of the title gives the scope.The defect is latent because both client switches are off today, but it will block Service runner Jobs from reaching the MCP server when enabled.Without the fix, Service runner Jobs cannot reach the MCP server once the feature is turned on.The change adds one label to two YAML podSelectors or adds a second label to the Job pod template.Both concern the MCP server NetworkPolicies in k8s/devops/mcp-server/, but #3600 creates them and the candidate fixes a missing devops-cli-job label in the podSelector.devops-cli-service commentedon Nov 10, 2026
Status set to Ready at 273e4c9 (see proposed design in issue body).
fix(k8s): the MCP server policies admit the Job pods
docs(testing): list the MCP server policy invariant test
chore(openspec): archive 4355-mcp-server-policies-miss-the-service
dan-petty commentedon Nov 10, 2026
Decision (owner, 2026-11-10):
devops-cli-jobpods may reach and use the MCP server. Draft PR #4367 selectsdevops-cli-jobin both policies (no second label), keeps TCP 8001 to the server pods only, and adds a test that holds the admitted label equal to the label thatbuild_jobsets. Path analysis and the person steps are in the PR comments.devops-cli-service commentedon Nov 10, 2026
Released in v0.107.1: https://github.com/dan-petty/devops-cli/releases/tag/v0.107.1
devops-cli-service commentedon Nov 10, 2026
Live since 2026-11-10 13:56 UTC