cloudinit

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cloudinit implements kubeadm cloudinit functionality.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingHostname returns an error if required hostname is empty.
	ErrMissingHostname = errors.New("hostname is not set")

	// ErrMissingInstanceID returns an error if required hostname is empty.
	ErrMissingInstanceID = errors.New("instance-id is not set")

	// ErrMissingIPAddress returns an error if required ip address is empty.
	ErrMissingIPAddress = errors.New("ip address is not set")

	// ErrMalformedIPAddress returns an error if ip address is malformed.
	ErrMalformedIPAddress = errors.New("malformed ip address")

	// ErrMissingGateway returns an error if required gateway is empty.
	ErrMissingGateway = errors.New("gateway is not set")

	// ErrConflictingMetrics returns an error if a metric for a route already exists.
	ErrConflictingMetrics = errors.New("metric already exists for default gateway")

	// ErrMissingMacAddress returns an error if required mac address is empty.
	ErrMissingMacAddress = errors.New("mac address is not set")

	// ErrMissingNetworkConfigData returns an error if required network config data is empty.
	ErrMissingNetworkConfigData = errors.New("network config data is not set")

	// ErrMissingIPAddresses returns an error if required ip addresses is empty.
	ErrMissingIPAddresses = errors.New("ip addresses is not set")

	// ErrMalformedRoute is returned if a route can not be assembled by netplan.
	ErrMalformedRoute = errors.New("route is malformed")

	// ErrMalformedFIBRule is returned if a FIB rule can not be assembled by netplan.
	ErrMalformedFIBRule = errors.New("routing policy is malformed")
)

Functions

This section is empty.

Types

type BaseCloudInitData

type BaseCloudInitData struct {
	Hostname          string
	InstanceID        string
	NetworkConfigData []NetworkConfigData
}

BaseCloudInitData is shared across all the various types of files written to disk. used to render cloudinit.

type FIBRuleData added in v0.3.0

type FIBRuleData struct {
	To       string
	From     string
	Priority uint32
	Table    uint32
}

FIBRuleData stores forward information base rules (routing policies).

type Metadata

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

Metadata provides functionality to render machine metadata.

func NewMetadata

func NewMetadata(instanceID, hostname string) *Metadata

NewMetadata returns a new Metadata object.

func (*Metadata) Render

func (r *Metadata) Render() (metadata []byte, err error)

Render returns rendered metadata.

type NetworkConfig

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

NetworkConfig provides functionality to render machine network-config.

func NewNetworkConfig

func NewNetworkConfig(configs []NetworkConfigData) *NetworkConfig

NewNetworkConfig returns a new NetworkConfig object.

func (*NetworkConfig) Render

func (r *NetworkConfig) Render() ([]byte, error)

Render returns rendered network-config.

type NetworkConfigData

type NetworkConfigData struct {
	ProxName    string // Device name in Proxmox
	MacAddress  string
	DHCP4       bool
	DHCP6       bool
	IPAddress   string
	IPV6Address string
	Gateway     string
	Metric      *uint32
	Gateway6    string
	Metric6     *uint32
	DNSServers  []string
	Type        string
	Name        string
	Interfaces  []string // Interfaces controlled by this one.
	Table       uint32   // linux routing table number for VRF.
	Routes      []RoutingData
	FIBRules    []FIBRuleData // Forwarding information block for routing.
	LinkMTU     *uint16       // linux network device MTU
}

NetworkConfigData is used to render network-config.

type Renderer

type Renderer interface {
	Render() ([]byte, error)
}

Renderer renders cloud-init data.

type RoutingData added in v0.3.0

type RoutingData struct {
	To     string
	Via    string
	Metric uint32
	Table  uint32
}

RoutingData stores routing configuration.

Jump to

Keyboard shortcuts

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