Repository navigation
feat(opa): serve the OPA surface on its own engines-only listener - #843
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing branches Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
build_router no longer merges the OPA surface; egret_server::opa_router returns it for a dedicated listener bound from [governance.opa] listen, drained on shutdown like the apps host. Also repairs opa_start.rs, which B1's new OpaSettings fields had left uncompilable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Engines on an OPA profile are now configured with the OPA listener's URL (governance.opa.engine_url, or the engine URL with the listener's port), while Ranger and catalog URLs stay on the main port. Start fails when the OPA URL cannot be derived. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An install that never enables [governance.opa] no longer has its server.port / apps.listen checked against the OPA listen port, its listen format checked, or its start aborted by an underivable engine OPA URL (the URL then falls back to the engine egret URL). While OPA is on, an explicit engine_url must be an absolute http(s) URL with a host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The OPA listener's task handle was dropped, so at SIGTERM the process exited as soon as the API listener drained, killing in-flight OPA decisions (each a failed Trino query). main now keeps the handles of the side listeners and waits for them after the API drain, bounded by DRAIN_DEADLINE. The apps listener had the same flaw and shares the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
viethqb
force-pushed
the
feat/opa-listener
branch
from
November 8, 2026 03:42
5d240bf to
0c965a4
Compare
viethqb
marked this pull request as ready for review
November 8, 2026 03:42
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is port 8080 hardening, PR B: egret's OPA decision surface gets its own listener, which only engines can reach. It is the second prerequisite for SP2b Task 26 (OPA on by default). PR A was #842.
The problem.
/opa/was served on egret's API port 8080.Content-Lengthand stall. That exhausts the shared in-flight budget, and every engine gets 503.Spec:
docs/en/specs/2026-11-07-port-8080-hardening-design.md, Part B (decisions Q2 and Q3). Plan: Tasks B1–B7.Changes
[governance.opa] listen(default0.0.0.0:8082) andengine_url.engine_urldefaults to[catalog] public_url(orhttp://egret:8080) with the port swapped to the listener's port.listenhas no port, or ifengine_urlis not an absolute http(s) URL. With OPA off, nothing changes.egret_server::opa_routerserves the surface only on that listener./opa/./ranger/,/oauth/tokenand the Iceberg catalog stay on 8080.refuse_same_sitemove with the surface.DRAIN_DEADLINEas 8080. They used to be spawn-and-forget.CpStateand the policy admin state carryengine_opa_url.ranger_binding, theopa-plugin-configroute and the policy admintrino-configgive OPA-profile engines the new URL.applied_opa_urlreapply_stale_opa_enginesruns in the background and re-applies provisioned Trino engines on an OPA profile whose recorded URL differs, NULL included.opa.enabled,opa.portandopa.extraFrom; anopaport on the Deployment and the Service.networkpolicy-egret.yaml(egret-ingress), rendered withengineNetworkPolicy.enabled: 8080 is open to all, 8081 is open when apps are on, and the OPA port admits onlyengineNamespaceplusopa.extraFrom.opa_port_check(run bylayer2.shin CI) asserts that the renderedopa.policy.urinames:8082/opa/and thatPOST egret:8080/opa/...answers exactly 404.Upgrade impact (breaking for OPA engines)
/opa/, so the new pods answer 404;Test plan
helm_opa_listener5/5, plushelm templatewith OPA on and off, andhelm lint.-D warningsare clean.opa-e2ewith the new port check. Thefrontendjob needed one rerun for a flake that this PR doesn't touch: afocusArrival.tstimer after jsdom teardown.Known follow-ups (not in this PR)
opa.enabledwithout Ranger, or for anopa.portclash.engine_urlkeepspublic_url's scheme and path.focusArrivaltimer flake in the frontend tests.Documentation
egret-data/docs#70.
Checklist
🤖 Generated with Claude Code