initialize

package
v0.10.9 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2014 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultIpv4Address = "127.0.0.1"
View Source
const DefaultSSHKeyName = "coreos-cloudinit"

Variables

This section is empty.

Functions

func Apply

func Apply(cfg CloudConfig, env *Environment) error

Apply renders a CloudConfig to an Environment. This can involve things like configuring the hostname, adding new users, writing various configuration files to disk, and manipulating systemd services.

func ExtractIPsFromMetadata added in v0.8.0

func ExtractIPsFromMetadata(contents []byte) (map[string]string, error)

ExtractIPsFromMetaData parses a JSON blob in the OpenStack metadata service format and returns a substitution map possibly containing private_ipv4, public_ipv4, private_ipv6, and public_ipv6 addresses.

func ParseUserData

func ParseUserData(contents string) (interface{}, error)

func PersistScriptInWorkspace

func PersistScriptInWorkspace(script system.Script, workspace string) (string, error)

func PersistUnitNameInWorkspace

func PersistUnitNameInWorkspace(name string, workspace string) error

func PrepWorkspace

func PrepWorkspace(workspace string) error

func SSHImportGithubUser

func SSHImportGithubUser(system_user string, github_user string) error

func SSHImportKeysFromURL

func SSHImportKeysFromURL(system_user string, url string) error

Types

type CloudConfig

type CloudConfig struct {
	SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys"`
	Coreos            struct {
		Etcd   EtcdEnvironment
		Fleet  FleetEnvironment
		OEM    OEMRelease
		Update UpdateConfig
		Units  []system.Unit
	}
	WriteFiles        []system.File `yaml:"write_files"`
	Hostname          string
	Users             []system.User
	ManageEtcHosts    EtcHosts `yaml:"manage_etc_hosts"`
	NetworkConfigPath string
	NetworkConfig     string
}

CloudConfig encapsulates the entire cloud-config configuration file and maps directly to YAML

func NewCloudConfig

func NewCloudConfig(contents string) (*CloudConfig, error)

NewCloudConfig instantiates a new CloudConfig from the given contents (a string of YAML), returning any error encountered. It will ignore unknown fields but log encountering them.

func ParseMetaData added in v0.8.0

func ParseMetaData(contents string) (*CloudConfig, error)

ParseMetaData parses a JSON blob in the OpenStack metadata service format, and converts it to a partially hydrated CloudConfig.

func (CloudConfig) String

func (cc CloudConfig) String() string

type CloudConfigFile added in v0.7.0

type CloudConfigFile interface {
	// File should either return (*system.File, error), or (nil, nil) if nothing
	// needs to be done for this configuration option.
	File(root string) (*system.File, error)
}

CloudConfigFile represents a CoreOS specific configuration option that can generate an associated system.File to be written to disk

type CloudConfigUnit added in v0.7.0

type CloudConfigUnit interface {
	Units(root string) ([]system.Unit, error)
}

CloudConfigUnit represents a CoreOS specific configuration option that can generate associated system.Units to be created/enabled appropriately

type Environment

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

func NewEnvironment

func NewEnvironment(root, configRoot, workspace, netconfType, sshKeyName string, substitutions map[string]string) *Environment

TODO(jonboulle): this is getting unwieldy, should be able to simplify the interface somehow

func (*Environment) Apply

func (e *Environment) Apply(data string) string

Apply goes through the map of substitutions and replaces all instances of the keys with their respective values. It supports escaping substitutions with a leading '\'.

func (*Environment) ConfigRoot added in v0.8.0

func (e *Environment) ConfigRoot() string

func (*Environment) DefaultEnvironmentFile added in v0.8.8

func (e *Environment) DefaultEnvironmentFile() *system.EnvFile

func (*Environment) NetconfType added in v0.8.0

func (e *Environment) NetconfType() string

func (*Environment) Root

func (e *Environment) Root() string

func (*Environment) SSHKeyName

func (e *Environment) SSHKeyName() string

func (*Environment) SetSSHKeyName

func (e *Environment) SetSSHKeyName(name string)

func (*Environment) Workspace

func (e *Environment) Workspace() string

type EtcHosts added in v0.7.0

type EtcHosts string

func (EtcHosts) File added in v0.7.0

func (eh EtcHosts) File(root string) (*system.File, error)

type EtcdEnvironment

type EtcdEnvironment map[string]string

func (EtcdEnvironment) String

func (ee EtcdEnvironment) String() (out string)

func (EtcdEnvironment) Units added in v0.7.5

func (ee EtcdEnvironment) Units(root string) ([]system.Unit, error)

Units creates a Unit file drop-in for etcd, using any configured options and adding a default MachineID if unset.

type FleetEnvironment added in v0.7.0

type FleetEnvironment map[string]string

func (FleetEnvironment) String added in v0.7.0

func (fe FleetEnvironment) String() (out string)

func (FleetEnvironment) Units added in v0.7.5

func (fe FleetEnvironment) Units(root string) ([]system.Unit, error)

Units generates a Unit file drop-in for fleet, if any fleet options were configured in cloud-config

type OEMRelease

type OEMRelease struct {
	ID           string `yaml:"id"`
	Name         string `yaml:"name"`
	VersionID    string `yaml:"version-id"`
	HomeURL      string `yaml:"home-url"`
	BugReportURL string `yaml:"bug-report-url"`
}

func (OEMRelease) File added in v0.7.0

func (oem OEMRelease) File(root string) (*system.File, error)

func (OEMRelease) String

func (oem OEMRelease) String() string

type UpdateConfig added in v0.7.0

type UpdateConfig map[string]string

func (UpdateConfig) File added in v0.7.0

func (uc UpdateConfig) File(root string) (*system.File, error)

File generates an `/etc/coreos/update.conf` file (if any update configuration options are set in cloud-config) by either rewriting the existing file on disk, or starting from `/usr/share/coreos/update.conf`

func (UpdateConfig) Units added in v0.7.5

func (uc UpdateConfig) Units(root string) ([]system.Unit, error)

Units generates units for the cloud-init initializer to act on: - a locksmith system.Unit, if "reboot-strategy" was set in cloud-config - an update_engine system.Unit, if "group" was set in cloud-config

type UserKey

type UserKey struct {
	ID  int    `json:"id,omitempty"`
	Key string `json:"key"`
}

Jump to

Keyboard shortcuts

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