omni-infra-provider-libvirt

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2026 License: MPL-2.0

README

Omni Infrastructure Provider for libvirt

Can be used to automatically provision Talos nodes in libvirtd.

Configuration

In your Omni instance under Settings -> Infra Providers, create a new libvirt provider. Make a note of the OMNI_ENDPOINT and OMNI_SERVICE_ACCOUNT_KEY.

We now show various ways to connect to libvirt. For more options see the libvirt URI docs

Connecting to libvirt via ssh

You must ensure to mount the proper SSH keys. This also requires the SSH user to have access to libvirt on the server side.

Create the configuration file for the provider:

libvirt:
  uri: 'qemu+libssh://user@hostname/system?known_hosts_verify=ignore'
Connecting to libvirt via socket

If using Docker, this requires to mount the libvirt socket into the container.

libvirt:
  uri: 'qemu:///system'
  # If using libvirt via Homebrew on MacOS:
  # url: 'qemu:///session?socket=/Users/<username>/.cache/libvirt/libvirt-sock'

Running the provider

NOTE: omni-infra-provider-libvirt will not create storage pools nor networks. It will optimistically assume that they already exist and are functional.

Using Docker

Copy the provider credentials created in omni to an .env file

# your omni instance URL
OMNI_ENDPOINT=https://<OMNI_INSTANCE_NAME>.<REGION>.omni.siderolabs.io
# base64 encoded key as shown by omni
OMNI_SERVICE_ACCOUNT_KEY=<PROVIDER_KEY>

Example for using the above ssh based connection method:

docker run \
  --name omni-infra-provider-libvirt \
  --rm -it \
  -e USER=$USER \
  --env-file /tmp/omni-provider-libvirt.env \
  -v /tmp/omni-provider-libvirt.yaml:/config.yaml \
  -v /home/user/.ssh:/.ssh:ro \
  ghcr.io/siderolabs/omni-infra-provider-libvirt \
    --config-file /config.yaml

Example for using the above socket based connection method:

NOTE: don't blindly copy-paste this, the location might vary depending on your linux distribution. ensure the socket actually exists on your host at the given path.

docker run \
  --name omni-infra-provider-libvirt \
  --rm -it \
  -e USER=$USER \
  --env-file /tmp/omni-provider-libvirt.env \
  -v /tmp/omni-provider-libvirt.yaml:/config.yaml \
  -v /var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock:rw \
  ghcr.io/siderolabs/omni-infra-provider-libvirt \
    --config-file /config.yaml

How to use in an Omni cluster template

See test/ for some examples

Development

See make help for general build info.

Build an image:

make generate image-omni-infra-provider-libvirt-linux-amd64

Build the binary:

# e.g. for darwin
make omni-infra-provider-libvirt-darwin-arm64

Run the linter:

make lint-fmt fmt

Directories

Path Synopsis
api
cmd
omni-infra-provider-libvirt command
Package main is the root cmd of the provider script.
Package main is the root cmd of the provider script.
internal
pkg/config
Package config implements config data used by omni-infra-provider-libvirt
Package config implements config data used by omni-infra-provider-libvirt
pkg/provider
Package provider implements libvirt infra provider core.
Package provider implements libvirt infra provider core.
pkg/provider/cidata
Package cidata implements code used generation of ISO images, used for booting the libvirt VMs created.
Package cidata implements code used generation of ISO images, used for booting the libvirt VMs created.
pkg/provider/meta
Package meta contains meta information about the provider.
Package meta contains meta information about the provider.
pkg/provider/resources
Package resources contains resources stored in the libvirt infra provider state.
Package resources contains resources stored in the libvirt infra provider state.
version
Package version contains variables such as project name, tag and sha.
Package version contains variables such as project name, tag and sha.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL