feat(amdsev): derive enclave metrics port forward from --katana-args - #629
Merged
Conversation
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>
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
Makes the TEE enclave serve Prometheus metrics by default and forwards the port to the host — with the forward derived from
--katana-argsrather than hardcoded/injected instart-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-argsincludes 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_portfunction. Addedscripts/test-parse-metrics-port.sh— a fast, no-QEMU unit test using the repo's existing extract-and-source pattern (mirrorstest-strip-reserved-args.sh), covering the word/=forms, absent metrics, a trailing--metrics.portwith no value, duplicates (last wins), and a glob-adjacent value. Wired into theamdsev-lintCI job. A silent break here would drop the enclave's/metricsendpoint 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 warningclean (start-vm.sh + the test)test-parse-metrics-port.sh— all 8 assertions passamdsev-lintworkflow: actionlint clean🤖 Generated with Claude Code