cloudinit

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const GzipBase64 = "gzip+base64"

Variables

This section is empty.

Functions

func EncodeCloudInit

func EncodeCloudInit(name string, object any) (string, error)

func EncodeObject

func EncodeObject(name string, object any) (string, error)

func GeneratePublicKey

func GeneratePublicKey(authKey string) (publicKey string, err error)

func ToCIDR

func ToCIDR(address, netmask string) string

ToCIDR returns address in cidr format ww.xx.yy.zz/NN

Types

type CloudInit

type CloudInit map[string]any

func (CloudInit) AddDirectoryToWriteFile

func (c CloudInit) AddDirectoryToWriteFile(srcDir, dstDir, owner string) error

func (CloudInit) AddFileToWriteFile

func (c CloudInit) AddFileToWriteFile(sourceFile, dstDir, owner string) error

func (CloudInit) AddObjectToWriteFile

func (c CloudInit) AddObjectToWriteFile(object any, destination, owner string, permissions uint) error

func (CloudInit) AddRunCommand

func (c CloudInit) AddRunCommand(command ...string) (err error)

func (CloudInit) AddTextToWriteFile

func (c CloudInit) AddTextToWriteFile(text string, destination, owner string, permissions uint)

func (CloudInit) AddToWriteFile

func (c CloudInit) AddToWriteFile(content []byte, destination, owner string, permissions uint)

func (CloudInit) Clone

func (c CloudInit) Clone() (copy CloudInit, err error)

type CloudInitInput

type CloudInitInput struct {
	InstanceName string
	InstanceID   string //string(uuid.NewUUID())
	DomainName   string
	UserName     string
	AuthKey      string
	TimeZone     string
	Network      *NetworkDeclare
	AllowUpgrade bool
	CloudInit    CloudInit
}

func (*CloudInitInput) BuildGuestInfos

func (input *CloudInitInput) BuildGuestInfos() (GuestInfos, error)

func (*CloudInitInput) BuildUserData

func (input *CloudInitInput) BuildUserData(netplan string) (vendorData CloudInit, err error)

func (*CloudInitInput) BuildVendorData

func (input *CloudInitInput) BuildVendorData() CloudInit

type GuestInfos

type GuestInfos map[string]string

GuestInfos the guest infos Must not start with `guestinfo.`

func (GuestInfos) IsEmpty

func (g GuestInfos) IsEmpty() bool

type Nameserver

type Nameserver struct {
	Search    []string `json:"search,omitempty" yaml:"search,omitempty"`
	Addresses []string `json:"addresses,omitempty" yaml:"addresses,omitempty"`
}

Nameserver declaration

type NetworkAdapter

type NetworkAdapter struct {
	DHCP4         bool                      `json:"dhcp4,omitempty" yaml:"dhcp4,omitempty"`
	NicName       *string                   `json:"set-name,omitempty" yaml:"set-name,omitempty"`
	Match         *map[string]string        `json:"match,omitempty" yaml:"match,omitempty"`
	Addresses     *[]any                    `json:"addresses,omitempty" yaml:"addresses,omitempty"`
	Nameservers   *Nameserver               `json:"nameservers,omitempty" yaml:"nameservers,omitempty"`
	DHCPOverrides CloudInit                 `json:"dhcp4-overrides,omitempty" yaml:"dhcp4-overrides,omitempty"`
	Routes        *[]v1alpha2.NetworkRoutes `json:"routes,omitempty" yaml:"routes,omitempty"`
}

NetworkAdapter wrapper

type NetworkConfig

type NetworkConfig struct {
	InstanceID    string          `json:"instance-id,omitempty" yaml:"instance-id,omitempty"`
	LocalHostname string          `json:"local-hostname,omitempty" yaml:"local-hostname,omitempty"`
	Hostname      string          `json:"hostname,omitempty" yaml:"hostname,omitempty"`
	Network       *NetworkDeclare `json:"network,omitempty" yaml:"network,omitempty"`
}

NetworkConfig wrapper

type NetworkDeclare

type NetworkDeclare struct {
	Version   int                        `default:"2" json:"version,omitempty" yaml:"version,omitempty"`
	Ethernets map[string]*NetworkAdapter `json:"ethernets,omitempty" yaml:"ethernets,omitempty"`
}

NetworkDeclare wrapper

type NetworkResolv

type NetworkResolv struct {
	Search     []string `json:"search,omitempty" yaml:"search,omitempty"`
	Nameserver []string `json:"nameserver,omitempty" yaml:"nameserver,omitempty"`
}

NetworkResolv /etc/resolv.conf

Jump to

Keyboard shortcuts

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