Skip to content

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

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

fix(manifests): replace broken NetworkPolicy with proper platform ingress rules#1566
markturansky wants to merge 4 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 explicitly allow ingress from platform-designated namespaces, pods within the same namespace, and pods with specific labels across namespaces.
    • Tightened ingress rules to remove broad allowances and make permitted sources more explicit.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 12, 2026

Deploy Preview for cheerful-kitten-f556a0 canceled.

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

@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: 34586a72-5d79-4386-873d-98941375e66d

📥 Commits

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

📒 Files selected for processing (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 accurately describes the main change: replacing a broken NetworkPolicy with corrected 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 PR contains only Kubernetes manifest changes (runner-networkpolicy.yaml). No application code modifications. Performance check not applicable to declarative infrastructure configuration.
Security And Secret Handling ✅ Passed NetworkPolicy file contains no plaintext secrets, hardcoded credentials, base64-encoded sensitive data, or K8s Secret references missing OwnerReferences. Rules use standard label selectors only.
Kubernetes Resource Safety ✅ Passed NetworkPolicy resource is properly namespace-scoped via kustomize overlays. Child resources, container limits, RBAC, and pod security context checks are not applicable to NetworkPolicy manifests.

✏️ 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 2 times, most recently from 514e8d6 to baa4ad7 Compare May 12, 2026 18:23
…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 <[email protected]>
@markturansky markturansky force-pushed the fix/platform-ingress-netpol-base branch from beb2298 to f416ffa Compare May 14, 2026 00:18
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