agentcontext

package
v0.0.0-...-9e7e4f5 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Overview

The agentcontext package provides functionality to obtain information about the system a given agent or loader is running on. This includes information unrelated to MIG itself, such as the hostname of the system, IP addresses, and so on.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Contributor: - Aaron Meihm ameihm@mozilla.com [:alm]

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Contributor: - Julien Vehent jvehent@mozilla.com [:ulfr]

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Contributor: - Julien Vehent jvehent@mozilla.com [:ulfr]

Index

Constants

View Source
const AWSMETAIP string = "169.254.169.254"
View Source
const AWSMETAPORT int = 80
View Source
const FETCHBODYMAX int64 = 10240

The maximum number of bytes we will fetch in a response from the metadata service

Variables

This section is empty.

Functions

func EnableTestHooks

func EnableTestHooks(confpath string)

EnableTestHooks changes the behavior of the agentcontext package for testing

confpath indicates the configuration path functions like GetConfDir should return rather than the standard platform default.

func GetConfDir

func GetConfDir() string

GetConfDir returns the configuration directory for the agent

func GetRunDir

func GetRunDir() string

GetRunDir returns the runtime directory for the agent

Types

type AWSContext

type AWSContext struct {
	InstanceID   string // AWS instance ID
	LocalIPV4    string // AWS Local IPV4 address
	AMIID        string // AWS AMI ID
	InstanceType string // AWS instance type
}

Information used for agents running in AWS environments

type AgentContext

type AgentContext struct {
	Hostname     string   // Hostname
	BinPath      string   // Path to invoked binary
	RunDir       string   // Agent runtime directory
	OS           string   // Operating System
	OSIdent      string   // OS release identifier
	Init         string   // OS Init
	Architecture string   // System architecture
	Addresses    []string // IP addresses
	PublicIP     string   // Systems public IP from perspective of API
	UID          string   // Agent ID
	QueueLoc     string   // Agent queue location

	AWS AWSContext // AWS specific information
}

Information from the system the agent is running on

func NewAgentContext

func NewAgentContext(lch chan mig.Log, hints AgentContextHints) (ret AgentContext, err error)

func (*AgentContext) Differs

func (ctx *AgentContext) Differs(comp AgentContext) bool

Check of any values in the AgentContext differ from those in comp

func (*AgentContext) IsZero

func (ctx *AgentContext) IsZero() bool

func (*AgentContext) ToAgent

func (ctx *AgentContext) ToAgent() (ret mig.Agent)

type AgentContextHints

type AgentContextHints struct {
	APIUrl           string   // MIG API URL
	Proxies          []string // Proxies avialable for use in discovery
	DiscoverPublicIP bool     // Attempt to discover public IP
	DiscoverAWSMeta  bool     // Attempt to discover AWS metadata
}

Passed to NewAgentContext() to inform environment discovery

Jump to

Keyboard shortcuts

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