-
Notifications
You must be signed in to change notification settings - Fork 4
feat: wire snapshot TakeExternalSnapshot to Core endpoint #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ import ( | |
| "time" | ||
|
|
||
| "github.com/easy-cloud-Knet/KWS_Control/client" | ||
| "github.com/easy-cloud-Knet/KWS_Control/client/model" | ||
| vms "github.com/easy-cloud-Knet/KWS_Control/structure" | ||
| ) | ||
|
|
||
|
|
@@ -52,9 +53,13 @@ func TakeSnapshot(uuid vms.UUID, snapName string, ctx *vms.ControlContext) error | |
| return fmt.Errorf("TakeSnapshot %s: failed to generate presigned URL: %w", uuid, err) | ||
| } | ||
|
|
||
| // TODO: coreClient.TakeSnapshot(context.Background(), model.TakeSnapshotRequest{ | ||
| // UUID: uuid, SnapKey: snapName, PresignedURL: presignedURL, | ||
| // }) | ||
| _ = presignedURL | ||
| coreClient := client.NewCoreClient(core) | ||
| if _, err := coreClient.TakeExternalSnapshot(context.Background(), model.TakeSnapshotRequest{ | ||
| UUID: uuid, | ||
| SnapKey: snapName, | ||
| PresignedURL: presignedURL, | ||
| }); err != nil { | ||
| return fmt.Errorf("TakeSnapshot %s: core failed: %w", uuid, err) | ||
| } | ||
|
Comment on lines
+56
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift Propagate the caller context into the Core snapshot call. This new 12-minute request is issued with 🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. code rabbit이 말해준 영역이긴 하지만 Timeout 설정을 Background context에서 수행하는 방식보다는 timeout context를 사용하는 것이 나을것으로 보이긴 합니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
즉, 이상적인 형태는:
이렇게 하면:
반대로 (•ᴗ•)◞🐇 ✏️ Learnings added
|
||
| return nil | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Redact the presigned URL before this request goes through
doRequest.model.TakeSnapshotRequestincludesPresignedURL, anddoRequestlogs the full JSON body atclient/vm.goLine 41. This new path would write a live upload credential into logs for every snapshot request unless that body logging is skipped or redacted first.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12분 정도의 긴 Timeout 방식보다 webhook 방식이 연결 자원 점유 문제나 디버깅 상태 확인 그리고 안정성에서는 더 나은 해결책이 될 수 있을 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ukleon123맞습니다. 장기적으로는 webhook/async 방식이 말씀하신 것처럼 연결 자원 점유, 진행 상태 확인, 재시도/복구 측면에서 더 나은 방향으로 보입니다.다만 이번 코멘트의 핵심은 timeout 전략과는 별개로, 현재 구현에서는
model.TakeSnapshotRequest.PresignedURL이client/vm.goLine 41의 request-body 로그에 그대로 남는 점입니다. 그래서 지금 구조를 유지하더라도 이 값은 마스킹하거나 로그에서 제외하는 처리가 필요합니다.즉:
TakeExternalSnapshot경로에서PresignedURL로그 유출 방지원하시면 webhook 전환은 후속 이슈로 분리하고, 이 PR에서는 먼저 presigned URL 로깅만 막는 방향으로 보는 게 좋겠습니다.