fix(sandbox): resolve short sandbox ID prefixes consistently#697
Open
xiaojunxiang2023 wants to merge 2 commits into
Open
fix(sandbox): resolve short sandbox ID prefixes consistently#697xiaojunxiang2023 wants to merge 2 commits into
xiaojunxiang2023 wants to merge 2 commits into
Conversation
Accept unique short prefixes for sandbox operations across CubeMaster, Cubelet store lookups, and cubecli/cubemastercli commands while keeping list display truncation unchanged. Signed-off-by: xiaojunxiang <xiaojunxiang@kingsoft.com>
Remove full-ID passthrough without candidates, add Store.Get fast-path for 32-char IDs, log cluster collect failures, split cache side effects, and cap concurrent node queries. Signed-off-by: xiaojunxiang <xiaojunxiang@kingsoft.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
Sandbox IDs are 32-character lowercase hex strings (UUID without dashes).
cubecli lstruncates them to 12 characters for display, but several APIs and CLIs previously required the full ID or used naivestrings.HasPrefixmatching without ambiguity checks.This PR adds a shared sandbox ID resolver and wires it through CubeMaster, Cubelet, and CLI entry points so that:
--no-truncstill shows the full ID)Core resolver (
sandboxid.Resolve)ambiguous sandbox id prefixsandbox id not foundChanges by component
CubeMaster
pkg/sandboxid/with table-driven unit testsResolveSandboxID()inpkg/service/sandbox/:localcache.ListKnownSandboxIDs()SandboxInfo,DestroySandbox,Exec,Update,SetTimeout,Refreshcubemastercli list --sandboxidfilter uses prefix resolutionCubelet
pkg/sandboxid/(same logic, separate module)pkg/store/cubebox.Store.Get()resolves short/full IDs before indexer lookupListfilter byidbenefits automatically viaGet()cubecli
destroyandinspect/info(metadata) use resolver instead of rawHasPrefixOut of scope (unchanged)
cubecli lsdefault 12-char display truncationCompleteShortIdpath unchanged)Motivation
Users often copy the truncated ID from
cubecli lsand then fail oncubemastercli sandbox info -s <prefix>orcubecli destroy <prefix>. This aligns behavior with the common expectation: show short, accept short when unique.Example: