vxpu: adopt gke-labs-infra/options for CLI flags and env config #1108
<!-- kube-agents-bot:intro -->
Hello, I'm kube-agents-bot 👋 I read
pull requests here and flag what looks wrong. I've started on this one — I'll post my
findings in a few minutes, or tell you I found none.
| Command | What it does |
| --- | --- |
| /review | The strict read of the current commit: what I'm certain of, plus a high-severity finding just under that bar, marked as such. |
| /review all | The same read, kept wider — findings I checked and believe are real as well as the ones I'm certain of. This is what my first review of a pull request does. |
| /review fresh | Reads the commit again from scratch. Without it, a command on a commit I have already read re-cuts that read at the bar you asked for instead of reading again — same findings, other bar, no cost — and says so. |
Comment any of them on a line of its own. Repository owners, members and collaborators only.
Worth knowing:
review. Pushing more commits does _not_ start a new review — comment
/review whenyou want another look, or
/review all for one as wide as the first. The oneexception: if I said the branch doesn't merge, I'll start on my own after your next push.
clean gets a short "no findings" note rather than silence, saying how I read the change
and how many possible issues I checked on the way. The 👀 means I've started; a comment
from me means I've finished. If you get 👀 and nothing follows, I broke.
own configuration asks me to, and otherwise I am not a required approval.
stale — are folded into a collapsed list in my summary, not posted as findings, and
don't count against the review. Whether to act on them is your call; nothing waits on
them.
written down and pointed me at, and with the review method it has nominated, if it
has one. Whether a feature or a design should exist at all is
a human's call — a review from me saying nothing about that is not an endorsement.
agent:ignore and I will leave it alone entirely, /reviewincluded.
No findings. I read this change three ways and checked 2 possible issues against the code; none cleared the bar.
_This was a wider pass: as well as what I am certain of, it includes findings I checked and believe are real without being sure. Comment /review for a stricter re-read._
---
Automated review by kube-agents-bot ec8b09e on kube-agents-bot-gke.
Triggered by this pull request being opened; read d813314 as merged into main.
<sub>React 👍 if this was useful, 👎 if it was not. Add the agent:ignore label to opt this pull request out.</sub>
(Automatic review) on d813314a99dc6d4dbf5df24b318853dfdb1dfdbf: the code looks clean and the only CI failure (test-vxpu-gpu (python)) was a Spot preemption, but this branch now has merge conflicts with main. Please rebase onto main, resolve the conflicts, and re-verify with ap generate, ap lint, and ap test.
(Automatic review) Approved on d46b62c7bdb827dc85b7114d6799fd22538f2fac. All checks pass (note: test-vxpu-gpu (go-router) was rerun after an unrelated TestSeparateDraftSpeculationOverGRPC segfault flake and a Spot preemption, then passed).
follow-on: I'm not sure these tests are valuable. See the tests section of here, for example: https://raw.githubusercontent.com/gke-labs/eval-runner/refs/heads/main/AGENTS.md
justinsb
codebot-robot
vxpu/options: wrap gke-labs-infra/options with VXPU_ default prefix
Add
github.com/gke-labs/gke-labs-infra/optionstovxpu/go.modand exposeit through a thin local wrapper in
vxpu/pkg/optionswithDefaultEnvPrefix = "VXPU_".The wrapper re-exports
Defaulter,ResolveOption,InitDefaults,BindFlags,LoadEnv,LoadEnvFrom,LoadMap,UnknownMapKeys, and theResolveOptionbuilders, and prependsWithEnvPrefix(DefaultEnvPrefix)inResolveandParseso vXPU binaries inheritVXPU_environment loadingwhile allowing
WithEnvPrefixoverrides orWithoutEnv.vxpu/machines: add composable HardwarePricingOptions using vxpu/pkg/options
Add
InitDefaultsandValidatemethods toPricingOptionsand introduce acomposable
HardwarePricingOptionsstruct (HardwareLifetimeYearsandElectricityUSDPerKWH) that binds cleanly to--hardware-lifetime-years,--electricity-usd-per-kwh,VXPU_HARDWARE_LIFETIME_YEARS, andVXPU_ELECTRICITY_USD_PER_KWHthroughvxpu/pkg/options.Back
ParsePricingOptionsandResolvePricingOptionswithHardwarePricingOptionsandoptions.Resolvewhile preserving existingcallers and backwards-compatible empty-env handling.
vxpu/router: parse CLI flags and VXPU_ env vars with vxpu/pkg/options
Replace hand-rolled flag registration,
flag.Visitprecedence tracking,and
os.Getenvfallbacks invxpu/cmd/vxpu-router/main.gowith acomposable
routerOptionsstruct embeddingmachines.HardwarePricingOptionsand parsed viavxpu/pkg/options.Parse.Use a
WithLookupEnvwrapper to preserve existingVXPU_environmentvariable names whose flag names differ from their env names
(
VXPU_EXECUTOR_IMAGE,VXPU_MODELSTORE_URL, andVXPU_EXTERNAL_EXECUTORS)and treat empty or whitespace-only environment values from manifests
such as
router.yamlas unset.Add behavioral tests covering defaults,
VXPU_environment variables,explicit CLI flag precedence (including flags equal to defaults), empty
env fallbacks, klog flag coexistence, and validation errors.
Verified with
ap generate --verify //...,ap lint //..., andap test //....Fixes #1107