Documentation ¶
Overview ¶
Package gce provides utilities to detect gce cloud provider.
Index ¶
- Variables
- func GetClusterName(ctx context.Context) (string, error)
- func GetHostAliases(ctx context.Context) ([]string, error)
- func GetHostname(ctx context.Context) (string, error)
- func GetNTPHosts(ctx context.Context) []string
- func GetNetworkID(ctx context.Context) (string, error)
- func GetProjectID(ctx context.Context) (string, error)
- func GetPublicIPv4(ctx context.Context) (string, error)
- func GetTags(_ context.Context) ([]string, error)
- func IsRunningOn(ctx context.Context) bool
Constants ¶
This section is empty.
Variables ¶
var (
// CloudProviderName contains the inventory name of the cloud
CloudProviderName = "GCP"
)
declare these as vars not const to ease testing
Functions ¶
func GetClusterName ¶
GetClusterName returns the name of the cluster containing the current GCE instance
func GetHostAliases ¶
GetHostAliases returns the host aliases from GCE
func GetHostname ¶
GetHostname returns the hostname querying GCE Metadata api
func GetNTPHosts ¶
GetNTPHosts returns the NTP hosts for GCE if it is detected as the cloud provider, otherwise an empty array. Docs: https://cloud.google.com/compute/docs/instances/managing-instances
func GetNetworkID ¶
GetNetworkID retrieves the network ID using the metadata endpoint. For GCE instances, the the network ID is the VPC ID, if the instance is found to be a part of exactly one VPC.
func GetProjectID ¶
GetProjectID returns the project ID of the current GCE instance
func GetPublicIPv4 ¶
GetPublicIPv4 returns the public IPv4 address of the current GCE instance
func IsRunningOn ¶
IsRunningOn returns true if the agent is running on GCE
Types ¶
This section is empty.