Skip to content

Allow multiple nodes have templates (use local storage)#467

Open
Atoms wants to merge 15 commits intoionos-cloud:mainfrom
Atoms:multiple-node-templates
Open

Allow multiple nodes have templates (use local storage)#467
Atoms wants to merge 15 commits intoionos-cloud:mainfrom
Atoms:multiple-node-templates

Conversation

@Atoms
Copy link
Copy Markdown

@Atoms Atoms commented Mar 25, 2025

Issue #, if available:
fixes #451

  • Adjusted order of how scheduling happens

    • First we determine if we have usable template (fail fast if not)
  • If we have usable template, determine how we need to schedule

    • if Target is provided schedule on that node if template is there
    • if Target and allowedNodes missing assume we want all nodes to use in scheduling (discover all nodes)
    • if templates are on more nodes then is in allowedNodes schedule only on allowedNodes
    • if templates missing on some allowedNodes still continue to schedule on nodes where template exists.

LocalStorage:

  • If localstorage (we have no easy way to determine if template is no localstorage):
    • multiple templates can be found
    • assign options.Node same as options.Target as we will use template from same node.
    • templateID and SourceNode cannot be used in this scenario
  • If !localstorage
    • only 1 template can be found, if multiple found fail
    • schedule vm on any allowedNode (either Target or allowedNodes or discovered nodes)
    • templateID and SourceNode only can be used in this scenario

Fixed existing tests to reflect multiple scenarios (moving out templateID and SourceNode from setupReconcilerTest

  • fixed yamlfmt

createVM had became too complex (gocyclo) as i've written in code for now it should be function to revisit and get into smaller chunks.

@github-actions
Copy link
Copy Markdown

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.

@Atoms
Copy link
Copy Markdown
Author

Atoms commented Mar 27, 2025

did more intensive testing, not all cases now work, so will be making some changes there.

@Atoms
Copy link
Copy Markdown
Author

Atoms commented Apr 14, 2025

fully reworked logic is now pushed, also updated description.

Copy link
Copy Markdown
Collaborator

@wikkyk wikkyk left a comment

Choose a reason for hiding this comment

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

Please make better use of validation rules instead of the overriding logic or erroring out. Early failure is better UX.

Make sure the examples are still correct.

This feature deserves documentation :)

This is close. I like the overall idea and implementation but it can be simplified. Please avoid just reformatting unrelated files as that makes the PR larger and thus harder to review plus it can mess up rebasing/reverting/... .

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Jul 4, 2025

@Atoms
Copy link
Copy Markdown
Author

Atoms commented Jul 7, 2025

Should i rebase on v1alpha2 branch then ?

@wikkyk
Copy link
Copy Markdown
Collaborator

wikkyk commented Jul 28, 2025

No, that branch is not ready yet. We'll rebase this PR once it's ready. Please hold on tight :)

chrodriguez added a commit to Mikroways/cluster-api-helm that referenced this pull request Aug 14, 2025
@mikhailkobik
Copy link
Copy Markdown

Hi guys, any news for this PR? This is most useful feature for homelab usage

@xugxnx
Copy link
Copy Markdown

xugxnx commented Nov 9, 2025

Hi guys, just to confirm — this feature will come with 0.8.0, right? Any rough ETA for 0.8.0? Really excited!

@wikkyk
Copy link
Copy Markdown
Collaborator

wikkyk commented Jan 20, 2026

v1alpha2 is close, we should be releasing 0.8.0-alpha.0 soonish, once that is out we will start merging the outstanding PRs like this one.

@wikkyk wikkyk mentioned this pull request Jan 20, 2026
21 tasks
This was referenced Feb 9, 2026
@wikkyk
Copy link
Copy Markdown
Collaborator

wikkyk commented Mar 3, 2026

@Atoms v1alpha2 is almost ready. Are you willing to port this? The branch is v1alpha2/wip, it's a bit of a mess but we're not planning more changes to the API.

@65278
Copy link
Copy Markdown
Collaborator

65278 commented Mar 21, 2026

We wanted to include your work in v1alpha2 beta 0, but it didn't make it.
I've rebased your work here: https://github.com/ionos-cloud/cluster-api-provider-proxmox/tree/multiple-node-templates
That said, the rebase is not 100% because I got lost in vm_test.go, amongst other things.

Here's an a priori review:

  • You need to use git commit --amend, or git rebase -i main and squash commits. Rebase was harder because of the commit discipline.
  • Testing FindVMTemplatesByTags is racy, because golang maps are racy. Redesign the api or the tests.
  • I've already removed spec.Target in v1alpha2, but this PR adds it back in, and I didn't 100% the rebase. Please re-remove it (in all commits).

Thanks for your contribution.

Copy link
Copy Markdown
Collaborator

@65278 65278 left a comment

Choose a reason for hiding this comment

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

See my comment.

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.

Local storage templates per Proxmox Node

7 participants