Documentation ¶
Index ¶
- Constants
- func Apply(cfg CloudConfig, env *Environment) error
- func ExtractIPsFromMetadata(contents []byte) (map[string]string, error)
- func ParseUserData(contents string) (interface{}, error)
- func PersistScriptInWorkspace(script system.Script, workspace string) (string, error)
- func PersistUnitNameInWorkspace(name string, workspace string) error
- func PrepWorkspace(workspace string) error
- func SSHImportGithubUser(system_user string, github_user string) error
- func SSHImportKeysFromURL(system_user string, url string) error
- type CloudConfig
- type CloudConfigFile
- type CloudConfigUnit
- type Environment
- func (e *Environment) Apply(data string) string
- func (e *Environment) ConfigRoot() string
- func (e *Environment) DefaultEnvironmentFile() *system.EnvFile
- func (e *Environment) NetconfType() string
- func (e *Environment) Root() string
- func (e *Environment) SSHKeyName() string
- func (e *Environment) SetSSHKeyName(name string)
- func (e *Environment) Workspace() string
- type EtcHosts
- type EtcdEnvironment
- type FleetEnvironment
- type OEMRelease
- type UpdateConfig
- type UserKey
Constants ¶
const DefaultIpv4Address = "127.0.0.1"
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
ExtractIPsFromMetaData parses a JSON blob in the OpenStack metadata service format, and returns a substitution map possibly containing private_ipv4 and public_ipv4 addresses
func ParseUserData ¶
func PrepWorkspace ¶
func SSHImportGithubUser ¶
func SSHImportKeysFromURL ¶
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
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
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 EtcdEnvironment ¶
func (EtcdEnvironment) String ¶
func (ee EtcdEnvironment) String() (out string)
type FleetEnvironment ¶ added in v0.7.0
func (FleetEnvironment) String ¶ added in v0.7.0
func (fe FleetEnvironment) String() (out string)
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
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