cloudinit

package
v0.35.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2020 License: Apache-2.0 Imports: 13 Imported by: 20

Documentation

Index

Constants

View Source
const (
	DataSourceNoCloud     DataSourceType     = "noCloud"
	DataSourceConfigDrive DataSourceType     = "configDrive"
	NICMetadataType       DeviceMetadataType = "nic"
	DiskMetadataType      DeviceMetadataType = "disk"
)

Variables

This section is empty.

Functions

func GenerateLocalData

func GenerateLocalData(vmiName string, namespace string, data *CloudInitData) error

func GetIsoFilePath added in v0.19.0

func GetIsoFilePath(source DataSourceType, domain, namespace string) string

func IsValidCloudInitData added in v0.19.0

func IsValidCloudInitData(cloudInitData *CloudInitData) bool

IsValidCloudInitData checks if the given CloudInitData object is valid in the sense that GenerateLocalData can be called with it.

func ResolveConfigDriveSecrets added in v0.26.0

func ResolveConfigDriveSecrets(vmi *v1.VirtualMachineInstance, secretSourceDir string) error

ResolveConfigDriveSecrets is looking for CloudInitConfigDriveSource volume source with UserDataSecretRef and NetworkDataSecretRef and resolves the secret from the corresponding VolumeMount.

Note: when using this function, make sure that your code can access the secret volumes.

func ResolveNoCloudSecrets added in v0.26.0

func ResolveNoCloudSecrets(vmi *v1.VirtualMachineInstance, secretSourceDir string) error

ResolveNoCloudSecrets is looking for CloudInitNoCloud volumes with UserDataSecretRef requests. It reads the `userdata` secret the corresponds to the given CloudInitNoCloud volume and sets the UserData field on that volume.

Note: when using this function, make sure that your code can access the secret volumes.

func SetIsoCreationFunction

func SetIsoCreationFunction(isoFunc IsoCreationFunc)

The unit test suite uses this function

func SetLocalDirectory

func SetLocalDirectory(dir string) error

Types

type CloudInitData added in v0.19.0

type CloudInitData struct {
	DataSource  DataSourceType
	MetaData    *Metadata
	UserData    string
	NetworkData string
	DevicesData *[]DeviceData
}

CloudInitData is a data source independent struct that holds cloud-init user and network data

func ReadCloudInitVolumeDataSource added in v0.19.0

func ReadCloudInitVolumeDataSource(vmi *v1.VirtualMachineInstance) (cloudInitData *CloudInitData, err error)

ReadCloudInitVolumeDataSource scans the given VMI for CloudInit volumes and reads their content into a CloudInitData struct. Does not resolve secret refs. To ensure that secrets are read correctly, call ResolveNoCloudSecrets beforehand.

type DataSourceType added in v0.19.0

type DataSourceType string

type DeviceData added in v0.28.0

type DeviceData struct {
	Type    DeviceMetadataType `json:"type"`
	Bus     string             `json:"bus"`
	Address string             `json:"address"`
	MAC     string             `json:"mac,omitempty"`
	Serial  string             `json:"serial,omitempty"`
	Tags    []string           `json:"tags"`
}

type DeviceMetadataType added in v0.28.0

type DeviceMetadataType string

type IsoCreationFunc

type IsoCreationFunc func(isoOutFile, volumeID string, inDir string) error

type Metadata added in v0.28.0

type Metadata struct {
	InstanceID    string        `json:"instance-id"`
	LocalHostname string        `json:"local-hostname,omitempty"`
	Hostname      string        `json:"hostname,omitempty"`
	UUID          string        `json:"uuid,omitempty"`
	Devices       *[]DeviceData `json:"devices,omitempty"`
}

Jump to

Keyboard shortcuts

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