Skip to content

feat(egress): wire kernel drop telemetry into sidecars - #3125

Open
hpliStartAgain wants to merge 1 commit into
opensandbox-group:mainfrom
hpliStartAgain:feat/egress-drop-telemetry-sidecar
Open

hpliStartAgain wants to merge 1 commit into
opensandbox-group:mainfrom
hpliStartAgain:feat/egress-drop-telemetry-sidecar

Conversation

@hpliStartAgain

Copy link
Copy Markdown
Collaborator

Refs #3085

Part 2 of 3 of kernel drop telemetry. Part 1 (#3094) is merged; this PR is based on main and contains only the sidecar wiring.

This registers the drop instruments during egress metrics initialization and documents all three in the telemetry reference, including the disabled sampler gauge exported when drop telemetry is off. Measurements retain sandbox_id and configured extra metric attributes, with closed reason/cause labels. It wires the shared library into sidecar nftables and forward enforcement, adds explicit reason/protocol mappings and frozen off-mode rule snapshots, and records sampled blocked-IP audit events. Counter reads complete before remaining DNS leases are planned and are serialized through replacement submission; a slow read cannot restore an expired lease with a stale positive timeout. Existing drop matches and verdicts are retained; default-off runner scripts remain byte-for-byte unchanged.

The three telemetry inputs (mode, rate, and counter poll) are added to the lifecycle server egress allowlist, with both Docker and Kubernetes split/injection tests. Sidecars may enable counter or sample mode through request env. Sidecar usage and mechanism pages, including the nft -j and NFLOG requirements, are registered in the docs sidebar. Fast Sandbox remains unwired in this part and is added in PR1c.

Configuration has three environment inputs: OPENSANDBOX_EGRESS_DROP_TELEMETRY, OPENSANDBOX_EGRESS_DROP_LOG_RATE, and OPENSANDBOX_EGRESS_DROP_COUNTER_POLL. NFLOG group is fixed at 3085 per network namespace, and the per-rule burst is derived as clamp(2 × N, 1, 1000) from the rate count N; the default remains 40 and 1/day gives 2. Docker and Kubernetes tests also assert that the removed group/burst settings are outside the allowlist.

Validation: Go1.26.11 full gofmt/vet/build, affected packages pass normally and with -race. Linux private-netns library and sidecar ruleset tests pass with -race, including delete-only removal. Server: 397 tests pass and scoped ruff lint passes. Docs build succeeds. This part is +733/-7 across 25 files.

No new dependency beyond PR1a. Counters and samples remain best effort; kernel compatibility matrices, high-rate sample-loss behavior, production end-to-end behavior and an image build are not established by these checks. The library shutdown fallback limitations from PR1a remain applicable. Scan detection, quarantine and webhooks remain outside this stack.

Previously identified file-level overlap with still-open #3020: the egress workflow and privileged-runner tests, components/egress/main.go, pkg/telemetry/metrics.go, the VitePress config, egress architecture/telemetry pages, and the server constants/Docker/Kubernetes test files. No enforcement-anchor logic is included.

🤖 Generated with Claude Code

@github-actions github-actions Bot added component/egress component/server documentation Improvements or additions to documentation size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 26, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T06:15:23.123553Z 0b59abb PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/egress component/server documentation Improvements or additions to documentation size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant