nocloud

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MPL-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package nocloud provides the NoCloud platform implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bond added in v0.7.0

type Bond struct {
	Ethernet   `yaml:",inline"`
	Interfaces []string `yaml:"interfaces,omitempty"`
	Params     struct {
		Mode       string `yaml:"mode,omitempty"`
		LACPRate   string `yaml:"lacp-rate,omitempty"`
		HashPolicy string `yaml:"transmit-hash-policy,omitempty"`
		MIIMon     uint32 `yaml:"mii-monitor-interval,omitempty"`
		UpDelay    uint32 `yaml:"up-delay,omitempty"`
		DownDelay  uint32 `yaml:"down-delay,omitempty"`
	} `yaml:"parameters,omitempty"`
}

Bond holds bonding interface info.

type ConfigV1 added in v0.7.0

type ConfigV1 struct {
	Mac        string `yaml:"mac_address,omitempty"`
	Interfaces string `yaml:"name,omitempty"`
	MTU        uint32 `yaml:"mtu,omitempty"`
	Subnets    []struct {
		Address string `yaml:"address,omitempty"`
		Netmask string `yaml:"netmask,omitempty"`
		Gateway string `yaml:"gateway,omitempty"`
		Type    string `yaml:"type"`
	} `yaml:"subnets,omitempty"`
	Address        []string      `yaml:"address,omitempty"`
	Type           string        `yaml:"type"`
	BondInterfaces []string      `yaml:"bond_interfaces,omitempty"`
	VlanID         uint16        `yaml:"vlan_id,omitempty"`
	VlanLink       string        `yaml:"vlan_link,omitempty"`
	Params         NetworkParams `yaml:"params,omitempty"`
}

ConfigV1 holds nocloud v1 config.

type Ethernet

type Ethernet struct {
	Match struct {
		Name   string `yaml:"name,omitempty"`
		HWAddr string `yaml:"macaddress,omitempty"`
	} `yaml:"match,omitempty"`
	DHCPv4      bool     `yaml:"dhcp4,omitempty"`
	DHCPv6      bool     `yaml:"dhcp6,omitempty"`
	Address     []string `yaml:"addresses,omitempty"`
	Gateway4    string   `yaml:"gateway4,omitempty"`
	Gateway6    string   `yaml:"gateway6,omitempty"`
	MTU         uint32   `yaml:"mtu,omitempty"`
	NameServers struct {
		Search  []string `yaml:"search,omitempty"`
		Address []string `yaml:"addresses,omitempty"`
	} `yaml:"nameservers,omitempty"`
	Routes []struct {
		To     string `yaml:"to,omitempty"`
		Via    string `yaml:"via,omitempty"`
		Metric uint32 `yaml:"metric,omitempty"`
		Table  uint32 `yaml:"table,omitempty"`
		OnLink bool   `yaml:"on-link,omitempty"`
	} `yaml:"routes,omitempty"`
	RoutingPolicy []struct {
		From  string `yaml:"froom,omitempty"`
		Table uint32 `yaml:"table,omitempty"`
	} `yaml:"routing-policy,omitempty"`
}

Ethernet holds network interface info.

type MetadataConfig

type MetadataConfig struct {
	Hostname     string `yaml:"hostname,omitempty"`
	InternalDNS  string `json:"local-hostname,omitempty"`
	ExternalDNS  string `json:"public-hostname,omitempty"`
	InstanceID   string `yaml:"instance-id,omitempty"`
	InstanceType string `yaml:"instance-type,omitempty"`
	ProviderID   string `yaml:"provider-id,omitempty"`
	Region       string `yaml:"region,omitempty"`
	Zone         string `yaml:"zone,omitempty"`
}

MetadataConfig holds meta info.

type NetworkCloudInitConfig added in v0.7.0

type NetworkCloudInitConfig struct {
	Config NetworkConfig `yaml:"network"`
}

NetworkCloudInitConfig wraps nocloud network config to match cloud-init format.

type NetworkConfig

type NetworkConfig struct {
	Version   int                 `yaml:"version"`
	Config    []ConfigV1          `yaml:"config,omitempty"`
	Ethernets map[string]Ethernet `yaml:"ethernets,omitempty"`
	Bonds     map[string]Bond     `yaml:"bonds,omitempty"`
	VLANs     map[string]VLAN     `yaml:"vlans,omitempty"`
}

NetworkConfig holds network-config info.

func DecodeNetworkConfig added in v0.7.0

func DecodeNetworkConfig(content []byte) (*NetworkConfig, error)

DecodeNetworkConfig decodes the network configuration guessing the format from the content.

type NetworkParams added in v0.7.0

type NetworkParams struct {
	BondLACPRate       string `yaml:"bond-lacp-rate,omitempty"`
	BondMiimon         uint32 `yaml:"bond-miimon,omitempty"`
	BondMode           string `yaml:"bond-mode,omitempty"`
	BondXmitHashPolicy string `yaml:"bond-xmit-hash-policy,omitempty"`
	UpDelay            uint32 `yaml:"up-delay,omitempty"`
	DownDelay          uint32 `yaml:"down-delay,omitempty"`
}

NetworkParams holds network parameters (mostly bond for v1 network-config).

type Nocloud

type Nocloud struct{}

Nocloud is the concrete type that implements the runtime.Platform interface.

func (*Nocloud) Configuration

func (n *Nocloud) Configuration(ctx context.Context, r state.State) ([]byte, error)

Configuration implements the runtime.Platform interface.

func (*Nocloud) KernelArgs

func (n *Nocloud) KernelArgs(string) procfs.Parameters

KernelArgs implements the runtime.Platform interface.

func (*Nocloud) Mode

func (n *Nocloud) Mode() runtime.Mode

Mode implements the runtime.Platform interface.

func (*Nocloud) Name

func (n *Nocloud) Name() string

Name implements the runtime.Platform interface.

func (*Nocloud) NetworkConfiguration

func (n *Nocloud) NetworkConfiguration(ctx context.Context, st state.State, ch chan<- *runtime.PlatformNetworkConfig) error

NetworkConfiguration implements the runtime.Platform interface.

func (*Nocloud) ParseMetadata

func (n *Nocloud) ParseMetadata(ctx context.Context, unmarshalledNetworkConfig *NetworkConfig, st state.State, metadata *MetadataConfig) (*runtime.PlatformNetworkConfig, bool, error)

ParseMetadata converts nocloud metadata to platform network config.

type VLAN added in v0.7.0

type VLAN struct {
	Ethernet `yaml:",inline"`
	ID       uint16 `yaml:"id,omitempty"`
	Link     string `yaml:"link,omitempty"`
}

VLAN holds vlan interface info.

Jump to

Keyboard shortcuts

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