Skip to content

Enhance scheduling to respect MachinePool Ready condition - #1536

Merged
lukasfrank merged 3 commits into
ironcore-dev:mainfrom
lukasfrank:enh/pool-scheduler
Aug 11, 2026
Merged

Enhance scheduling to respect MachinePool Ready condition#1536
lukasfrank merged 3 commits into
ironcore-dev:mainfrom
lukasfrank:enh/pool-scheduler

Conversation

@lukasfrank

@lukasfrank lukasfrank commented Aug 5, 2026

Copy link
Copy Markdown
Member

Proposed Changes

  • Enhance machine scheduling to respect MachinePool Ready condition
    • Skip pools which are not ready of if the condition is missing

Fixes #1531

Summary by CodeRabbit

  • Bug Fixes
    • Machines are now scheduled only to machine pools that report readiness.
    • Unready pools are excluded from scheduling until they become ready, even when capacity is available.
    • Scheduling resumes automatically once a pool reaches the ready state.

Signed-off-by: Lukas Frank <lukas.frank@sap.com>
@lukasfrank
lukasfrank requested a review from a team as a code owner August 5, 2026 08:28
@github-actions github-actions Bot added the enhancement New feature or request label Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 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 Plus

Run ID: 14e3cc7c-4d7f-478b-be43-0fad6064fdcf

📥 Commits

Reviewing files that changed from the base of the PR and between b728292 and 0d65d58.

📒 Files selected for processing (1)
  • internal/controllers/compute/machine_scheduler_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/controllers/compute/machine_scheduler_test.go

📝 Walkthrough

Walkthrough

The scheduler now filters out machine pools without MachinePoolReady=True before other scheduling checks. Tests mark existing pools ready and verify scheduling after readiness becomes true.

Changes

Machine pool readiness scheduling

Layer / File(s) Summary
Add readiness gating to pool selection
internal/controllers/compute/machine_scheduler.go
The scheduler adds a poolReady predicate. If a machine pool is not ready, it logs the reason and skips later pool checks.
Update scheduler tests for readiness
internal/controllers/compute/machine_scheduler_test.go
Tests mark existing fixtures ready and verify that pools without a ready condition, or with a false condition, are ignored until readiness becomes true.

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

Possibly related PRs

Suggested labels: area/iaas

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: scheduling now respects the MachinePool Ready condition.
Description check ✅ Passed The description includes the required Proposed Changes and Fixes sections and accurately summarizes the scheduling behavior.
Linked Issues check ✅ Passed The changes satisfy issue #1531 by preventing scheduling on MachinePools without a true MachinePoolReady condition.
Out of Scope Changes check ✅ Passed The implementation and tests are directly related to enforcing MachinePool readiness during scheduling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
internal/controllers/compute/machine_scheduler_test.go (1)

596-639: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for MachinePoolReady=False.

This test covers the missing-condition path only. Add a case with an existing MachinePoolReady condition whose status is corev1.ConditionFalse. Verify that the machine remains unscheduled until the condition becomes true.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/controllers/compute/machine_scheduler_test.go` around lines 596 -
639, Extend the test around the existing machine-pool readiness scenario to
initialize a MachinePoolReady condition with status corev1.ConditionFalse before
creating the machine. Verify the machine remains unscheduled while the condition
is false, then update that condition to true and preserve the existing assertion
that scheduling occurs only after the pool becomes ready.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@internal/controllers/compute/machine_scheduler_test.go`:
- Around line 596-639: Extend the test around the existing machine-pool
readiness scenario to initialize a MachinePoolReady condition with status
corev1.ConditionFalse before creating the machine. Verify the machine remains
unscheduled while the condition is false, then update that condition to true and
preserve the existing assertion that scheduling occurs only after the pool
becomes ready.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5ce1eda7-19a1-41e6-9f37-797244a3f897

📥 Commits

Reviewing files that changed from the base of the PR and between d4dab32 and 388293c.

📒 Files selected for processing (2)
  • internal/controllers/compute/machine_scheduler.go
  • internal/controllers/compute/machine_scheduler_test.go

Signed-off-by: Lukas Frank <lukas.frank@sap.com>
@lukasfrank lukasfrank self-assigned this Aug 5, 2026
@afritzler

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@gonzolino gonzolino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, one minor nit regarding the test description after adding the second test case.

Comment thread internal/controllers/compute/machine_scheduler_test.go Outdated
Signed-off-by: Lukas Frank <lukas.frank@sap.com>
@lukasfrank
lukasfrank merged commit 4ba5a42 into ironcore-dev:main Aug 11, 2026
11 checks passed
@lukasfrank
lukasfrank deleted the enh/pool-scheduler branch August 11, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't schedule on an unhealthy MachinePool

3 participants