azure

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MPL-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package azure contains the Azure implementation of the [platform.Platform].

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"
	// AzureMetadataEndpoint is the local endpoint for the metadata.
	AzureMetadataEndpoint = "http://169.254.169.254/metadata/instance/compute?api-version=2021-12-13&format=json"
	// 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, r state.State) ([]byte, error)

Configuration implements the platform.Platform interface.

func (*Azure) KernelArgs

func (a *Azure) KernelArgs(string) 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

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

NetworkConfiguration implements the runtime.Platform interface.

func (*Azure) ParseLoadBalancerIP

func (a *Azure) ParseLoadBalancerIP(lbConfig LoadBalancerMetadata, exIP []netip.Addr) ([]netip.Addr, error)

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

func (*Azure) ParseMetadata

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

ParseMetadata parses Azure network metadata into the platform network config.

type ComputeMetadata

type ComputeMetadata struct {
	Environment string `json:"azEnvironment,omitempty"`
	SKU         string `json:"sku,omitempty"`
	Name        string `json:"name,omitempty"`
	Zone        string `json:"zone,omitempty"`
	VMSize      string `json:"vmSize,omitempty"`
	OSType      string `json:"osType,omitempty"`
	OSProfile   struct {
		ComputerName string `json:"computerName,omitempty"`
	} `json:"osProfile,omitempty"`
	Location               string `json:"location,omitempty"`
	FaultDomain            string `json:"platformFaultDomain,omitempty"`
	PlatformSubFaultDomain string `json:"platformSubFaultDomain,omitempty"`
	UpdateDomain           string `json:"platformUpdateDomain,omitempty"`
	ResourceGroup          string `json:"resourceGroupName,omitempty"`
	ResourceID             string `json:"resourceId,omitempty"`
	VMScaleSetName         string `json:"vmScaleSetName,omitempty"`
	SubscriptionID         string `json:"subscriptionId,omitempty"`
	EvictionPolicy         string `json:"evictionPolicy,omitempty"`
}

ComputeMetadata represents metadata compute information.

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

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

IPAddresses holds public/private IPs.

type LoadBalancerMetadata

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

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