cubeapi/cubemaster: normalize host mount annotations#117
Conversation
|
/cubebot review this pr. |
|
Claude finished @chenhengqi's task in 1m 38s —— View job PR Review: Normalize host mount annotations
Overall AssessmentThis is a clean, well-scoped PR that adds backward compatibility for the legacy What works well
Issues and suggestions1. Stale comment: wrong file path reference (pre-existing, but worth fixing)
// CreateSandboxRequest; see CubeAPI/src/handlers/sandboxes.rsshould be: // CreateSandboxRequest; see CubeAPI/src/services/sandboxes.rs2. Missing test: The two new Rust tests cover the canonical and legacy key paths, but there's no test for:
These are low-risk edge cases since the function handles them correctly, but a brief test would document the expected behavior. 3. Missing test: no-annotation and empty-annotation cases (CubeMaster) The Go test file covers the happy paths (canonical key, legacy key, both keys), but doesn't test:
Again, low risk but would improve coverage of the fallback logic this PR introduces. 4. Minor: CubeMaster fallback log message could be more helpful
log.G(ctx).Infof("[hostdir] annotation %q/%q absent or empty, skip", AnnotationHostDirMount, AnnotationHostDirMountLegacy)This is fine, but consider logging at debug level instead of info — this will fire on every sandbox creation that doesn't use host mounts, which could be noisy. 5. Nit: CubeAPI constant naming The constant SummaryThe core logic is correct and well-tested. The main actionable item is fixing the stale file path in the comment (issue #1). The rest are suggestions for improved test coverage and minor polish. |
Signed-off-by: wangjiehy <wangjiehy@cmhi.chinamobile.com>
Signed-off-by: wangjiehy <wangjiehy@cmhi.chinamobile.com>
fdf84f3 to
b735e7e
Compare
| // host-mount requests are silently dropped. | ||
| AnnotationHostDirMount = "host-mount" | ||
| AnnotationHostDirMount = "host-mount" | ||
| AnnotationHostDirMountLegacy = "hostdir-mount" |
There was a problem hiding this comment.
What's the purpose of this change? Where does this legacy annotation come from?
| // host-mount requests are silently dropped. | ||
| AnnotationHostDirMount = "host-mount" | ||
| AnnotationHostDirMount = "host-mount" | ||
| AnnotationHostDirMountLegacy = "hostdir-mount" |
Summary
host-mountas the canonical annotation used between CubeAPI and CubeMasterhostdir-mountmetadata/annotations for compatibilityTests
go test ./pkg/service/sandbox -run HostDirMount -count=1cargo test --manifest-path CubeAPI/Cargo.toml split_metadata -- --nocapture(blocked locally: crates.io timed out while downloadingutoipa)Notes
TencentCloud/CubeSandbox@master.CONTRIBUTING.md, AI-generated commits do not addSigned-off-bylines. The human contributor should add DCO sign-offs before merge if required by CI.