Skip to content

feat(amdsev): derive enclave metrics port forward from --katana-args - #629

Merged
kariy merged 2 commits into
mainfrom
feat/amdsev-metrics-port-forward
Jul 6, 2026
Merged

feat(amdsev): derive enclave metrics port forward from --katana-args#629
kariy merged 2 commits into
mainfrom
feat/amdsev-metrics-port-forward

Conversation

@kariy

@kariy kariy commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary

Makes the TEE enclave serve Prometheus metrics by default and forwards the port to the host — with the forward derived from --katana-args rather than hardcoded/injected in start-vm.sh. The Katana CLI args are the single source of truth: if they carry --metrics.port PORT, start-vm forwards that guest port to the same host port; drop it to skip the forward. The default --katana-args includes the metrics flags, so a bare invocation still serves + forwards metrics.

Also makes the RPC host port configurable (--rpc-host-port / HOST_RPC_PORT).

None of this affects the SEV-SNP launch measurement — Katana args ride fw_cfg (unmeasured) and port forwards are host networking.

Regression test

The derivation is done by a new parse_metrics_port function. Added scripts/test-parse-metrics-port.sh — a fast, no-QEMU unit test using the repo's existing extract-and-source pattern (mirrors test-strip-reserved-args.sh), covering the word/= forms, absent metrics, a trailing --metrics.port with no value, duplicates (last wins), and a glob-adjacent value. Wired into the amdsev-lint CI job. A silent break here would drop the enclave's /metrics endpoint with no other signal.

Context

Validated live during metrics bring-up: a real SEV-SNP enclave settling to Sepolia via SP1 exposed katana_settlement_sp1_proof_* on the forwarded port. This makes that wiring first-class and configurable via the args.

Checks

  • bash -n + shellcheck -S warning clean (start-vm.sh + the test)
  • test-parse-metrics-port.sh — all 8 assertions pass
  • amdsev-lint workflow: actionlint clean

🤖 Generated with Claude Code

kariy and others added 2 commits July 6, 2026 19:10
start-vm.sh now serves Prometheus metrics from the enclave by default and
forwards the port to the host — but the forward is driven entirely by the
Katana CLI args rather than hardcoded/injected: if --katana-args carries
--metrics.port PORT, start-vm forwards that guest port to the same host
port; drop it to skip the forward. The default --katana-args includes the
metrics flags, so a bare invocation still serves + forwards metrics.

The Katana args stay the single source of truth (no injection). Also makes
the RPC host port configurable via --rpc-host-port / HOST_RPC_PORT. None of
this affects the SEV-SNP launch measurement — args ride fw_cfg and port
forwards are host networking.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
parse_metrics_port is the single source of truth for whether/where the
enclave forwards its metrics port, derived from --katana-args. A silent
regression there drops the /metrics endpoint with no other signal.

Add a fast, no-QEMU unit test (same extract-and-source pattern as
test-strip-reserved-args.sh) covering the word and =-forms, absent
metrics, a trailing --metrics.port with no value, duplicates (last wins),
and a glob-adjacent value. Wired into the amdsev-lint CI job.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kariy
kariy merged commit 668fd88 into main Jul 6, 2026
4 checks passed
@kariy
kariy deleted the feat/amdsev-metrics-port-forward branch July 6, 2026 11:40
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