Skip to content

Localized Template Selection for Proxmox Nodes without Shared Storage #673

@steve-fraser

Description

@steve-fraser

Describe the solution you'd like

Background / Use Case

I have a two-node Proxmox cluster with local storage only (no Ceph, no shared NFS). Each node has its own local-lvm storage and a copy
of the same VM template, tagged identically (e.g., capmox-ubuntu-2204).

I use TemplateSelector.matchTags to select templates by tag rather than hardcoding a templateID per-node.

Current Behavior (the problem)

TemplateSelector today performs a cluster-wide tag search via cluster.Resources and returns whichever node happens to match first —
regardless of which node the scheduler has chosen as the clone target.

The sequence in createVM (internal/service/vmservice/vm.go):

  1. Scheduler picks a target node (e.g. pve-node-2) based on available memory
  2. FindVMTemplateByTags scans all nodes and returns the template found on pve-node-1
  3. CloneVM is called with source on pve-node-1 and target on pve-node-2
  4. Proxmox rejects this — cross-node cloning requires shared storage

The current TemplateSelector implementation enforces that exactly one template matches the tags across the whole cluster — but in a
multi-node local-storage setup, you naturally want the same template replicated on each node.

Desired Behavior

When the scheduler has already selected a target node, the controller should:

  1. First look for a tag-matching template on that target node
  2. If found, use it — clone is node-local, no shared storage needed
  3. If not found, fall back to the current cluster-wide search (preserves behavior for shared-storage setups)

This "locality-aware" template resolution would let users with local storage maintain one template copy per node, all sharing the same
tags, and have cloning work correctly.

Why This Matters

  • Many users run simple two or three node setups with local storage because of non-matching drive configurations
  • TemplateSelector is the ergonomic, node-agnostic way to reference templates — but it is currently unusable in non-shared storage
    environments because the "one exact match across the cluster" constraint conflicts with needing per-node local copies

Environment:

  • Cluster-api-provider-proxmox version:
  • Kubernetes version: (use kubectl version):
  • OS (e.g. from /etc/os-release):

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions