Skip to content

fix: Don't process the DPU CR which is being deleted#4125

Merged
abvarshney-nv merged 1 commit into
NVIDIA:mainfrom
abvarshney-nv:dpu_cr_deletion
Jul 24, 2026
Merged

fix: Don't process the DPU CR which is being deleted#4125
abvarshney-nv merged 1 commit into
NVIDIA:mainfrom
abvarshney-nv:dpu_cr_deletion

Conversation

@abvarshney-nv

@abvarshney-nv abvarshney-nv commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

When reprovisioning a DPU, reprovision_dpu deletes the DPU CR, but the DPF operator's finalizer keeps the old CR around briefly with a deletionTimestamp and a stale status.phase (specially Ready or Error). On the immediate requeue into WaitingForReady, NICO read that stale Ready/Error and jumped straight to next state — so reprovisioning was never actually observed.

get_dpu_phase now maps a set deletionTimestamp to DpuPhase::Deleting, and handle_dpf_waiting_for_ready short-circuits to a wait on Deleting (and on NotFound, the brief gap before the fresh CR is created) before any side-effecting calls. NICO now waits for the operator to delete the old CR and create the new one, then proceeds only when that fresh CR reports Ready.

Related issues

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No testing required (docs, internal refactor, etc.)

Additional Notes

@abvarshney-nv
abvarshney-nv requested a review from a team as a code owner July 24, 2026 18:54
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3599a359-d096-4bf5-b44c-7d19b84aced1

📥 Commits

Reviewing files that changed from the base of the PR and between bae23dd and a69e4a2.

📒 Files selected for processing (3)
  • crates/api-core/src/tests/dpf/waiting_for_ready.rs
  • crates/dpf/src/sdk.rs
  • crates/machine-controller/src/handler/dpf.rs

Summary by CodeRabbit

  • Bug Fixes
    • Improved reprovisioning behavior while a device resource is being deleted or recreated.
    • Prevented premature transitions to device-ready status during resource deletion.
    • Added safe waiting when the device resource is temporarily unavailable.
    • Ensured maintenance holds and reboot-related actions remain in place until a fresh device reports ready.
    • Improved handling of terminating resources that still report a ready status.

Walkthrough

The DPF SDK now identifies terminating DPU resources as Deleting. The machine-controller preserves WaitingForReady during deleting and not-found windows, with regression tests covering reprovision transitions back to Ready.

Changes

DPF reprovision readiness

Layer / File(s) Summary
DPU phase detection contract
crates/dpf/src/sdk.rs
get_dpu_phase returns DpuPhase::Deleting when metadata.deletion_timestamp is set, including when status.phase remains Ready; a unit test covers this behavior.
WaitingForReady reprovision flow
crates/machine-controller/src/handler/dpf.rs, crates/api-core/src/tests/dpf/waiting_for_ready.rs
NotFound and Deleting phases now keep the handler waiting, while regression tests verify continued waiting until a fresh DPU reports Ready.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant WaitingForReady
  participant get_dpu_phase
  participant DPU_CR
  WaitingForReady->>get_dpu_phase: Read current DPU phase
  get_dpu_phase->>DPU_CR: Inspect DPU resource
  DPU_CR-->>get_dpu_phase: Deleting, NotFound, or Ready
  get_dpu_phase-->>WaitingForReady: Return phase or not-found error
  WaitingForReady-->>WaitingForReady: Wait during Deleting or NotFound
  WaitingForReady-->>WaitingForReady: Continue after Ready
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main fix: skipping deleted DPU CRs during reprovisioning.
Description check ✅ Passed The description matches the change set and explains the stale/terminating DPU CR reprovisioning fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@abvarshney-nv
abvarshney-nv enabled auto-merge (squash) July 24, 2026 19:03
@abvarshney-nv
abvarshney-nv merged commit a991005 into NVIDIA:main Jul 24, 2026
61 of 62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants