cloudconfig

package
Version: v0.0.0-...-d934a55 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: AGPL-3.0 Imports: 29 Imported by: 34

Documentation

Index

Constants

View Source
const (
	// FileNameBootstrapParams is the name of bootstrap params file.
	FileNameBootstrapParams = "bootstrap-params"
)
View Source
const (

	// NonceFile is written by cloud-init as the last thing it does.
	// The file will contain the machine's nonce. The filename is
	// relative to the Juju data-dir.
	NonceFile = "nonce.txt"
)

Variables

View Source
var (
	// UbuntuGroups is the set of unix groups to add the "ubuntu" user to
	// when initializing an Ubuntu system.
	UbuntuGroups = []string{"adm", "audio", "cdrom", "dialout", "dip",
		"floppy", "netdev", "plugdev", "sudo", "video"}

	// CentOSGroups is the set of unix groups to add the "ubuntu" user to
	// when initializing a CentOS system.
	CentOSGroups = []string{"adm", "systemd-journal", "wheel"}

	// OpenSUSEGroups is the set of unix groups to add the "ubuntu" user to
	// when initializing a OpenSUSE system.
	OpenSUSEGroups = []string{"users"}
)

Functions

func SetUbuntuUser

func SetUbuntuUser(conf cloudinit.CloudConfig, authorizedKeys string)

SetUbuntuUser creates an "ubuntu" use for unix systems so the juju client can access the machine using ssh with the configuration we expect. It may make sense in the future to add a "juju" user instead across all distributions.

Types

type InitReader

type InitReader interface {
	// GetInitConfig aggregates and returns provisioning data from the machine.
	GetInitConfig() (map[string]interface{}, error)

	// ExtractPropertiesFromConfig filters the input config data according to
	// the input list of properties and returns the result
	ExtractPropertiesFromConfig([]string, map[string]interface{}, loggo.Logger) map[string]interface{}
}

InitReader describes methods for extracting machine provisioning config, and extracting keys from config based on properties sourced from "container-inherit-properties" in model config.

func NewMachineInitReader

func NewMachineInitReader(series string) (InitReader, error)

NewMachineInitReader creates and returns a new MachineInitReader for the input series.

func NewMachineInitReaderFromConfig

func NewMachineInitReaderFromConfig(cfg MachineInitReaderConfig) InitReader

NewMachineInitReader creates and returns a new MachineInitReader using the input configuration.

type MachineInitReader

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

MachineInitReader accesses Cloud-Init and Curtin configuration data, and extracts from it values for keys set in model configuration as "container-inherit-properties".

func (*MachineInitReader) ExtractPropertiesFromConfig

func (r *MachineInitReader) ExtractPropertiesFromConfig(
	keys []string, cfg map[string]interface{}, log loggo.Logger,
) map[string]interface{}

ExtractPropertiesFromConfig filters the input config based on the input properties and returns a map of cloud-init data.

func (*MachineInitReader) GetInitConfig

func (r *MachineInitReader) GetInitConfig() (map[string]interface{}, error)

GetInitConfig returns a map of configuration data used to provision the machine. It is sourced from both Cloud-Init and Curtin data.

type MachineInitReaderConfig

type MachineInitReaderConfig struct {
	// Series is the OS series of the machine.
	Series string

	// CloudInitConfigDir is the directory where cloud configuration resides
	// on MAAS hosts.
	CloudInitConfigDir string

	// CloudInitInstanceConfigDir is the directory where cloud-init data for
	// the instance resides. Cloud-Init user-data supplied to Juju lives here.
	CloudInitInstanceConfigDir string

	// CurtinInstallConfigFile is the file containing initialisation config
	// written by Curtin.
	// Apt configuration for MAAS versions 2.5+ resides here.
	CurtinInstallConfigFile string
}

MachineInitReaderConfig holds configuration values required by MachineInitReader to retrieve initialisation configuration for a single machine.

type UserdataConfig

type UserdataConfig interface {
	// Configure is a convenience function that updates the cloudinit.Config
	// with appropriate configuration. It will run ConfigureBasic() and
	// ConfigureJuju()
	Configure() error

	// ConfigureBasic updates the provided cloudinit.Config with
	// basic configuration to initialise an OS image.
	ConfigureBasic() error

	// ConfigureJuju updates the provided cloudinit.Config with configuration
	// to initialise a Juju machine agent.
	ConfigureJuju() error

	// ConfigureCustomOverrides updates the provided cloudinit.Config with
	// user provided cloudinit data.  Data provided will overwrite current
	// values with three exceptions: preruncmd was handled in ConfigureBasic()
	// and packages and postruncmd were handled in ConfigureJuju().
	ConfigureCustomOverrides() error
}

UserdataConfig is the bridge between instancecfg and cloudinit It supports different levels of configuration for instances

func NewUserdataConfig

func NewUserdataConfig(icfg *instancecfg.InstanceConfig, conf cloudinit.CloudConfig) (UserdataConfig, error)

NewUserdataConfig is supposed to take in an instanceConfig as well as a cloudinit.cloudConfig and add attributes in the cloudinit structure based on the values inside instanceConfig and on the series

Directories

Path Synopsis
Package cloudinit implements a way of creating a cloud-init configuration file.
Package cloudinit implements a way of creating a cloud-init configuration file.
Package providerinit offers userdata in a gzipped format to be used by different cloud providers.
Package providerinit offers userdata in a gzipped format to be used by different cloud providers.
renderers
Package renderers implements a way to encode the userdata depending on the OS and the provider.
Package renderers implements a way to encode the userdata depending on the OS and the provider.

Jump to

Keyboard shortcuts

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