providers

package
v0.0.0-...-93ac9dd Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ConfigPath is where the data is extracted to
	ConfigPath = "/run/config"

	// Hostname is the filename in configPath where the hostname is stored
	Hostname = "hostname"

	// SSH is the path where sshd configuration from the provider is stored
	SSH = "ssh"
)

Variables

This section is empty.

Functions

func FindCIs

func FindCIs() []string

FindCIs goes through all known devices. Returns any that are either fat32 or iso9660 and have a filesystem label "CIDATA" or "cidata", per the spec here https://github.com/canonical/cloud-init/blob/master/doc/rtd/topics/datasources/nocloud.rst

func ReportReady

func ReportReady(client *http.Client) error

ReportReady to Azure's WireServer, indicating successful provisioning

Types

type FileProvider

type FileProvider string

func (FileProvider) Extract

func (p FileProvider) Extract() ([]byte, error)

func (FileProvider) Probe

func (p FileProvider) Probe() bool

func (FileProvider) String

func (p FileProvider) String() string

type GoalState

type GoalState struct {
	ContainerID string `xml:"Container>ContainerId"`
	InstanceID  string `xml:"Container>RoleInstanceList>RoleInstance>InstanceId"`
}

GoalState XML model (request)

type Health

type Health struct {
	GoalStateIncarnation string `xml:"GoalStateIncarnation"`
	ContainerID          string `xml:"Container>ContainerId"`
	InstanceID           string `xml:"Container>RoleInstanceList>Role>InstanceId"`
	State                string `xml:"Container>RoleInstanceList>Role>Health>State"`
}

Health XML model (response)

type Provider

type Provider interface {
	// String should return a unique name for the Provider
	String() string

	// Probe returns true if the provider was detected.
	Probe() bool

	// Extract user data. This may write some data, specific to a
	// provider, to ConfigPath and should return the generic userdata.
	Extract() ([]byte, error)
}

Provider is a generic interface for metadata/userdata providers.

func ListCDROMs

func ListCDROMs() []Provider

ListCDROMs lists all the cdroms in the system

type ProviderAWS

type ProviderAWS struct {
}

ProviderAWS is the type implementing the Provider interface for AWS

func NewAWS

func NewAWS() *ProviderAWS

NewAWS returns a new ProviderAWS

func (*ProviderAWS) Extract

func (p *ProviderAWS) Extract() ([]byte, error)

Extract gets both the AWS specific and generic userdata

func (*ProviderAWS) Probe

func (p *ProviderAWS) Probe() bool

Probe checks if we are running on AWS

func (*ProviderAWS) String

func (p *ProviderAWS) String() string

type ProviderAzure

type ProviderAzure struct {
	// contains filtered or unexported fields
}

ProviderAzure reads from Azure's Instance Metadata Service (IMDS) API.

func NewAzure

func NewAzure() *ProviderAzure

NewAzure factory

func (*ProviderAzure) Extract

func (p *ProviderAzure) Extract() ([]byte, error)

Extract user data via Azure IMDS.

func (*ProviderAzure) Probe

func (p *ProviderAzure) Probe() bool

Probe checks if Azure IMDS API is available

func (*ProviderAzure) String

func (p *ProviderAzure) String() string

type ProviderCDROM

type ProviderCDROM struct {
	// contains filtered or unexported fields
}

ProviderCDROM is the type implementing the Provider interface for CDROMs It looks for file called 'meta-data', 'user-data' or 'config' in the root

func NewCDROM

func NewCDROM(device string) *ProviderCDROM

NewCDROM returns a new ProviderCDROM

func (*ProviderCDROM) Extract

func (p *ProviderCDROM) Extract() ([]byte, error)

Extract gets both the CDROM specific and generic userdata

func (*ProviderCDROM) Probe

func (p *ProviderCDROM) Probe() bool

Probe checks if the CD has the right file

func (*ProviderCDROM) String

func (p *ProviderCDROM) String() string

type ProviderDigitalOcean

type ProviderDigitalOcean struct {
}

ProviderDigitalOcean is the type implementing the Provider interface for DigitalOcean

func NewDigitalOcean

func NewDigitalOcean() *ProviderDigitalOcean

NewDigitalOcean returns a new ProviderDigitalOcean

func (*ProviderDigitalOcean) Extract

func (p *ProviderDigitalOcean) Extract() ([]byte, error)

Extract gets both the DigitalOcean specific and generic userdata

func (*ProviderDigitalOcean) Probe

func (p *ProviderDigitalOcean) Probe() bool

Probe checks if we are running on DigitalOcean

func (*ProviderDigitalOcean) String

func (p *ProviderDigitalOcean) String() string

type ProviderGCP

