omni-infra-provider-bare-metal

module
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MPL-2.0

README

omni-infra-provider-bare-metal

This repo contains the code for the Omni Bare Metal Infra Provider.

Requirements

To run the provider, you need:

  • A running Omni instance

  • An Omni infra provider service account matching the ID you'll use with this provider (bare-metal by default). To create it, run:

    omnictl serviceaccount create --use-user-role=false --role=InfraProvider infra-provider:bare-metal
    

    Replace bare-metal with your desired provider ID.

  • A DHCP server: This provider runs a DHCP proxy to provide DHCP responses for iPXE boot, so a DHCP server must be running in the same network as the provider.

  • Access to an Image Factory.

Development

For local development using Talos running on QEMU, follow these steps:

  1. Set up a buildx builder instance with host network access, if you don't have one already:

    docker buildx create --driver docker-container --driver-opt network=host --name local1 --buildkitd-flags '--allow-insecure-entitlement security.insecure' --use
    
  2. Start a local image registry if you don't have one running:

    docker run -d -p 5005:5000 --restart always --name local registry:2
    
  3. Build qemu-up command line tool, and use it to start some QEMU machines:

    make qemu-up
    sudo -E _out/qemu-up-linux-amd64
    
  4. (Optional) If you have made local changes to the Talos Metal agent, follow these steps to use your local version:

    1. Build and push Talos Metal Agent boot assets image following these instructions.

    2. Replace the ghcr.io/siderolabs/talos-metal-agent-boot-assets image reference in .kres.yaml with your built image, e.g., 127.0.0.1:5005/siderolabs/talos-metal-agent-boot-assets:v1.9.0-agent-v0.1.0-beta.1-1-gbf1282b-dirty.

    3. Re-kres the project to propagate this change into Dockerfile:

      make rekres
      
  5. Build a local provider image:

    make image-provider PLATFORM=linux/amd64 REGISTRY=127.0.0.1:5005 PUSH=true TAG=local-dev
    docker pull 127.0.0.1:5005/siderolabs/omni-infra-provider-bare-metal:local-dev
    
  6. Start the provider with your Omni API address and service account credentials:

    export OMNI_ENDPOINT=<your-omni-api-address>
    export OMNI_SERVICE_ACCOUNT_KEY=<your-omni-service-account-key>
    
    docker run --name=omni-bare-metal-provider --network host --rm -it \
      -v "$HOME/.talos/clusters/talos-default:/api-power-mgmt-state:ro" \
      -e OMNI_ENDPOINT -e OMNI_SERVICE_ACCOUNT_KEY \
      127.0.0.1:5005/siderolabs/omni-infra-provider-bare-metal:local-dev \
      --insecure-skip-tls-verify \
      --api-advertise-address=<provider-ip-to-advertise> \
      --use-local-boot-assets \
      --agent-test-mode \
      --api-power-mgmt-state-dir=/api-power-mgmt-state \
      --dhcp-proxy-iface-or-ip=172.42.0.1 \
      --debug
    

    Important flags:

    • --use-local-boot-assets: Makes the provider serve the boot assets image embedded in the provider image. This is useful for testing local Talos Metal Agent boot assets. Omit this flag to use the upstream agent version, which will forward agent mode PXE boot requests to the image factory.
    • --agent-test-mode: Boots the agent in test mode when booting a Talos node in agent mode, enabling API-based power management instead of IPMI/RedFish. This is necessary for QEMU development, as it uses the power management API run by the talosctl cluster create command.
    • The volume mount -v "$HOME/.talos/clusters/talos-default:/api-power-mgmt-state:ro" mounts the directory containing API-based power management state information generated by talosctl cluster create.
    • --api-power-mgmt-state-dir: Specifies where to read the API power management address of the nodes.
    • --dhcp-proxy-iface-or-ip: Specifies the IP address or interface name for running the DHCP proxy (e.g., the IP address of the QEMU bridge interface). The tool qemu-up uses the subnet 172.42.0.0/24 by default, and the bridge IP address on the host is 172.42.0.1.
  7. When you are done with the development/testing, destroy all QEMU machines and their network bridge:

    sudo -E _out/qemu-up-linux-amd64 --destroy
    

