cloudinitfile

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Useful for 1 allowing the user to update the cloud-init file without restarting the serer. Also validates a users cloud-init data and has helpers for managing milpa data

Index

Constants

This section is empty.

Variables

View Source
var (
	ItzoVersionPath = itzoDir + "/itzo_version"
	ItzoURLPath     = itzoDir + "/itzo_url"
	CellConfigPath  = itzoDir + "/cell_config.yaml"
)

Functions

This section is empty.

Types

type CloudConfig added in v0.0.6

type CloudConfig struct {
	SSHAuthorizedKeys []string        `yaml:"ssh_authorized_keys,omitempty"`
	WriteFiles        []CloudInitFile `yaml:"write_files,omitempty"`
	Hostname          string          `yaml:"hostname,omitempty"`
	Users             []User          `yaml:"users,omitempty"`
	RunCmd            []string        `yaml:"runcmd,omitempty"`
	// this one is legacy, can be removed when no more kip controllers use it
	MilpaFiles []CloudInitFile `yaml:"milpa_files,omitempty"`
}

CloudConfig encapsulates the entire cloud-config configuration file and maps directly to YAML. Fields that cannot be set in the cloud-config (fields used for internal use) have the YAML tag '-' so that they aren't marshalled.

type CloudInitFile added in v0.0.6

type CloudInitFile struct {
	Encoding           string `yaml:"encoding,omitempty" valid:"^(base64|b64|gz|gzip|gz\\+base64|gzip\\+base64|gz\\+b64|gzip\\+b64)$"`
	Content            string `yaml:"content,omitempty"`
	Owner              string `yaml:"owner,omitempty"`
	Path               string `yaml:"path,omitempty"`
	RawFilePermissions string `yaml:"permissions,omitempty" valid:"^0?[0-7]{3,4}$"`
}

type File

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

func New

func New(path string) (*File, error)

func (*File) AddCellConfig added in v0.0.6

func (f *File) AddCellConfig(cfg map[string]string)

func (*File) AddItzoURL

func (f *File) AddItzoURL(url string)

func (*File) AddItzoVersion

func (f *File) AddItzoVersion(version string)

Adds an itzo version number to cloud-init file. If the user didn't specify "latest" but they left off the leading 'v' then add it on (itzo files are named like: itzo-v1.2.3)

func (*File) AddKipFile

func (f *File) AddKipFile(content, path, permissions string)

func (*File) Contents

func (f *File) Contents() ([]byte, error)

func (*File) ResetInstanceData

func (f *File) ResetInstanceData()

type User added in v0.0.6

type User struct {
	Name                 string   `yaml:"name,omitempty"`
	PasswordHash         string   `yaml:"passwd,omitempty"`
	SSHAuthorizedKeys    []string `yaml:"ssh_authorized_keys,omitempty"`
	SSHImportGithubUser  string   `` /* 139-byte string literal not displayed */
	SSHImportGithubUsers []string `` /* 139-byte string literal not displayed */
	SSHImportURL         string   `` /* 139-byte string literal not displayed */
	GECOS                string   `yaml:"gecos,omitempty"`
	Homedir              string   `yaml:"homedir,omitempty"`
	NoCreateHome         bool     `yaml:"no_create_home,omitempty"`
	PrimaryGroup         string   `yaml:"primary_group,omitempty"`
	Groups               []string `yaml:"groups,omitempty"`
	NoUserGroup          bool     `yaml:"no_user_group,omitempty"`
	System               bool     `yaml:"system,omitempty"`
	NoLogInit            bool     `yaml:"no_log_init,omitempty"`
	Shell                string   `yaml:"shell,omitempty"`
}

Jump to

Keyboard shortcuts

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