Skip to content

Conversation

@magnusmeng
Copy link

Issue #, if available:
No issue raised

Description of changes:
This PR fixes a scheduling imbalance in the VM scheduler logic. Previously, when one node had fewer replicas than others but lacked sufficient available memory, the scheduler would always select the node with the most free memory. This behavior caused an uneven distribution of replicas across nodes.

The updated logic ensures that replicas are spread more evenly across nodes, provided memory constraints are satisfied.

See the affected logic below, where the scheduler performs round-robin scheduling only if the node with the fewest replicas has sufficient available memory:
https://github.com/ionos-cloud/cluster-api-provider-proxmox/blob/92ac7a597d57a5a56c0024b02f389c33f423c3fc/internal/service/scheduler/vmscheduler.go#L111C1-L115C3

Testing performed:

  • Added a unit test verifying that VMs are distributed evenly across nodes when memory allows.
  • The new test fails on the current master branch but passes with this fix applied.

@github-actions
Copy link

Tests

Please note that running unit and e2e tests requires manual approval from a team member.

e2e tests

We use labels to control which e2e tests contexts are run:

Label Behaviour
none Run Generic tests only
e2e/none skip all e2e tests (documentation etc) - overrides all e2e/* labels Do not run any e2e tests
e2e/flatcar run Flatcar e2e tests Add Flatcar tests

ℹ️ Ask a team member to add the requested labels if you don't have enough permissions.

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.

1 participant