feat(api): publish restore outcome classifier - #130
Conversation
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughThe API now defines shared restore outcomes and classifies Pod conditions. The restore controller uses these outcomes and shared reason constants. Controller tests validate terminal detection and exported constants. ChangesRestore outcome handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This PR publishes explicit restore outcome classifications and updates the node agent to recognize terminal outcomes without defaulting unknown values to Pending; no actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant RestoreController
participant ClassifyRestoreOutcome
participant RestoredPodConditions
RestoreController->>ClassifyRestoreOutcome: classify conditions
ClassifyRestoreOutcome->>RestoredPodConditions: scan Restored condition
RestoredPodConditions-->>ClassifyRestoreOutcome: status and reason
ClassifyRestoreOutcome-->>RestoreController: RestoreOutcome
🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (6 passed)
Full details: Breaking Api ChangesExplanation PASS. The PR API diff adds only Full details: Rbac Least PrivilegeExplanation PASS: The pull request changes only restore API and controller code. It does not add or modify kubebuilder RBAC markers or Helm RBAC manifests. Repository inspection found no wildcard
Comment |
galletas1712
left a comment
There was a problem hiding this comment.
One thing to watch for when later PRs land — details on the classifier below.
| return RestoreOutcomeFailed | ||
| case RestoreReasonPartiallySucceeded: | ||
| return RestoreOutcomePartiallySucceeded | ||
| default: |
There was a problem hiding this comment.
Right now, any reason this function doesn't recognize is treated as "restore is still in progress." That's fine for "we're waiting for the snapshot."
There's a draft PR (#97) that will add a new final reason: RestoreIncompatible. That means the node looked at the checkpoint and said no. This code would call that "still in progress," and Dynamo would wait forever instead of starting a new Pod.
You don't have to change this PR for that. When #97 lands, add a case for RestoreIncompatible. A test that goes through every RestoreReason* and checks the finished ones aren't reported as Pending would keep this from happening again.
There was a problem hiding this comment.
Agreed. #130 intentionally classifies only the public reasons that exist today. I am leaving it unchanged as suggested; when #97 lands, RestoreIncompatible should be added to the terminal classifier together with an exhaustive test over every exported RestoreReason* constant, so a new terminal outcome cannot silently fall back to Pending.
There was a problem hiding this comment.
I have issue with defaulting to Pending, as it might forgot by other ppl. better to have unkown rather a wrong status. if you really need it you can add it to dynamo and not here
There was a problem hiding this comment.
Agreed and fixed in 32cb9ce. The public classifier now returns a distinct RestoreOutcomeUnknown for any unrecognized condition status or reason, so it no longer asserts Pending when this API version cannot know. Missing conditions and explicit RestoreInProgress remain Pending. The agent's terminal check now matches only Succeeded, Failed, and PartiallySucceeded; Unknown is not implicitly treated as terminal. Tests cover both an unrecognized dependency reason and the future-terminal RestoreIncompatible example.
Ronkahn21
left a comment
There was a problem hiding this comment.
I have issue to default on restore pending as this is might not true, I raher say I dont know to say it pending
Signed-off-by: Julien Mancuso <jmancuso@nvidia.com>
Summary
Unknown,Pending,Succeeded,Failed, andPartiallySucceededrestore outcomesnvidia.com/RestoredPod condition without defaulting unrecognized statuses or reasons toPendingPart of ai-dynamo/dynamo#13919.
Validation
GOCACHE=/private/tmp/snapshot-outcomes-go-cache go test ./...inapi/make linux-test(all agent packages)agent/internal/controllermake lintcould not run locally because the installed golangci-lint binary was built with Go 1.24, below this repository's Go 1.26.6 module version.Summary by CodeRabbit
New Features
Bug Fixes