type ProviderGCP struct {
}

ProviderGCP is the type implementing the Provider interface for GCP

func NewGCP

func NewGCP() *ProviderGCP

NewGCP returns a new ProviderGCP

func (*ProviderGCP) Extract

func (p *ProviderGCP) Extract() ([]byte, error)

Extract gets both the GCP specific and generic userdata

func (*ProviderGCP) Probe

func (p *ProviderGCP) Probe() bool

Probe checks if we are running on GCP

func (*ProviderGCP) String

func (p *ProviderGCP) String() string

type ProviderHetzner

type ProviderHetzner struct {
}

ProviderHetzner is the type implementing the Provider interface for Hetzner

func NewHetzner

func NewHetzner() *ProviderHetzner

NewHetzner returns a new ProviderHetzner

func (*ProviderHetzner) Extract

func (p *ProviderHetzner) Extract() ([]byte, error)

Extract gets both the Hetzner specific and generic userdata

func (*ProviderHetzner) Probe

func (p *ProviderHetzner) Probe() bool

Probe checks if we are running on Hetzner

func (*ProviderHetzner) String

func (p *ProviderHetzner) String() string

type ProviderMetaldata

type ProviderMetaldata struct {
}

ProviderMetaldata is the type implementing the Provider interface for Metaldata

func NewMetalData

func NewMetalData() *ProviderMetaldata

NewMetalData returns a new ProviderMetaldata

func (*ProviderMetaldata) Extract

func (p *ProviderMetaldata) Extract() ([]byte, error)

Extract gets both the Metaldata specific and generic userdata

func (*ProviderMetaldata) Probe

func (p *ProviderMetaldata) Probe() bool

Probe checks if we are running on Metaldata

func (*ProviderMetaldata) String

func (p *ProviderMetaldata) String() string

type ProviderOpenstack

type ProviderOpenstack struct {
}

ProviderOpenstack is the type implementing the Provider interface for OpenStack

func NewOpenstack

func NewOpenstack() *ProviderOpenstack

NewOpenstack returns a new ProviderOpenstack

func (*ProviderOpenstack) Extract

func (p *ProviderOpenstack) Extract() ([]byte, error)

Extract gets both the OpenStack specific and generic userdata

func (*ProviderOpenstack) Probe

func (p *ProviderOpenstack) Probe() bool

Probe checks if we are running on OpenStack

func (*ProviderOpenstack) String

func (p *ProviderOpenstack) String() string

type ProviderPacket

type ProviderPacket struct {
	// contains filtered or unexported fields
}

ProviderPacket is the type implementing the Provider interface for Packet.net

func NewPacket

func NewPacket() *ProviderPacket

NewPacket returns a new ProviderPacket

func (*ProviderPacket) Extract

func (p *ProviderPacket) Extract() ([]byte, error)

Extract gets both the Packet specific and generic userdata

func (*ProviderPacket) Probe

func (p *ProviderPacket) Probe() bool

Probe checks if we are running on Packet

func (*ProviderPacket) String

func (p *ProviderPacket) String() string

type ProviderScaleway

type ProviderScaleway struct {
}

ProviderScaleway is the type implementing the Provider interface for Scaleway

func NewScaleway

func NewScaleway() *ProviderScaleway

NewScaleway returns a new ProviderScaleway

func (*ProviderScaleway) Extract

func (p *ProviderScaleway) Extract() ([]byte, error)

Extract gets both the Scaleway specific and generic userdata

func (*ProviderScaleway) Probe

func (p *ProviderScaleway) Probe() bool

Probe checks if we are running on Scaleway

func (*ProviderScaleway) String

func (p *ProviderScaleway) String() string

type ProviderVultr

type ProviderVultr struct {
}

ProviderVultr is the type implementing the Provider interface for Vultr

func NewVultr

func NewVultr() *ProviderVultr

NewVultr returns a new ProviderVultr

func (*ProviderVultr) Extract

func (p *ProviderVultr) Extract() ([]byte, error)

Extract gets both the Vultr specific and generic userdata

func (*ProviderVultr) Probe

func (p *ProviderVultr) Probe() bool

Probe checks if we are running on Vultr

func (*ProviderVultr) String

func (p *ProviderVultr) String() string

type WireServerClient

type WireServerClient struct{}

WireServerClient used to report ready to Azure

  1. GET Goal State from WireServer.
  2. Build XML repsonse, by extracing ContainerId and InstanceId from goal state.
  3. POST XML response to WireServer indicating successful provisioning.

See also:

https://docs.microsoft.com/en-us/azure/virtual-machines/linux/no-agent#generic-steps-without-using-python

Jump to

Keyboard shortcuts

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