cloudconfig

package
v0.0.0-...-298751d Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 28 Imported by: 40

Documentation

Index

Constants

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

	// We look to see if the proxy line is there already as
	// the manual provider may have had it already.
	// We write this file out whether we are using the legacy proxy
	// or the juju proxy to deal with runtime changes. The proxy updater worker
	// only modifies /etc/juju-proxy.conf, so if changes are written to that file
	// we need to make sure the profile.d file exists to reflect these changes.
	// If the new juju proxies are used, the legacy proxies will not be set, and the
	// /etc/juju-proxy.conf file will be empty.
	JujuProxyProfileScript = `` /* 210-byte string literal not displayed */

)
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"}
)

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(base corebase.Base) (InitReader, error)

NewMachineInitReader creates and returns a new MachineInitReader for the input os name.

func NewMachineInitReaderFromConfig

func NewMachineInitReaderFromConfig(cfg MachineInitReaderConfig) InitReader

NewMachineInitReaderFromConfig 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 {
	// Base is the base of the machine.
	Base corebase.Base

	// 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