Repository navigation
Conversation
4f9828e to
bd6087f
Compare
On a cluster with a few hundred app versions, the v0.17.2 CLI takes about 10s to list pools because it resolves the runtime config of every app version from the client. Main already moved that work behind the SandboxPools RPC, but the server still made three serial store calls per pool. Resolve each version once and read concurrency from the stored config: addon bindings only supply variables and disks, so resolving them cost a round trip and loaded credentials without changing the scaling mode. The list also gains --app and --service filters, matching `sandbox list`, and an APP column so pools without a version or service are identifiable (MIR-1361). Addon pools have no owner field, only an app label, so the RPC now reports that label as their app and its app filter matches the reported name. Labels are not indexed, which means a filtered list walks every pool, but it skips version lookups for excluded pools. The label grants nothing: it is read after authorization, and app-bound callers still cannot see unowned pools. The pool command tests now drive the commands through RunCommand instead of restating each command's option struct, tags included, so adding a flag no longer breaks them.
bd6087f to
f381862
Compare
There was a problem hiding this comment.
🍪 biscuit: ✅ ready to merge — auto-review, non-blocking
Approval recommended, not submitted: this repository is not enabled for autonomous approvals. This review is a comment, not a GitHub approval.
Nothing of substance has changed since my last review, and I still recommend approval. The branch is now a single commit, f381862, with the same content I reviewed at bd6087f. In servers/sandbox/pools.go:
filterInventoryAppstill runs against each pool's real owner before theapplabel is read.- The label is used only to display ownerless pools and to match them against the app filter.
poolVersionreads concurrency throughcoreutil.ResolveConfig. That's safe for MODE becauseResolveAddonConfigonly touchesVariablesand serviceDisks.TestPoolInventoryAddonPoolAppstill pins the deny case for app-bound callers, andTestSandboxPoolListFiltersstill runs an addon pool through the real CLI flags.
There are no new comments or threads, and evanphx has approved this head.
Who sees addon pools under --app shop. Only cluster admins see shop's database pool there. A caller who owns shop but isn't a cluster admin still won't see it, because ownerless pools need admin rights. That matches what this code did before, so it isn't a regression. I'm mentioning it in case someone reads the description as "app owners now see their addon pools."
Older servers. On servers without the RPC, the legacy fallback filters --app client-side against pool.App(). That path never reads the label, so addon pools there still show - and drop out of a filtered listing. This only affects servers that predate the RPC, so I don't think it needs to block.
Why I'd skip another human pass: the only security-relevant change is moving authorization from a single upfront check to a per-pool check, and that check still runs before any label is read. A test covers the case where an app-bound caller must be denied. Everything else is a contained CLI and inventory change, and each new behavior has its own test.
🍪 full review note · reviewed at f381862
Listing sandbox pools takes about 10 seconds on a cluster with a few hundred app versions. Most of that is the released CLI, which resolves every app version's config from the client just to fill in the MODE column. Main already fixed the big part by moving the work behind the SandboxPools RPC, so the next release gets it for free. That path still made three store calls per pool in sequence, though, which takes it to about 0.8s against the same cluster.
This trims the server side. Each version is now resolved once, no matter how many pools share it. Scaling mode now comes from the stored config, since addon bindings only add variables and disks. That drops a round trip per pool, and inventory no longer loads addon credentials it was never going to show.
debug sandbox-pool listalso gets--appand--servicefilters, matchingsandbox list, plus an APP column. Addon pools have no owner field, only anapplabel, so they used to show up blank. The RPC now reports that label as their app and itsappfilter matches the reported name, so--app shopincludes shop's database pool. The label is read after authorization and grants nothing.--servicefilters client-side.Adding flags broke the pool CLI tests even though nothing they check changed, because they restated each command's option struct, tags and all. They now go through
RunCommandwith real flags. MIR-2193 tracks the same cleanup in the other test files.Closes MIR-2191
Closes MIR-1361