azure

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AzureUserDataEndpoint is the local endpoint for the config.
	// By specifying format=text and drilling down to the actual key we care about
	// we get a base64 encoded config response.
	AzureUserDataEndpoint = "http://169.254.169.254/metadata/instance/compute/customData?api-version=2019-06-01&format=text"
	// AzureHostnameEndpoint is the local endpoint for the hostname.
	AzureHostnameEndpoint = "http://169.254.169.254/metadata/instance/compute/name?api-version=2019-06-01&format=text"
	// AzureInternalEndpoint is the Azure Internal Channel IP
	// https://blogs.msdn.microsoft.com/mast/2015/05/18/what-is-the-ip-address-168-63-129-16/
	AzureInternalEndpoint = "http://168.63.129.16"
	// AzureInterfacesEndpoint is the local endpoint to get external IPs.
	AzureInterfacesEndpoint = "http://169.254.169.254/metadata/instance/network/interface?api-version=2019-06-01"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Azure

type Azure struct{}

Azure is the concrete type that implements the platform.Platform interface.

func (*Azure) Configuration

func (a *Azure) Configuration(ctx context.Context) ([]byte, error)

Configuration implements the platform.Platform interface.

func (*Azure) ExternalIPs

func (a *Azure) ExternalIPs(ctx context.Context) (addrs []net.IP, err error)

ExternalIPs implements the runtime.Platform interface.

func (*Azure) Hostname

func (a *Azure) Hostname(ctx context.Context) (hostname []byte, err error)

Hostname implements the platform.Platform interface.

func (*Azure) KernelArgs

func (a *Azure) KernelArgs() procfs.Parameters

KernelArgs implements the runtime.Platform interface.

func (*Azure) Mode

func (a *Azure) Mode() runtime.Mode

Mode implements the platform.Platform interface.

func (*Azure) Name

func (a *Azure) Name() string

Name implements the platform.Platform interface.

type Configuration

type Configuration struct {
	Text                     string `xml:",chardata"`
	HostingEnvironmentConfig string `xml:"HostingEnvironmentConfig"`
	SharedConfig             string `xml:"SharedConfig"`
	ExtensionsConfig         string `xml:"ExtensionsConfig"`
	FullConfig               string `xml:"FullConfig"`
	Certificates             string `xml:"Certificates"`
	ConfigName               string `xml:"ConfigName"`
}

Configuration seems important but isnt really used right now. We could very well not include it because we have no use for it right now, but since we want completeness, we're going to include it.

type Container

type Container struct {
	Text             string            `xml:",chardata"`
	ContainerID      string            `xml:"ContainerId"`
	RoleInstanceList *RoleInstanceList `xml:"RoleInstanceList"`
}

Container holds the interesting details about a provisioned machine.

type GoalState

type GoalState struct {
	XMLName xml.Name `xml:"GoalState"`
	Xsi     string   `xml:"xsi,attr"`
	Xsd     string   `xml:"xsd,attr"`
	WAAgent
}

GoalState is the response from the Azure platform when a machine starts up. Ref: https://github.com/Azure/WALinuxAgent/blob/b26feb7822f7d4a19507b6762fe1bd280c2ba2de/bin/waagent2.0#L4331 https://github.com/Azure/WALinuxAgent/blob/3be3e1fbf2330303f76961b87d891672e847ce4e/azurelinuxagent/common/protocol/wire.py#L216

type Health

type Health struct {
	XMLName xml.Name `xml:"Health"`
	Xsi     string   `xml:"xmlns:xsi,attr"`
	Xsd     string   `xml:"xmlns:xsd,attr"`
	WAAgent
}

Health is the response from the local machine to Azure to denote current machine state.

type HealthStatus

type HealthStatus struct {
	Text    string `xml:",chardata"`
	State   string `xml:"State"`
	Details *struct {
		Text        string `xml:",chardata"`
		SubStatus   string `xml:"SubStatus"`
		Description string `xml:"Description"`
	} `xml:"Details,omitempty"`
}

HealthStatus provides mechanism to trigger Azure to understand that our machine has transitioned to a 'Ready' state and is good to go. We can fill out details if we want to be more verbose...

type Machine

type Machine struct {
	Text                  string `xml:",chardata"`
	ExpectedState         string `xml:"ExpectedState"`
	StopRolesDeadlineHint string `xml:"StopRolesDeadlineHint"`
	LBProbePorts          *struct {
		Text string `xml:",chardata"`
		Port string `xml:"Port"`
	} `xml:"LBProbePorts,omitempty"`
	ExpectHealthReport string `xml:"ExpectHealthReport"`
}

Machine holds no useful information for us.

type RoleInstance

type RoleInstance struct {
	Text          string         `xml:",chardata"`
	InstanceID    string         `xml:"InstanceId"`
	State         string         `xml:"State,omitempty"`
	Configuration *Configuration `xml:"Configuration,omitempty"`
	Health        *HealthStatus  `xml:"Health,omitempty"`
}

RoleInstance contains the specifics for the provisioned VM.

type RoleInstanceList

type RoleInstanceList struct {
	Text         string        `xml:",chardata"`
	RoleInstance *RoleInstance `xml:"RoleInstance,omitempty"`
	Role         *RoleInstance `xml:"Role,omitempty"`
}

RoleInstanceList is a list but only has a single item which is cool I guess.

type WAAgent

type WAAgent struct {
	Text                 string     `xml:",chardata"`
	Version              string     `xml:"Version,omitempty"`
	Incarnation          string     `xml:"Incarnation,omitempty"`
	GoalStateIncarnation string     `xml:"GoalStateIncarnation,omitempty"`
	Machine              *Machine   `xml:"Machine,omitempty"`
	Container            *Container `xml:"Container,omitempty"`
}

WAAgent contains the meat of the data format that is passed between the Azure platform and the machine. Mostly, we just care about the Incarnation and Container fields here.

Jump to

Keyboard shortcuts

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