host

package
v0.0.0-...-3b12f0d Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyKernelProcVersion = "host:kernel_proc_version"
	KeyKernelVersion     = "host:kernel_version"
	KeyHostname          = "host:hostname"
	KeyMachine           = "host:machine"
	KeyIPAddress         = "host:ip"
)

Host metadata keys Changing these values is a customer-visible change.

View Source
const CPUOnlinePath = "/sys/devices/system/cpu/online"
View Source
const CPUPresentPath = "/sys/devices/system/cpu/present"

Variables

View Source
var ValidTagRegex = regexp.MustCompile(`^[a-zA-Z0-9-:._]+$`)

Functions

func AddMetadata

func AddMetadata(caEndpoint string, result map[string]string) error

AddMetadata adds host metadata to the result map, that is common across all environments. The IP address and hostname (part of the returned metadata) are evaluated in the context of PID 1's namespaces, in order to make the information agnostic to any container solutions. This may not be the best thing to do in some scenarios, but still seems to be the most sensible default.

func ParseCPUCoreIDs

func ParseCPUCoreIDs(cpuPath string) ([]int, error)

Read CPUs from /sys/device and report the core IDs as a list of integers.

func PresentCPUCores

func PresentCPUCores() (uint16, error)

PresentCPUCores returns the number of present CPU cores.

func ValidateTags

func ValidateTags(tags string) string

ValidateTags parses and validates user-specified tags. Each tag must match ValidTagRegex with ';' used as a separator. Tags that can't be validated are dropped. The empty string is returned if no tags can be validated.

Types

This section is empty.

Jump to

Keyboard shortcuts

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