Skip to content

feat: Proxmox VE LXC provider#868

Merged
acouvreur merged 20 commits into
sablierapp:mainfrom
mzyy94:proxmox-lxc-provider
May 9, 2026
Merged

feat: Proxmox VE LXC provider#868
acouvreur merged 20 commits into
sablierapp:mainfrom
mzyy94:proxmox-lxc-provider

Conversation

@mzyy94
Copy link
Copy Markdown
Contributor

@mzyy94 mzyy94 commented Apr 16, 2026

Lets Sablier manage LXC containers via the Proxmox API, following the same patterns as existing providers.

  • Uses github.com/luthermonson/go-proxmox with API token auth
  • Auto-discovers containers across all cluster nodes
  • Tags for opt-in (sablier) and grouping (sablier-group-<name>)
    • Proxmox tags don't support key=value, so prefix convention is used
  • Instance lookup by hostname, VMID (100), or node/VMID (pve1/100)
  • Readiness based on network interface IP assignment (LXC has no healthcheck)
  • Stop events via polling (Proxmox has no event stream)

Design: comparison with Docker provider

Feature Docker Proxmox LXC
Discovery sablier.enable=true label (server-side filter) sablier tag (client-side filter, no API-level tag filtering)
Grouping sablier.group=<name> label sablier-group-<name> tag
Instance naming Container name Hostname, VMID, or node/vmid
Readiness Docker healthcheck Non-loopback NIC IP check
Start Synchronous ContainerStart Async task (UPID); tracked in pendingTasks, polled via InstanceInspect
Start failure Returns error immediately InstanceInspect reports UnrecoverableInstanceState
Stop events Real-time event stream Polling (10s interval, closes after 5 consecutive failures)

Configuration

provider:
  name: proxmox_lxc
  proxmox-lxc:
    url: "https://proxmox.local:8006/api2/json"
    token-id: "root@pam!sablier"
    token-secret: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    tls-insecure: false

How it's tested

Unit tests cover all provider methods with an httptest mock server. Integration tests run against a real Proxmox VE cluster (template clone, full start/inspect/stop lifecycle, stop notification).

Been running this on a real cluster for a few days. Everything works fine.

@acouvreur
Copy link
Copy Markdown
Member

Impressive work @mzyy94

Thank you for contributing! I will review, but it will take some time. I will also ask github copilot to review it, but it doees not mean that each comment made by Copilot must be resolved.

@acouvreur acouvreur requested a review from Copilot April 16, 2026 13:32
@mzyy94 mzyy94 marked this pull request as ready for review April 16, 2026 13:34
@mzyy94 mzyy94 requested a review from acouvreur as a code owner April 16, 2026 13:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new proxmox_lxc instance provider so Sablier can start/stop and discover Proxmox VE LXC containers via the Proxmox API, aligning behavior with existing provider patterns (discovery, grouping, readiness, and stop notifications).

Changes:

  • Introduces the Proxmox LXC provider implementation (discovery via tags, start/stop, inspect/readiness, stop-event polling) plus unit/integration tests.
  • Extends config/CLI/docs to support Proxmox API token auth and TLS settings.
  • Updates module dependencies to include github.com/luthermonson/go-proxmox.

Reviewed changes

