machineinfo

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package machineinfo provides information about the machine.

Index

Constants

View Source
const RegionUnknown = "unknown"

RegionUnknown is reported as the login request region when neither the provider metadata (e.g., IMDS unsupported or unreachable) nor the DERP-latency fallback produced one. Matches the "unknown" provider convention in GetProvider, and gives downstream consumers (e.g., node region label propagation) a stable non-empty value.

Variables

This section is empty.

Functions

func CreateGossipRequest

func CreateGossipRequest(machineID string, nvmlInstance nvidianvml.Instance) (*apiv1.GossipRequest, error)

func CreateGossipRequestWithContainerd added in v0.13.0

func CreateGossipRequestWithContainerd(machineID string, nvmlInstance nvidianvml.Instance, cfg configcommon.ContainerdConfig) (*apiv1.GossipRequest, error)

func CreateLoginRequest

func CreateLoginRequest(token string, machineID string, nodeGroup string, gpuCount string, nvmlInstance nvidianvml.Instance) (*apiv1.LoginRequest, error)

func CreateLoginRequestWithContainerd added in v0.13.0

func CreateLoginRequestWithContainerd(token, machineID, nodeGroup, gpuCount, region string, nvmlInstance nvidianvml.Instance, cfg configcommon.ContainerdConfig) (*apiv1.LoginRequest, error)

CreateLoginRequestWithContainerd uses the configured runtime for enrollment metadata.

func CreateLoginRequestWithRegion added in v0.12.26

func CreateLoginRequestWithRegion(token string, machineID string, nodeGroup string, gpuCount string, region string, nvmlInstance nvidianvml.Instance) (*apiv1.LoginRequest, error)

func GetMachineCPUInfo

func GetMachineCPUInfo() *apiv1.MachineCPUInfo

func GetMachineDiskInfo

func GetMachineDiskInfo(ctx context.Context) (*apiv1.MachineDiskInfo, error)

func GetMachineGPUInfo

func GetMachineGPUInfo(nvmlInstance nvidianvml.Instance) (*apiv1.MachineGPUInfo, error)

func GetMachineInfo

func GetMachineInfo(nvmlInstance nvidianvml.Instance) (*apiv1.MachineInfo, error)

func GetMachineInfoWithContainerd added in v0.13.0

func GetMachineInfoWithContainerd(nvmlInstance nvidianvml.Instance, cfg configcommon.ContainerdConfig) (*apiv1.MachineInfo, error)

GetMachineInfoWithContainerd reports the same runtime that the health component monitors.

func GetMachineLocation

func GetMachineLocation() *apiv1.MachineLocation

func GetMachineMemoryInfo

func GetMachineMemoryInfo() *apiv1.MachineMemoryInfo

func GetMachineNICInfo

func GetMachineNICInfo() *apiv1.MachineNICInfo

func GetProvider

func GetProvider(publicIP string) *providers.Info

GetProvider looks up the provider of the machine. If the metadata service or other provider detection fails, it falls back to ASN lookup using the public IP address.

func GetProviderWithContext added in v0.12.12

func GetProviderWithContext(ctx context.Context, publicIP string) *providers.Info

GetProviderWithContext passes the caller's context to metadata provider detection.

func GetSystemResourceGPUCount

func GetSystemResourceGPUCount(nvmlInstance nvidianvml.Instance) (string, error)

GetSystemResourceGPUCount returns the system GPU resource of the machine with the GPU count, using the type defined in "corev1.ResourceName" in https://pkg.go.dev/k8s.io/api/core/v1#ResourceName. It represents the GPU count with the key "nvidia.com/gpu" or "nvidia.com/gpu.count". Must be parsed using the "resource.ParseQuantity" function in https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource.

This is different from the device count in DCGM. ref. "CountDevEntry" in "nvvs/plugin_src/software/Software.cpp" ref. https://github.com/NVIDIA/DCGM/blob/903d745504f50153be8293f8566346f9de3b3c93/nvvs/plugin_src/software/Software.cpp#L220-L249

func GetSystemResourceRootVolumeTotal

func GetSystemResourceRootVolumeTotal() (string, error)

GetSystemResourceRootVolumeTotal returns the system root disk resource of the machine for the total disk size, using the type defined in "corev1.ResourceName" in https://pkg.go.dev/k8s.io/api/core/v1#ResourceName. It represents the Volume size, in bytes (e,g. 5Gi = 5GiB = 5 * 1024 * 1024 * 1024). Must be parsed using the "resource.ParseQuantity" function in https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource.

func SelectPrivateIP added in v0.13.2

func SelectPrivateIP(providerPrivateIP string, publicIP string, nicInfo *apiv1.MachineNICInfo) string

SelectPrivateIP returns the private IP to report for this machine.

Precedence:

  1. providerPrivateIP from provider metadata (IMDS), reported as-is.
  2. the first RFC1918 IPv4 in nicInfo (overlay/CNI interfaces are already excluded by GetMachineNICInfo).
  3. the IPv4 on the default-route interface, the address kubelet picks as the node InternalIP. This covers bare-metal hosts without IMDS whose host network uses non-RFC1918 internal ranges (e.g., 7.0.0.0/8), which step 2 cannot see.
  4. empty.

publicIP is never returned from step 3.

func SetDiskCommands added in v0.12.18

func SetDiskCommands(findmnt, lsblk, blockdevUsage string)

SetDiskCommands configures machine-info disk collection to run in the host namespace.

Types

This section is empty.

Jump to

Keyboard shortcuts

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