Add control plane connectivity control for offline mode#305
Conversation
Adds PDP-level bindings for OPAL's new server connectivity feature, allowing the PDP to start disconnected from the control plane and serve from a local backup. Includes runtime HTTP endpoints (/control-plane/connectivity) authenticated with the PDP API key. - Add PDP_CONTROL_PLANE_CONNECTIVITY_DISABLED config option - Create /control-plane/connectivity GET/enable/disable endpoints - Upgrade opal-common and opal-client to 0.9.4rc6 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🔍 Vulnerabilities of
|
| digest | sha256:6e2df1fc8573010eba4405805cea800ed33e56aacbdfac07f00f72cd14cf665e |
| vulnerabilities | |
| platform | linux/amd64 |
| size | 214 MB |
| packages | 252 |
📦 Base Image oisupport/staging-amd64:b259d89e26fbe01d956a4834260c0e5a7c7b305ecda39ae3b59e208e5a03a2aa
| digest | sha256:a7b85667f5c4e8db146b494344e4a3826e695185c7260bddab7ec9667a2406e3 |
| vulnerabilities |
Description
| ||||||||
There was a problem hiding this comment.
Pull request overview
Adds PDP-level control-plane connectivity controls to support “offline mode” operation and runtime toggling of OPAL server connectivity via authenticated HTTP endpoints.
Changes:
- Upgrade
opal-common/opal-clientto0.9.4rc6to pick up OPAL connectivity support. - Introduce
/control-plane/connectivityGET + enable/disable POST endpoints authenticated withenforce_pdp_token. - Add
PDP_CONTROL_PLANE_CONNECTIVITY_DISABLEDconfig and wire it into OPAL client config at startup when offline mode is enabled.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
requirements.txt |
Bumps OPAL dependencies to a version that includes connectivity toggling support. |
horizon/pdp.py |
Initializes OPAL connectivity default and mounts the new connectivity router. |
horizon/connectivity/api.py |
Implements the new /control-plane/connectivity endpoints. |
horizon/config.py |
Adds the CONTROL_PLANE_CONNECTIVITY_DISABLED env-config entry (prefixed as PDP_...). |
horizon/connectivity/__init__.py |
Introduces the new connectivity module/package. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…pes, OpenAPI responses, and tests - Add asyncio.Lock to serialize enable/disable operations (fixes TOCTOU race) - Add try/except with proper error logging and HTTP 500 responses - Use Literal type for ConnectivityActionResult.status field - Add responses parameter to route decorators for OpenAPI docs - Add test_connectivity_api.py with 10 tests covering all endpoints Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zeevmoney
left a comment
There was a problem hiding this comment.
Looks good, minor comments
…update OPAL to stable - Only mount connectivity router when ENABLE_OFFLINE_MODE is enabled to reduce attack surface - Update opal-common and opal-client from 0.9.4rc6 to stable 0.9.4 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
PDP_CONTROL_PLANE_CONNECTIVITY_DISABLEDenv var — When set withPDP_ENABLE_OFFLINE_MODE=true, the PDP starts disconnected from the control plane and serves from a local backup. Falls back to control plane connection if no valid backup exists.GET /control-plane/connectivity— Current connectivity statusPOST /control-plane/connectivity/enable— Reconnects to control plane, triggers full rehydrationPOST /control-plane/connectivity/disable— Disconnects, continues serving from cached stateopal-commonandopal-clientto0.9.4rc6— picks up the underlying OPAL server connectivity feature (permitio/opal#889)Why PDP-level endpoints?
OPAL's built-in
/opal-server/connectivityendpoints require OPAL JWT tokens (PeerType.listener). Permit customers use PDP API keys exclusively, so we expose equivalent endpoints under/control-plane/authenticated withenforce_pdp_token.Test plan
PDP_ENABLE_OFFLINE_MODE=true PDP_CONTROL_PLANE_CONNECTIVITY_DISABLED=trueand verify it serves from backupGET /control-plane/connectivityreturnscontrol_plane_connectivity_disabled: truePOST /control-plane/connectivity/enablereconnects and triggers rehydrationPOST /control-plane/connectivity/disabledisconnects and saves backup🤖 Generated with Claude Code