Copilot reviewed 32 out of 34 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/sabliercmd/testdata/config_yaml_wanted.json Updates expected config JSON to include ProxmoxLXC defaults.
pkg/sabliercmd/testdata/config_env_wanted.json Updates expected config JSON to include ProxmoxLXC defaults.
pkg/sabliercmd/testdata/config_default.json Updates default config JSON to include ProxmoxLXC defaults.
pkg/sabliercmd/testdata/config_cli_wanted.json Updates expected config JSON to include ProxmoxLXC defaults.
pkg/sabliercmd/root.go Adds CLI flags and viper bindings for Proxmox LXC config.
pkg/sabliercmd/provider.go Wires proxmox_lxc into provider setup and constructs the Proxmox client.
pkg/provider/proxmoxlxc/proxmox_lxc.go Core provider: discovery across nodes, caching, instance resolution.
pkg/provider/proxmoxlxc/tags.go Implements tag parsing and group extraction conventions.
pkg/provider/proxmoxlxc/container_list.go Implements InstanceList and InstanceGroups.
pkg/provider/proxmoxlxc/container_start.go Implements InstanceStart with async task tracking.
pkg/provider/proxmoxlxc/container_stop.go Implements InstanceStop and task wait.
pkg/provider/proxmoxlxc/container_inspect.go Implements InstanceInspect, readiness via NIC IP, and pending-task polling/TTL.
pkg/provider/proxmoxlxc/events.go Implements stop notifications via polling.
pkg/provider/proxmoxlxc/testhelper_test.go Mock Proxmox API server for unit tests.
pkg/provider/proxmoxlxc/export_test.go Exports test helpers for external test packages.
pkg/provider/proxmoxlxc/tags_test.go Unit tests for tag parsing/group extraction.
pkg/provider/proxmoxlxc/container_list_test.go Unit tests for list/groups behavior, multi-node, duplicate hostname detection.
pkg/provider/proxmoxlxc/container_start_test.go Unit tests for start behavior and task failure/in-progress handling.
pkg/provider/proxmoxlxc/container_stop_test.go Unit tests for stop behavior.
pkg/provider/proxmoxlxc/container_inspect_test.go Unit tests for inspect behavior and lookup modes.
pkg/provider/proxmoxlxc/events_test.go Unit test ensuring notify loop closes channel on ctx cancel.
pkg/provider/proxmoxlxc/integration_test.go Integration test suite against a real Proxmox cluster (env-gated).
pkg/provider/proxmoxlxc/testcontainers_test.go Integration helper to clone/tag/cleanup a real LXC container.
pkg/config/provider.go Adds ProxmoxLXC config struct, provider list entry, and validation.
pkg/config/provider_test.go Adds validation test cases for the new provider config.
docs/providers/proxmox_lxc.md New provider documentation (config, tagging, readiness, naming).
docs/providers/overview.md Adds Proxmox LXC to providers overview table.
docs/configuration.md Updates configuration docs and CLI help listing to include proxmox_lxc.
docs/assets/img/proxmox.png Adds Proxmox icon used by docs.
docs/_sidebar.md Adds Proxmox LXC entry to docs sidebar.
docs/README.md Updates terminology to include Proxmox LXC containers as instances.
README.md Adds Proxmox LXC section and updates config examples/provider list.
go.mod Adds new indirect requirements related to Proxmox client usage.
go.sum Adds checksums for new dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/sabliercmd/provider.go
Comment thread pkg/provider/proxmoxlxc/container_inspect.go
Comment thread docs/providers/proxmox_lxc.md Outdated
Comment thread go.mod Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

mzyy94 and others added 4 commits April 16, 2026 23:04
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
5.7% Duplication on New Code (required ≤ 3%)
D Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@mzyy94 mzyy94 marked this pull request as draft April 29, 2026 16:57
@acouvreur
Copy link
Copy Markdown
Member

@mzyy94 I think we can merge this PR if you think it is ready?

People can then contribute further to improve it as needed

@mzyy94 mzyy94 marked this pull request as ready for review May 6, 2026 23:35
@mzyy94
Copy link
Copy Markdown
Contributor Author

mzyy94 commented May 6, 2026

I made it ready 🚀

@acouvreur
Copy link
Copy Markdown
Member

@mzyy94 can you please resolve conflicts with the latest changes ?

@github-actions github-actions Bot added documentation Improvements or additions to documentation provider Issue related to a provider labels May 8, 2026
@mzyy94
Copy link
Copy Markdown
Contributor Author

mzyy94 commented May 8, 2026

'main' merged 🆗

@acouvreur acouvreur merged commit 4692a09 into sablierapp:main May 9, 2026
3 of 4 checks passed
@sablier-bot sablier-bot Bot mentioned this pull request May 9, 2026
@mzyy94 mzyy94 deleted the proxmox-lxc-provider branch May 9, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation provider Issue related to a provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants