config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertStructValid added in v0.11.0

func AssertStructValid(c interface{}) error

AssertStructValid checks the fields in the structure and makes sure that they contain valid values as specified by the 'valid' flag. Empty fields are implicitly valid.

func DecodeBase64Content added in v1.2.0

func DecodeBase64Content(content string) ([]byte, error)

func DecodeContent added in v1.2.0

func DecodeContent(content string, encoding string) ([]byte, error)

func DecodeGzipContent added in v1.2.0

func DecodeGzipContent(content string) ([]byte, error)

func IsCloudConfig added in v0.11.0

func IsCloudConfig(userdata string) bool

func IsScript added in v0.11.0

func IsScript(userdata string) bool

func IsZero

func IsZero(c interface{}) bool

IsZero returns whether or not the parameter is the zero value for its type. If the parameter is a struct, only the exported fields are considered.

Types

type CloudConfig

type CloudConfig struct {
	SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys"`
	CoreOS            CoreOS   `yaml:"coreos"`
	WriteFiles        []File   `yaml:"write_files"`
	Hostname          string   `yaml:"hostname"`
	Users             []User   `yaml:"users"`
	ManageEtcHosts    EtcHosts `yaml:"manage_etc_hosts"`
}

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.

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 (CloudConfig) String

func (cc CloudConfig) String() string

type CoreOS added in v1.1.0

type CoreOS struct {
	Etcd      Etcd      `yaml:"etcd"`
	Flannel   Flannel   `yaml:"flannel"`
	Fleet     Fleet     `yaml:"fleet"`
	Locksmith Locksmith `yaml:"locksmith"`
	OEM       OEM       `yaml:"oem"`
	Update    Update    `yaml:"update"`
	Units     []Unit    `yaml:"units"`
}

type ErrorValid added in v0.11.0

type ErrorValid struct {
	Value string
	Valid string
	Field string
}

func AssertValid

func AssertValid(value reflect.Value, valid string) *ErrorValid

AssertValid checks to make sure that the given value is in the list of valid values. Zero values are implicitly valid.

func (ErrorValid) Error added in v0.11.0

func (e ErrorValid) Error() string

type EtcHosts

type EtcHosts string

type Etcd

type Etcd struct {
	Addr                     string  `yaml:"addr"                          env:"ETCD_ADDR"`
	AdvertiseClientURLs      string  `yaml:"advertise_client_urls"         env:"ETCD_ADVERTISE_CLIENT_URLS"`
	BindAddr                 string  `yaml:"bind_addr"                     env:"ETCD_BIND_ADDR"`
	CAFile                   string  `yaml:"ca_file"                       env:"ETCD_CA_FILE"`
	CertFile                 string  `yaml:"cert_file"                     env:"ETCD_CERT_FILE"`
	ClusterActiveSize        int     `yaml:"cluster_active_size"           env:"ETCD_CLUSTER_ACTIVE_SIZE"`
	ClusterRemoveDelay       float64 `yaml:"cluster_remove_delay"          env:"ETCD_CLUSTER_REMOVE_DELAY"`
	ClusterSyncInterval      float64 `yaml:"cluster_sync_interval"         env:"ETCD_CLUSTER_SYNC_INTERVAL"`
	CorsOrigins              string  `yaml:"cors"                          env:"ETCD_CORS"`
	DataDir                  string  `yaml:"data_dir"                      env:"ETCD_DATA_DIR"`
	Discovery                string  `yaml:"discovery"                     env:"ETCD_DISCOVERY"`
	DiscoveryFallback        string  `yaml:"discovery_fallback"            env:"ETCD_DISCOVERY_FALLBACK"`
	DiscoverySRV             string  `yaml:"discovery_srv"                 env:"ETCD_DISCOVERY_SRV"`
	DiscoveryProxy           string  `yaml:"discovery_proxy"               env:"ETCD_DISCOVERY_PROXY"`
	ElectionTimeout          int     `yaml:"election_timeout"              env:"ETCD_ELECTION_TIMEOUT"`
	ForceNewCluster          bool    `yaml:"force_new_cluster"             env:"ETCD_FORCE_NEW_CLUSTER"`
	GraphiteHost             string  `yaml:"graphite_host"                 env:"ETCD_GRAPHITE_HOST"`
	HeartbeatInterval        int     `yaml:"heartbeat_interval"            env:"ETCD_HEARTBEAT_INTERVAL"`
	HTTPReadTimeout          float64 `yaml:"http_read_timeout"             env:"ETCD_HTTP_READ_TIMEOUT"`
	HTTPWriteTimeout         float64 `yaml:"http_write_timeout"            env:"ETCD_HTTP_WRITE_TIMEOUT"`
	InitialAdvertisePeerURLs string  `yaml:"initial_advertise_peer_urls"   env:"ETCD_INITIAL_ADVERTISE_PEER_URLS"`
	InitialCluster           string  `yaml:"initial_cluster"               env:"ETCD_INITIAL_CLUSTER"`
	InitialClusterState      string  `yaml:"initial_cluster_state"         env:"ETCD_INITIAL_CLUSTER_STATE"`
	InitialClusterToken      string  `yaml:"initial_cluster_token"         env:"ETCD_INITIAL_CLUSTER_TOKEN"`
	KeyFile                  string  `yaml:"key_file"                      env:"ETCD_KEY_FILE"`
	ListenClientURLs         string  `yaml:"listen_client_urls"            env:"ETCD_LISTEN_CLIENT_URLS"`
	ListenPeerURLs           string  `yaml:"listen_peer_urls"              env:"ETCD_LISTEN_PEER_URLS"`
	MaxResultBuffer          int     `yaml:"max_result_buffer"             env:"ETCD_MAX_RESULT_BUFFER"`
	MaxRetryAttempts         int     `yaml:"max_retry_attempts"            env:"ETCD_MAX_RETRY_ATTEMPTS"`
	MaxSnapshots             int     `yaml:"max_snapshots"                 env:"ETCD_MAX_SNAPSHOTS"`
	MaxWALs                  int     `yaml:"max_wals"                      env:"ETCD_MAX_WALS"`
	Name                     string  `yaml:"name"                          env:"ETCD_NAME"`
	PeerAddr                 string  `yaml:"peer_addr"                     env:"ETCD_PEER_ADDR"`
	PeerBindAddr             string  `yaml:"peer_bind_addr"                env:"ETCD_PEER_BIND_ADDR"`
	PeerCAFile               string  `yaml:"peer_ca_file"                  env:"ETCD_PEER_CA_FILE"`
	PeerCertFile             string  `yaml:"peer_cert_file"                env:"ETCD_PEER_CERT_FILE"`
	PeerElectionTimeout      int     `yaml:"peer_election_timeout"         env:"ETCD_PEER_ELECTION_TIMEOUT"`
	PeerHeartbeatInterval    int     `yaml:"peer_heartbeat_interval"       env:"ETCD_PEER_HEARTBEAT_INTERVAL"`
	PeerKeyFile              string  `yaml:"peer_key_file"                 env:"ETCD_PEER_KEY_FILE"`
	Peers                    string  `yaml:"peers"                         env:"ETCD_PEERS"`
	PeersFile                string  `yaml:"peers_file"                    env:"ETCD_PEERS_FILE"`
	Proxy                    string  `yaml:"proxy"                         env:"ETCD_PROXY"`
	RetryInterval            float64 `yaml:"retry_interval"                env:"ETCD_RETRY_INTERVAL"`
	Snapshot                 bool    `yaml:"snapshot"                      env:"ETCD_SNAPSHOT"`
	SnapshotCount            int     `yaml:"snapshot_count"                env:"ETCD_SNAPSHOTCOUNT"`
	StrTrace                 string  `yaml:"trace"                         env:"ETCD_TRACE"`
	Verbose                  bool    `yaml:"verbose"                       env:"ETCD_VERBOSE"`
	VeryVerbose              bool    `yaml:"very_verbose"                  env:"ETCD_VERY_VERBOSE"`
	VeryVeryVerbose          bool    `yaml:"very_very_verbose"             env:"ETCD_VERY_VERY_VERBOSE"`
}

type File

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

type Flannel added in v0.11.1

type Flannel struct {
	EtcdEndpoints string `yaml:"etcd_endpoints" env:"FLANNELD_ETCD_ENDPOINTS"`
	EtcdCAFile    string `yaml:"etcd_cafile"    env:"FLANNELD_ETCD_CAFILE"`
	EtcdCertFile  string `yaml:"etcd_certfile"  env:"FLANNELD_ETCD_CERTFILE"`
	EtcdKeyFile   string `yaml:"etcd_keyfile"   env:"FLANNELD_ETCD_KEYFILE"`
	EtcdPrefix    string `yaml:"etcd_prefix"    env:"FLANNELD_ETCD_PREFIX"`
	IPMasq        string `yaml:"ip_masq"        env:"FLANNELD_IP_MASQ"`
	SubnetFile    string `yaml:"subnet_file"    env:"FLANNELD_SUBNET_FILE"`
	Iface         string `yaml:"interface"      env:"FLANNELD_IFACE"`
}

type Fleet

type Fleet struct {
	AgentTTL                string  `yaml:"agent_ttl"                 env:"FLEET_AGENT_TTL"`
	EngineReconcileInterval float64 `yaml:"engine_reconcile_interval" env:"FLEET_ENGINE_RECONCILE_INTERVAL"`
	EtcdCAFile              string  `yaml:"etcd_cafile"               env:"FLEET_ETCD_CAFILE"`
	EtcdCertFile            string  `yaml:"etcd_certfile"             env:"FLEET_ETCD_CERTFILE"`
	EtcdKeyFile             string  `yaml:"etcd_keyfile"              env:"FLEET_ETCD_KEYFILE"`
	EtcdKeyPrefix           string  `yaml:"etcd_key_prefix"           env:"FLEET_ETCD_KEY_PREFIX"`
	EtcdRequestTimeout      float64 `yaml:"etcd_request_timeout"      env:"FLEET_ETCD_REQUEST_TIMEOUT"`
	EtcdServers             string  `yaml:"etcd_servers"              env:"FLEET_ETCD_SERVERS"`
	Metadata                string  `yaml:"metadata"                  env:"FLEET_METADATA"`
	PublicIP                string  `yaml:"public_ip"                 env:"FLEET_PUBLIC_IP"`
	Verbosity               int     `yaml:"verbosity"                 env:"FLEET_VERBOSITY"`
}

type Locksmith added in v1.0.2

type Locksmith struct {
	Endpoint     string `yaml:"endpoint"      env:"LOCKSMITHD_ENDPOINT"`
	EtcdCAFile   string `yaml:"etcd_cafile"   env:"LOCKSMITHD_ETCD_CAFILE"`
	EtcdCertFile string `yaml:"etcd_certfile" env:"LOCKSMITHD_ETCD_CERTFILE"`
	EtcdKeyFile  string `yaml:"etcd_keyfile"  env:"LOCKSMITHD_ETCD_KEYFILE"`
}

type OEM

type OEM 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"`
}

type Script added in v0.11.0

type Script []byte

func NewScript added in v0.11.0

func NewScript(userdata string) (*Script, error)

type Unit

type Unit struct {
	Name    string       `yaml:"name"`
	Mask    bool         `yaml:"mask"`
	Enable  bool         `yaml:"enable"`
	Runtime bool         `yaml:"runtime"`
	Content string       `yaml:"content"`
	Command string       `yaml:"command" valid:"^(start|stop|restart|reload|try-restart|reload-or-restart|reload-or-try-restart)$"`
	DropIns []UnitDropIn `yaml:"drop_ins"`
}

type UnitDropIn added in v1.0.0

type UnitDropIn struct {
	Name    string `yaml:"name"`
	Content string `yaml:"content"`
}

type Update

type Update struct {
	RebootStrategy string `yaml:"reboot_strategy" env:"REBOOT_STRATEGY" valid:"^(best-effort|etcd-lock|reboot|off)$"`
	Group          string `yaml:"group"           env:"GROUP"`
	Server         string `yaml:"server"          env:"SERVER"`
}

type User

type User struct {
	Name                 string   `yaml:"name"`
	PasswordHash         string   `yaml:"passwd"`
	SSHAuthorizedKeys    []string `yaml:"ssh_authorized_keys"`
	SSHImportGithubUser  string   `yaml:"coreos_ssh_import_github"`
	SSHImportGithubUsers []string `yaml:"coreos_ssh_import_github_users"`
	SSHImportURL         string   `yaml:"coreos_ssh_import_url"`
	GECOS                string   `yaml:"gecos"`
	Homedir              string   `yaml:"homedir"`
	NoCreateHome         bool     `yaml:"no_create_home"`
	PrimaryGroup         string   `yaml:"primary_group"`
	Groups               []string `yaml:"groups"`
	NoUserGroup          bool     `yaml:"no_user_group"`
	System               bool     `yaml:"system"`
	NoLogInit            bool     `yaml:"no_log_init"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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