Documentation
¶
Overview ¶
Package metadataserver performs requests to the metadata server of a GCE instance.
Interfacing with the metadata server is necessary to obtain project-level and per-instance metadata for use by the gcagent. Requests to the metadata server will also be used as a logging mechanism for gcagent usage metrics.
Index ¶
Constants ¶
const ( ImageUnknown = "unknown" MachineTypeUnknown = "unknown" )
Default values if information cannot be obtained from the metadata server.
Variables ¶
This section is empty.
Functions ¶
func DiskTypeWithRetry ¶
DiskTypeWithRetry fetches disk information from the GCE metadata server with a retry mechanism.
If there are any persistent errors in fetching this information, then the error will be logged and the return value will be "".
func FetchGCEMaintenanceEvent ¶
FetchGCEMaintenanceEvent retrieves information about pending host maintenance events.
func FetchGCEUpcomingMaintenance ¶
FetchGCEUpcomingMaintenance retrieves information about upcoming host maintenance events.
Types ¶
type CloudProperties ¶
type CloudProperties struct {
ProjectID, NumericProjectID, InstanceID, Zone, InstanceName, Image, MachineType, Region string
Scopes []string
}
CloudProperties contains the cloud properties of the instance.
func FetchCloudProperties ¶
func FetchCloudProperties() *CloudProperties
FetchCloudProperties retrieves the cloud properties using a backoff policy.
func ReadCloudPropertiesWithRetry ¶
func ReadCloudPropertiesWithRetry(bo backoff.BackOff) *CloudProperties
ReadCloudPropertiesWithRetry fetches information from the GCE metadata server with a retry mechanism.
If there are any persistent errors in fetching this information, then the error will be logged and the return value will be nil.
type GetCloudProperties ¶
type GetCloudProperties func() *CloudProperties
GetCloudProperties abstracts metadataserver.FetchCloudProperties function for testability.