Documentation
¶
Overview ¶
Package cloudmeta reads the provider, region and zone a machine runs in from the link-local metadata service of the cloud it sits on (AWS IMDSv2, Google Cloud, Azure, Hetzner, DigitalOcean). Detection is best effort: a machine with no metadata service (a home server) yields no result and the caller falls back to labels typed by the operator.
Index ¶
Constants ¶
const ( EnvTimeout = "APP_AGENT_METADATA_TIMEOUT" EnvDisable = "APP_AGENT_METADATA_DISABLE" EnvProvider = "APP_NODE_PROVIDER" EnvRegion = "APP_NODE_REGION" EnvZone = "APP_NODE_ZONE" )
Environment variables read by FromEnv.
const ( SourceMetadata = "metadata" SourceEnv = "env" )
Sources of a detected Info.
Variables ¶
This section is empty.
Functions ¶
func LabelValue ¶
LabelValue makes s a valid node label value, or "" when nothing usable remains.
Types ¶
type Bases ¶
type Bases struct {
AWS, GCP, Azure, Hetzner, DigitalOcean string
}
Bases are the metadata service roots, overridable so tests can point each provider at a fake server.
type Config ¶
type Config struct {
Client *http.Client
Bases Bases
Timeout time.Duration
// Override wins over anything detected and is how an operator labels a
// machine that has no metadata service.
Override Info
Disabled bool
}
Config drives Detect.
type Info ¶
Info is where a machine runs. Empty fields were not reported.