Repository navigation
Description
Problem
ADR 0018 says that the planner run Job reaches no network. k8s/devops/roadmap-service/networkpolicy-planner-run.yaml selects the pod (label app.kubernetes.io/name: devops-cli-planner-run) and has no egress rule, and its comment says "this policy alone selects it".
That is not true. devops-default-perimeter (k8s/devops/networkpolicy.yaml) selects every pod of the namespace whose app.kubernetes.io/name is not crawl4ai, searxng or renovate. The planner label is not in that list. NetworkPolicies add their rules, so the planner pod gets the egress rules of the default perimeter: DNS, the gateway, Valkey, Qdrant, the OpenTelemetry collector and public HTTPS. The check check_the_planner_template_has_the_controls_of_adr_0018 (tests/gate/k8s_checks/job_admission_policy.py) reads only the planner policy, so it does not see the second policy.
Expected behavior
- The default perimeter does not select the planner run pod, so the pod reaches no network, DNS included, as ADR 0018 says.
- A live check from one planner pod shows that a DNS lookup and a connection to the gateway fail (feat(k8s): a command that probes a network policy path #4407 adds a command for such a probe).
- The comments of both policies say what is true.
Related
- ADR 0018, feat(k8s): manifest and admission policy for planner sandboxed run job #4003, feat(k8s): render a credential-free ConfigMap for the planner run Job #4147 (the ConfigMap of the planner run), feat(k8s): a command that probes a network policy path #4407, docs(service): Write the service design pattern standards #6059 (service pattern SC3).
Proposed design
Problem statement
The planner run pod is selected by both its no-egress policy and devops-default-perimeter. NetworkPolicies add their rules, so the default perimeter gives the pod DNS, gateway, Valkey, Qdrant, OpenTelemetry collector and public HTTPS egress. The gate check reads only the planner policy, so it does not see the second selector, and the comments of both policies claim that the planner policy alone selects the pod. ADR 0018 requires the planner run Job to reach no network, DNS included.
Acceptance criteria
Requirement: Default perimeter excludes planner run pod
The devops-default-perimeter NetworkPolicy SHALL not select a pod labeled app.kubernetes.io/name: devops-cli-planner-run.
Scenario: Planner label is outside the default perimeter
- WHEN the
devops-default-perimeterpod selector is evaluated with the labelapp.kubernetes.io/name=devops-cli-planner-run - THEN the selector does not match the pod.
Requirement: Planner policy denies all egress
The devops-cli-planner-run NetworkPolicy SHALL select the planner run pod and specify policyTypes: [Egress] with no egress rules.
Scenario: Planner policy is the sole selector
- WHEN the planner policy is evaluated with the label
app.kubernetes.io/name=devops-cli-planner-run - THEN the policy matches the pod, its
policyTypesis[Egress], and it has noegressrules.
Requirement: Gate check covers both policies
The gate check check_the_planner_template_has_the_controls_of_adr_0018 SHALL fail when devops-default-perimeter selects the planner run pod.
Scenario: Default perimeter selects the planner label
- WHEN the default perimeter selector matches the label
app.kubernetes.io/name=devops-cli-planner-run - THEN the gate check fails with a message that names
devops-default-perimeter.
Requirement: Policy comments state the planner exclusion
The comments of devops-default-perimeter and devops-cli-planner-run SHALL state that the default perimeter does not select the planner run pod.
Scenario: Policy comments name the planner exclusion
- WHEN a test reads the text of
k8s/devops/networkpolicy.yamlandk8s/devops/roadmap-service/networkpolicy-planner-run.yaml - THEN the default perimeter comment names
devops-cli-planner-runas an excluded label and the planner policy comment says the default perimeter does not select the pod.
Existing Tool Considered
np-guard/netpol-analyzer (https://github.com/np-guard/netpol-analyzer, fetched 2026-11-17) is the open-source analyzer for NetworkPolicy connectivity, but it lacks this repository's gate wiring, a workload manifest for a pod that exists only in a suspended CronJob template, and the comment assertion. The change instead extends the existing Python gate check (tests/gate/k8s_checks/job_admission_policy.py:812) and its two selector tests: about 20 lines, roughly 2,000 tokens to build, keep and fix, and under an hour of elapsed work.
Key questions
- Which label identifies the planner run pod?: The pod label is
app.kubernetes.io/name: devops-cli-planner-run; the CronJob pod template and the planner policy both use it. [sources: k8s/devops/roadmap-service/cronjob-planner-run.yaml:28, k8s/devops/roadmap-service/networkpolicy-planner-run.yaml:15] - What network behavior does ADR 0018 require of the planner run pod?: ADR 0018 requires no network: the planner run pod's NetworkPolicy admits no egress, DNS included. [sources: docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md:35, k8s/devops/roadmap-service/networkpolicy-planner-run.yaml:16]
- How should
devops-default-perimeterstop selecting the planner run pod?: Adddevops-cli-planner-runto theNotInvalues of theapp.kubernetes.io/namematch expression indevops-default-perimeter, and update its comment to list the planner label. The planner policy stays the only policy that selects the pod. (best practice) [sources: k8s/devops/networkpolicy.yaml:14, k8s/devops/networkpolicy.yaml:17, k8s/devops/roadmap-service/networkpolicy-planner-run.yaml:1]- Chosen: Add the planner label to the default perimeter NotIn list. It follows the existing exclusion pattern for crawl4ai, searxng and renovate and makes the planner policy the only selector.
- Rejected: Use a positive allowlist in the default perimeter. It changes which pods the default perimeter serves and is broader than this defect.
- Rejected: Add a second deny-all NetworkPolicy. NetworkPolicies add rules, so a second policy cannot remove the default perimeter egress.
- Rejected: Relabel the planner pod to an excluded label. It changes pod identity and conflicts with the planner policy selector and the ADR 0018 check.
- Where should the regression check for the second selector live?: Extend
check_the_planner_template_has_the_controls_of_adr_0018to evaluatedevops-default-perimeter's pod selector against the planner label and fail with a message that names the policy, and update the two tests that pin the selector'sNotInvalues (tests/commands/k8s/test_k8s_network_policies.py:675andtests/config/test_k8s_devops_runtime.py:449) to expectdevops-cli-planner-run. The gate check is the cross-policy regression; the two unit tests pin the manifest. (best practice) [sources: tests/gate/k8s_checks/job_admission_policy.py:812, tests/gate/k8s_checks/network_policies.py:137, tests/commands/k8s/test_k8s_network_policies.py:675, tests/config/test_k8s_devops_runtime.py:449, tests/gate/runner.py:45]- Chosen: Extend the ADR 0018 gate check and update the two selector tests. The gate check asserts the behavior across policies, and the two tests already pin the default perimeter's values, so they must change with the manifest.
- Rejected: Add a separate gate check module. It duplicates policy loading and leaves the named ADR 0018 check incomplete.
- Rejected: Update only the two unit tests. They pin the YAML values but do not assert that the default perimeter's selector does not match the planner pod.
- Rejected: Change only the comments. No test would catch the default perimeter selecting the planner pod again.
- How should the policy comments be kept true?: Add a raw-text test that reads both policy files and asserts the default perimeter comment lists
devops-cli-planner-runand the planner comment names the default perimeter, following the existing comment test attests/config/test_k8s_devops_runtime.py:430. (best practice) [sources: tests/config/test_k8s_devops_runtime.py:430, k8s/devops/networkpolicy.yaml:10, k8s/devops/roadmap-service/networkpolicy-planner-run.yaml:1]- Chosen: Raw-text comment test. The repository already tests a manifest comment this way, and a false comment is part of this defect.
- Rejected: No test; review only. The false comment is part of the defect, so a review-only rule lets it return.
- Rejected: Move the explanation to docs/CLUSTER.md only. The issue asks the policy comments to say what is true, and a reader of the manifest sees the comment.
- Does this change wait for feat(k8s): a command that probes a network policy path #4407 to add a live planner network probe?: No. The policy defect and its offline gate are fixed in this change; the live probe is a post-merge verification that uses the command feat(k8s): a command that probes a network policy path #4407 adds, so it is deferred as a follow-up issue and does not block the policy fix. (best practice) [sources: docs/CLUSTER.md:94, src/devops_cli/k8s/cluster_job.py:68, tests/gate/k8s_checks/job_admission_policy.py:812]
- Chosen: Ship the policy fix and offline gate; defer the live probe to a follow-up that waits on feat(k8s): a command that probes a network policy path #4407. The defect is in the manifest and the offline gate; the live probe needs feat(k8s): a command that probes a network policy path #4407's command and a deployed cluster, so it does not block this fix.
- Rejected: Make feat(k8s): a command that probes a network policy path #4407 a dependency of this issue. It delays the policy fix for a verification command that the offline gate does not need.
- Rejected: Add a live probe in this change. The probe command is feat(k8s): a command that probes a network policy path #4407's deliverable and cannot run in the offline gate.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 16, 2026
A security boundary stated in ADR 0018 is violated: the planner pod has network egress it should not have.Both concern the planner run Job NetworkPolicy; #4003 created the manifest and policy, the candidate fixes the default perimeter that still selects the planner pod.fix(k8s): Keep the default perimeter off the planner run pod (#6065)
devops-cli-service commentedon Nov 17, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.
devops-cli-service commentedon Nov 17, 2026
Released in v0.169.3: https://github.com/dan-petty/devops-cli/releases/tag/v0.169.3
devops-cli-service commentedon Nov 17, 2026
Live since 2026-11-17 03:03 UTC