juju: github.com/wallyworld/juju/cloudconfig Index | Files | Directories

package cloudconfig

import "github.com/wallyworld/juju/cloudconfig"


Package Files

machinecloudconfig.go userdatacfg.go userdatacfg_unix.go userdatacfg_win.go winuserdata.go winuserdatawrapper.go


const (
    // FileNameBootstrapParams is the name of bootstrap params file.
    FileNameBootstrapParams = "bootstrap-params"
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"
const UserDataScript = "" /* 1517 byte string literal not displayed */


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

func SetUbuntuUser Uses

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. On precise, the default cloudinit version is too old to support the users option, so instead rely on the default user being created and adding keys. It may make sense in the future to add a "juju" user instead across all distributions.

type InitReader Uses

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 Uses

func NewMachineInitReader(series string) (InitReader, error)

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

func NewMachineInitReaderFromConfig Uses

func NewMachineInitReaderFromConfig(cfg MachineInitReaderConfig) InitReader

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

type MachineInitReader Uses

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 Uses

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

func (*MachineInitReader) GetInitConfig Uses

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 Uses

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 Uses

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 Uses

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


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

Package cloudconfig imports 32 packages (graph). Updated 2020-07-30. Refresh now. Tools for package owners.