azure

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 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"
	// AzureHostnameEndpoint is the local endpoint for the hostname.
	AzureHostnameEndpoint = "http://169.254.169.254/metadata/instance/compute/osProfile/computerName?api-version=2021-12-13&format=text"
	// AzureInterfacesEndpoint is the local endpoint to get external IPs.
	AzureInterfacesEndpoint = "http://169.254.169.254/metadata/instance/network/interface?api-version=2021-12-13&format=json"
	// AzureLoadbalancerEndpoint is the local endpoint for load balancer config.
	AzureLoadbalancerEndpoint = "http://169.254.169.254/metadata/loadbalancer?api-version=2021-05-01&format=json"
)

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) 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.

func (*Azure) NetworkConfiguration added in v1.0.0

func (a *Azure) NetworkConfiguration(ctx context.Context, ch chan<- *runtime.PlatformNetworkConfig) error

NetworkConfiguration implements the runtime.Platform interface.

func (*Azure) ParseLoadBalancerIP added in v1.1.0

func (a *Azure) ParseLoadBalancerIP(lbConfig LoadBalancerMetadata, exIP []netaddr.IP) ([]netaddr.IP, error)

ParseLoadBalancerIP parses Azure LoadBalancer metadata into the platform external ip list.

func (*Azure) ParseMetadata added in v1.0.0

func (a *Azure) ParseMetadata(interfaceAddresses []NetworkConfig, host []byte) (*runtime.PlatformNetworkConfig, error)

ParseMetadata parses Azure network metadata into the platform network config.

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 IPAddresses added in v0.14.0

type IPAddresses struct {
	PrivateIPAddress string `json:"privateIpAddress"`
	PublicIPAddress  string `json:"publicIpAddress"`
}

IPAddresses holds public/private IPs.

type LoadBalancerMetadata added in v1.1.0

type LoadBalancerMetadata struct {
	LoadBalancer struct {
		PublicIPAddresses []struct {
			FrontendIPAddress string `json:"frontendIpAddress,omitempty"`
			PrivateIPAddress  string `json:"privateIpAddress,omitempty"`
		} `json:"publicIpAddresses,omitempty"`
	} `json:"loadbalancer,omitempty"`
}

LoadBalancerMetadata represents load balancer metadata in IMDS.

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 NetworkConfig added in v0.14.0

type NetworkConfig struct {
	IPv4 struct {
		IPAddresses []IPAddresses `json:"ipAddress"`
	} `json:"ipv4"`
	IPv6 struct {
		IPAddresses []IPAddresses `json:"ipAddress"`
	} `json:"ipv6"`
}

NetworkConfig holds network interface meta config.

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