Directories

Path Synopsis
api
cmd
provider
Package main implements the main entrypoint for the Omni bare metal infra provider.
Package main implements the main entrypoint for the Omni bare metal infra provider.
qemu-up
Package main implements the main entrypoint for the Omni bare metal infra provider.
Package main implements the main entrypoint for the Omni bare metal infra provider.
internal
constants
Package constants contains global backend constants.
Package constants contains global backend constants.
provider
Package provider implements the bare metal infra provider.
Package provider implements the bare metal infra provider.
provider/agent
Package agent implements the metal agent service.
Package agent implements the metal agent service.
provider/baremetal
Package baremetal contains bare-metal related resources.
Package baremetal contains bare-metal related resources.
provider/boot
Package boot provides boot mode determination.
Package boot provides boot mode determination.
provider/config
Package config serves machine configuration to the machines that request it via talos.config kernel argument.
Package config serves machine configuration to the machines that request it via talos.config kernel argument.
provider/constants
Package constants provides constants for the provider package.
Package constants provides constants for the provider package.
provider/controllers
Package controllers implements COSI controllers for the bare metal provider.
Package controllers implements COSI controllers for the bare metal provider.
provider/debug
Package debug provides a way to check if the build is a debug build.
Package debug provides a way to check if the build is a debug build.
provider/dhcp
Package dhcp implements DHCP proxy and other DHCP related functionality.
Package dhcp implements DHCP proxy and other DHCP related functionality.
provider/imagefactory
Package imagefactory provides an abstraction to the image factory for the bare metal infra provider.
Package imagefactory provides an abstraction to the image factory for the bare metal infra provider.
provider/ip
Package ip provides IP address related functionality.
Package ip provides IP address related functionality.
provider/ipxe
Package ipxe provides iPXE functionality.
Package ipxe provides iPXE functionality.
provider/machinestatus
Package machinestatus provides functionality to poll the state of machines, i.e., power, connectivity, etc.
Package machinestatus provides functionality to poll the state of machines, i.e., power, connectivity, etc.
provider/meta
Package meta contains meta information about the provider.
Package meta contains meta information about the provider.
provider/omni
Package omni provides Omni-related functionality.
Package omni provides Omni-related functionality.
provider/omni/tunnel
Package tunnel provides the reverse GRPC tunnel to Omni.
Package tunnel provides the reverse GRPC tunnel to Omni.
provider/power
Package power provides power management functionality for machines.
Package power provides power management functionality for machines.
provider/power/api
Package api provides power management functionality using an HTTP API, e.g., the HTTP API run by 'talosctl cluster create'.
Package api provides power management functionality using an HTTP API, e.g., the HTTP API run by 'talosctl cluster create'.
provider/power/ipmi
Package ipmi provides power management functionality using IPMI.
Package ipmi provides power management functionality using IPMI.
provider/power/pxe
Package pxe contains types related to PXE booting.
Package pxe contains types related to PXE booting.
provider/power/redfish
Package redfish provides power management functionality using Redfish.
Package redfish provides power management functionality using Redfish.
provider/server
Package server implements the HTTP and GRPC servers.
Package server implements the HTTP and GRPC servers.
provider/service
Package service implements the bare metal infra provider GRPC service server.
Package service implements the bare metal infra provider GRPC service server.
provider/tftp
Package tftp implements a TFTP server.
Package tftp implements a TFTP server.
qemu
Package qemu provides functionality to bring up Talos QEMU VMs to develop/test the provider.
Package qemu provides functionality to bring up Talos QEMU VMs to develop/test the provider.
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