Skip to content

Fix stuck Machine if Prefix is referenced#1502

Merged
lukasfrank merged 1 commit into
mainfrom
fix/watch-setup
Jul 3, 2026
Merged

Fix stuck Machine if Prefix is referenced#1502
lukasfrank merged 1 commit into
mainfrom
fix/watch-setup

Conversation

@lukasfrank

@lukasfrank lukasfrank commented Jul 3, 2026

Copy link
Copy Markdown
Member

Proposed Changes

  • Added Prefix watch that a Machine gets triggered once its status flips to Allocated

Fixes #1501

Summary by CodeRabbit

  • New Features

    • Machines now automatically refresh when related network prefix IPs change, helping allocation updates flow through more quickly.
    • Ephemeral prefix-based network interfaces are now recognized during machine creation once an IP becomes allocated.
  • Bug Fixes

    • Improved handling of machines that were waiting on prefix allocation, reducing cases where machine setup could stall without creating the expected instance.

…flips to `Allocated`

Signed-off-by: Lukas Frank <lukas.frank@sap.com>
@lukasfrank lukasfrank self-assigned this Jul 3, 2026
@lukasfrank
lukasfrank requested a review from a team July 3, 2026 11:57
@github-actions github-actions Bot added size/L bug Something isn't working labels Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 764d8450-bde9-4af4-bb38-7c530b95c564

📥 Commits

Reviewing files that changed from the base of the PR and between fd1f73f and 009333d.

📒 Files selected for processing (2)
  • poollet/machinepoollet/controllers/machine_controller.go
  • poollet/machinepoollet/controllers/machine_controller_test.go

📝 Walkthrough

Walkthrough

The machine controller now watches IPAM Prefix resources and enqueues reconcile requests for Machines referencing the owning NetworkInterface when a Prefix changes. A new test validates that a Machine blocked by an unallocated ephemeral prefix reconciles and creates an IRI Machine once the Prefix becomes Allocated.

Changes

Prefix watch and reconciliation

Layer / File(s) Summary
Prefix event handler and watch registration
poollet/machinepoollet/controllers/machine_controller.go
Adds an enqueueMachinesReferencingPrefix handler that maps Prefix events to Machine reconcile requests based on NetworkInterface ownership, and registers a watch on ipamv1alpha1.Prefix in SetupWithManager.
Test for ephemeral prefix allocation flow
poollet/machinepoollet/controllers/machine_controller_test.go
Adds a test creating a Machine with an ephemeral prefix NIC, verifying it remains blocked until the Prefix is allocated, then confirming the IRI Machine is created with an allocated IP once Prefix status becomes Allocated.

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PrefixController
  participant MachineController
  participant K8sAPI
  participant IRI

  PrefixController->>K8sAPI: Update Prefix status to Allocated
  K8sAPI-->>MachineController: Prefix update event
  MachineController->>MachineController: enqueueMachinesReferencingPrefix
  MachineController->>K8sAPI: List Machines by NetworkInterfaceNamesField
  K8sAPI-->>MachineController: MachineList
  MachineController->>MachineController: Enqueue reconcile requests
  MachineController->>IRI: Create Machine with allocated IP NIC
Loading

Related Issues: #1501

Suggested labels: bug, machinepoollet

Suggested reviewers: ironcore-dev/machinepoollet-maintainers

🐰 A prefix once stuck, now allocates free,
The controller watches with new-found glee,
Machines that waited, no longer confined,
Reconciled swiftly, an IP now assigned. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing a stuck Machine when a Prefix is referenced.
Description check ✅ Passed The description provides required information but is minimalist, covering the key change (Prefix watch) and the issue reference without elaborating on context.
Linked Issues check ✅ Passed The PR successfully addresses issue #1501 by adding a Prefix watch that triggers Machine reconciliation when Prefix status changes to Allocated, preventing Machines from becoming stuck.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the reported issue: the Prefix watch handler, event wiring, and corresponding tests are all necessary for the fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/watch-setup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@lukasfrank
lukasfrank merged commit 8be9150 into main Jul 3, 2026
14 checks passed
@lukasfrank
lukasfrank deleted the fix/watch-setup branch July 3, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Machines are stuck if ephemeral prefixTemplate is defined

2 participants