Skip to content

fix(manifests): replace broken NetworkPolicy with proper platform ingress rules#1566

Open
markturansky wants to merge 2 commits into
mainfrom
fix/platform-ingress-netpol-base
Open

fix(manifests): replace broken NetworkPolicy with proper platform ingress rules#1566
markturansky wants to merge 2 commits into
mainfrom
fix/platform-ingress-netpol-base

Conversation

@markturansky
Copy link
Copy Markdown
Contributor

@markturansky markturansky commented May 12, 2026

Summary

Root Cause

PR #1553 merged a NetworkPolicy into base/ that inadvertently blocked all ingress to the ambient-code namespace except from runner pods. On OpenShift, the ingress router runs in a separate namespace (openshift-ingress), so all external traffic to the frontend, backend routes, and API server was denied.

Test plan

  • Verified kustomize build succeeds for base/, overlays/production/, and overlays/kind/
  • Manually applied corrected NP to Stage and UAT — both clusters recovered immediately
  • Verify frontend accessible after deployment on Stage/UAT
  • Verify runner pods can still reach backend services

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated network policy to allow ingress from multiple explicit sources: platform-designated namespaces, pods within the same namespace, and pods with specific labels across namespaces.
    • Renamed and refined selectors to make ingress sources explicit and tighten rule definitions while preserving interoperability.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 12, 2026

Deploy Preview for cheerful-kitten-f556a0 canceled.

Name Link
🔨 Latest commit c05f5e2
🔍 Latest deploy log https://app.netlify.com/projects/cheerful-kitten-f556a0/deploys/6a038753110ab7000873b89e

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0f2f754e-dc31-4948-9443-9f439a95a9ab

📥 Commits

Reviewing files that changed from the base of the PR and between 5f1d48a and baa4ad7.

📒 Files selected for processing (1)
  • components/manifests/base/runner-networkpolicy.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/manifests/base/runner-networkpolicy.yaml

📝 Walkthrough

Walkthrough

The NetworkPolicy metadata.name was changed to allow-platform-ingress and its spec.ingress was rewritten: the prior empty (allow-all) ingress rule and single ambient-runner source were removed and replaced with three explicit ingress.from sources (namespaces labeled policy-group.network.openshift.io/ingress: "", all pods in the same namespace, and pods labeled app: ambient-code-runner from any namespace).

Changes

Runner NetworkPolicy ingress rewrite

Layer / File(s) Summary
NetworkPolicy rename and ingress sources
components/manifests/base/runner-networkpolicy.yaml
metadata.name changed to allow-platform-ingress. Replaced previous ingress rules (which included an empty allow-all rule and a single app: ambient-code-runner pod source) with three explicit spec.ingress.from entries: (1) pods in namespaces labeled policy-group.network.openshift.io/ingress: "", (2) all pods within the same namespace (podSelector: {}), and (3) pods labeled app: ambient-code-runner from any namespace (namespaceSelector + podSelector.matchLabels).

Possibly related PRs

  • ambient-code/platform#1553: Prior change to the same NetworkPolicy manifest that added an allow-from-runner-namespaces style policy; this PR renames and rewrites that policy's ingress sources.
🚥 Pre-merge checks | ✅ 8
✅ Passed checks (8 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title follows Conventional Commits format (fix type, manifests scope) and clearly describes the main change: replacing a broken NetworkPolicy with proper platform ingress rules.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Performance And Algorithmic Complexity ✅ Passed Only Kubernetes NetworkPolicy manifest modified. No algorithmic code, caching, N+1 patterns, or performance logic. Change is restrictive, improving efficiency.
Security And Secret Handling ✅ Passed PR modifies only Kubernetes NetworkPolicy manifest with no code changes, no credentials, and no K8s Secret issues. Not applicable to security check.
Kubernetes Resource Safety ✅ Passed NetworkPolicy resource complies with safety checks. No child resources or RBAC wildcards present. Namespace scoping provided by Kustomize overlay injection. Ingress rules are targeted and intentional.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/platform-ingress-netpol-base
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/platform-ingress-netpol-base

Comment @coderabbitai help to get the list of available commands and usage tips.

@markturansky markturansky force-pushed the fix/platform-ingress-netpol-base branch from dc2f589 to 5f1d48a Compare May 12, 2026 16:45
…ress rules

The allow-from-runner-namespaces NP (#1553) uses podSelector: {} (all pods)
but only permits ingress from runner pods, blocking OpenShift router traffic
to the frontend and all other services. This caused outages on both Stage
and UAT clusters.

Replace with allow-platform-ingress that permits:
- OpenShift router ingress (policy-group.network.openshift.io/ingress label)
- Intra-namespace pod-to-pod traffic
- Runner pod ingress from any namespace (original intent of #1553)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@markturansky markturansky force-pushed the fix/platform-ingress-netpol-base branch from 514e8d6 to baa4ad7 Compare May 12, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant