Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

Atoms
Copy link

@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.

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.

@Atoms
Copy link
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
Author

Atoms commented Apr 14, 2025

fully reworked logic is now pushed, also updated description.

Copy link
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/... .

@wikkyk
Copy link
Collaborator

wikkyk commented May 12, 2025

Found, that .spec.Target is obsolete (not needed complexity increase) as we can achieve same with adding one allowedNode. So took advantage and removed few lines to remove .spec.Target. (maybe i should leave it for backwards compatibility and throw deprecation warning)

I'm not ok with this. It's a breaking change. Instead, you could add a validation rule that both Target and allowedNode cannot both be set and mark Target deprecated. Then add a note to #293 to remove Target.

@wikkyk
Copy link
Collaborator

wikkyk commented May 19, 2025

I think this is very close. Please update go.mod so that the test suite can run.

I would like @mcbenjemaa or @65278 to give this a look as it's a fairly large change requiring a second pair of eyes.

@Atoms
Copy link
Author

Atoms commented May 21, 2025

rebased on main

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
2 participants