You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: architecture/README.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -235,17 +235,19 @@ Sandbox behavior is governed by policies written in YAML and evaluated by an emb
235
235
236
236
Inference routing to `inference.local` is configured separately at the cluster level and does not require network policy entries. The OPA engine evaluates only explicit network policies; `inference.local` connections bypass OPA entirely and are handled by the proxy's dedicated inference interception path.
237
237
238
-
Policies are not intended to be hand-edited by end users in normal operation. They are associated with sandboxes at creation time and fetched by the sandbox supervisor at startup via gRPC. For development and testing, policies can also be loaded from local files.
238
+
Policies are not intended to be hand-edited by end users in normal operation. They are associated with sandboxes at creation time and fetched by the sandbox supervisor at startup via gRPC. For development and testing, policies can also be loaded from local files. A gateway-global policy can override all sandbox policies via `openshell policy set --global`.
239
239
240
-
For more detail, see [Policy Language](security-policy.md).
240
+
In addition to policy, the gateway delivers runtime **settings** -- typed key-value pairs (e.g., `log_level`) that can be configured per-sandbox or globally. Settings and policy are delivered together through the `GetSandboxSettings` RPC and tracked by a single `config_revision` fingerprint. See [Gateway Settings Channel](gateway-settings.md) for details.
241
+
242
+
For more detail on the policy language, see [Policy Language](security-policy.md).
241
243
242
244
### Command-Line Interface
243
245
244
246
The CLI is the primary way users interact with the platform. It provides commands organized into four groups:
245
247
246
248
-**Gateway management** (`openshell gateway`): Deploy, stop, destroy, and inspect clusters. Supports both local and remote (SSH) targets.
247
249
-**Sandbox management** (`openshell sandbox`): Create sandboxes (with optional file upload and provider auto-discovery), connect to sandboxes via SSH, and delete sandboxes.
-**Provider management** (`openshell provider`): Create, update, list, and delete external service credentials.
250
252
-**Inference management** (`openshell cluster inference`): Configure cluster-level inference by specifying a provider and model. The gateway resolves endpoint and credential details from the named provider record.
251
253
@@ -312,4 +314,5 @@ This opens an interactive SSH session into the sandbox, with all provider creden
312
314
|[Policy Language](security-policy.md)| The YAML/Rego policy system that governs sandbox behavior. |
313
315
|[Inference Routing](inference-routing.md)| Transparent interception and sandbox-local routing of AI inference API calls to configured backends. |
314
316
|[System Architecture](system-architecture.md)| Top-level system architecture diagram with all deployable components and communication flows. |
-**`sandbox_index`** -- in-memory bidirectional index mapping sandbox names and agent pod names to sandbox IDs. Used by the event tailer to correlate Kubernetes events.
150
153
-**`sandbox_watch_bus`** -- `broadcast`-based notification bus keyed by sandbox ID. Producers call `notify(&id)` when the persisted sandbox record changes; consumers in `WatchSandbox` streams receive `()` signals and re-read the record.
151
154
-**`tracing_log_bus`** -- captures `tracing` events that include a `sandbox_id` field and republishes them as `SandboxLogLine` messages. Maintains a per-sandbox tail buffer (default 200 entries). Also contains a nested `PlatformEventBus` for Kubernetes events.
155
+
-**`settings_mutex`** -- serializes settings mutations (global and sandbox) to prevent read-modify-write races. Held for the duration of any setting set/delete or global policy set/delete operation. See [Gateway Settings Channel](gateway-settings.md#global-policy-lifecycle).
152
156
153
157
## Protocol Multiplexing
154
158
@@ -225,13 +229,14 @@ Full CRUD for `Provider` objects, which store typed credentials (e.g., API keys
225
229
|`UpdateProvider`| Updates an existing provider by name. Preserves the stored `id` and `name`; replaces `type`, `credentials`, and `config`. |
226
230
|`DeleteProvider`| Deletes a provider by name. Returns `deleted: true/false`. |
227
231
228
-
#### Policy and Provider Environment Delivery
232
+
#### Policy, Settings, and Provider Environment Delivery
229
233
230
-
These RPCs are called by sandbox pods at startup to bootstrap themselves.
234
+
These RPCs are called by sandbox pods at startup and during runtime polling.
231
235
232
236
| RPC | Description |
233
237
|-----|-------------|
234
-
|`GetSandboxPolicy`| Returns the `SandboxPolicy` from a sandbox's spec, looked up by sandbox ID. |
238
+
|`GetSandboxSettings`| Returns effective sandbox config looked up by sandbox ID: policy payload, policy metadata (version, hash, source, `global_policy_version`), merged effective settings, and a `config_revision` fingerprint for change detection. Two-tier resolution: registered keys start unset, sandbox values overlay, global values override. The reserved `policy` key in global settings can override the sandbox's own policy. When a global policy is active, `policy_source` is `GLOBAL` and `global_policy_version` carries the active revision number. See [Gateway Settings Channel](gateway-settings.md). |
239
+
|`GetGatewaySettings`| Returns gateway-global settings only (excluding the reserved `policy` key). Returns registered keys with empty values when unconfigured, and a monotonic `settings_revision`. |
235
240
|`GetSandboxProviderEnvironment`| Resolves provider credentials into environment variables for a sandbox. Iterates the sandbox's `spec.providers` list, fetches each `Provider`, and collects credential key-value pairs. First provider wins on duplicate keys. Skips credential keys that do not match `^[A-Za-z_][A-Za-z0-9_]*$`. |
236
241
237
242
#### Policy Recommendation (Network Rules)
@@ -242,9 +247,9 @@ These RPCs support the sandbox-initiated policy recommendation pipeline. The san
242
247
|-----|-------------|
243
248
|`SubmitPolicyAnalysis`| Receives pre-formed `PolicyChunk` proposals from a sandbox. Validates each chunk, persists via upsert on `(sandbox_id, host, port, binary)` dedup key, notifies watch bus. |
244
249
|`GetDraftPolicy`| Returns all draft chunks for a sandbox with current draft version. |
245
-
|`ApproveDraftChunk`| Approves a pending or rejected chunk. Merges the proposed rule into the active policy (appends binary to existing rule or inserts new rule). |
246
-
|`RejectDraftChunk`| Rejects a pending chunk or revokes an approved chunk. If revoking, removes the binary from the active policy rule. |
247
-
|`ApproveAllDraftChunks`| Bulk approves all pending chunks for a sandbox. |
250
+
|`ApproveDraftChunk`| Approves a pending or rejected chunk. Merges the proposed rule into the active policy (appends binary to existing rule or inserts new rule). **Blocked when a global policy is active** -- returns `FailedPrecondition`. |
251
+
|`RejectDraftChunk`| Rejects a pending chunk or revokes an approved chunk. If revoking, removes the binary from the active policy rule. Rejection of `pending` chunks is always allowed. **Revoking approved chunks is blocked when a global policy is active** -- returns `FailedPrecondition`. |
252
+
|`ApproveAllDraftChunks`| Bulk approves all pending chunks for a sandbox. **Blocked when a global policy is active** -- returns `FailedPrecondition`. |
248
253
|`EditDraftChunk`| Updates the proposed rule on a pending chunk. |
249
254
|`GetDraftHistory`| Returns all chunks (including rejected) for audit trail. |
250
255
@@ -457,12 +462,16 @@ Objects are identified by `(object_type, id)` with a unique constraint on `(obje
457
462
458
463
### Object Types
459
464
460
-
| Object type string | Proto message | Traits implemented |
The `sandbox_policies` table stores versioned policy revisions for both sandbox-scoped and global policies. Global revisions use the sentinel `sandbox_id = "__global__"`. See [Gateway Settings Channel](gateway-settings.md#storage-model) for schema details.
466
475
467
476
### Generic Protobuf Codec
468
477
@@ -559,6 +568,7 @@ Updated by the sandbox watcher on every Applied event and by gRPC handlers durin
559
568
## Cross-References
560
569
561
570
-[Sandbox Architecture](sandbox.md) -- sandbox-side policy enforcement, proxy, and isolation details
0 commit comments