feat(operator): create Snapshot from DynamoCheckpoint controller#2
Merged
Merged
Conversation
Once the checkpoint Job's source pod exists, the DynamoCheckpoint controller creates a Snapshot (nvidia.com/v1alpha1) owned by the checkpoint via Server-Side Apply, naming it snapshot-<checkpointID> and referencing the source pod. Snapshot creation is a required step of the new capture path: a terminal error fails the checkpoint, a transient one requeues, and the checkpoint cannot reach Ready without it. Source pod is found by Job ownership. RBAC for snapshots added to the operator role (kustomize + helm). Restore path and the Job/Lease flow are unchanged. Signed-off-by: Ron Kahn <rkahn@nvidia.com>
Ronkahn21
commented
Jun 10, 2026
Ronkahn21
commented
Jun 10, 2026
Address PR review: add controller_common.IgnoreIntermediateError (err for terminal API errors, nil for transient) mirroring client.IgnoreNotFound; remove failOrRequeueSnapshot and inline the terminal/transient decision in handleCreating with a focused updateFailedStatus helper (no encapsulated status update); move the checkpoint UID validation out of ensureSnapshot to handleCreating; emit a SnapshotCreateFailed event at the point of failure in ensureSnapshot; add a podNameFromJob test helper. Signed-off-by: Ron Kahn <rkahn@nvidia.com>
Ronkahn21
commented
Jun 11, 2026
Ronkahn21
commented
Jun 11, 2026
Address PR review: split ensureSnapshot into findOwnedSnapshot / buildSnapshot / applySnapshot helpers with a thin orchestrator; remove the ckpt.UID guard in handleCreating (a checkpoint from the API server always has a UID, so the case cannot happen). Signed-off-by: Ron Kahn <rkahn@nvidia.com>
Ronkahn21
added a commit
that referenced
this pull request
Jun 11, 2026
Ronkahn21
added a commit
that referenced
this pull request
Jun 22, 2026
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.
Overview:
Component B of the DynamoCheckpoint → Snapshot/SnapshotContent migration. The DynamoCheckpoint controller now creates a
Snapshot(the Component A CRD) for each checkpoint, once the source pod exists. This is the new authoritative capture record — required, not best-effort. The existing Job/Lease/agent flow and the restore path are unchanged.Internal staging PR into the base branch
feat/snapshot-crd.Details:
handleCreating(after the Job is fetched, before the Lease/observation): find the Job's source pod, then create theSnapshot.findSourcePod— selects the pod by Job ownership (batchv1.JobNameLabel+metav1.IsControlledBy); returns a standard NotFound when the pod isn't created yet, so the callerclient.IgnoreNotFounds and requeues.ensureSnapshot— if a Snapshot already exists and is owned by this checkpoint, no-op; otherwise create it via Server-Side Apply (client.Apply+ field owner + force-ownership) with theDynamoCheckpointas controller owner. Namedsnapshot-<checkpointID>,spec.checkpointID+spec.source.podRef.nameset. Empty-UID guard. A foreign-owned name collision returnsForbidden(terminal).IsInvalid/IsBadRequest/IsForbidden) fails the checkpoint (Phase=Failed,SnapshotCreateFailed); transient requeues. The checkpoint cannot reachReadywithout its Snapshot.snapshotsadded to the operator's combinednvidia.comrule inconfig/rbac/role.yamland the helmmanager-rbac.yaml(no kubebuilder markers).Verification (in-sandbox):
go build ./...,go vet, fake-client tests pass (TestFindSourcePod*,TestEnsureSnapshot*,TestFailOrRequeueSnapshot*, and the existingHandleCreating/Reconcile/FinalizeResourcesuites updated to seed the Job-owned pod). CodeRabbit: no findings.Where should the reviewer start?
deploy/operator/internal/controller/checkpoint_snapshot.godeploy/operator/internal/controller/dynamocheckpoint_controller.go(the new block inhandleCreating)Related Issues
🚫 This PR is NOT linked to an issue: