1
0
mirror of https://github.com/rancher/os.git synced 2025-06-03 04:10:20 +00:00
os/config/types.go

133 lines
4.9 KiB
Go
Raw Normal View History

2015-03-15 04:27:04 +00:00
package config
import "github.com/rancherio/rancher-compose/project"
2015-03-15 04:27:04 +00:00
const (
2015-04-10 14:32:32 +00:00
DEFAULT_IMAGE_VERSION = "v0.3.0-rc2"
CONSOLE_CONTAINER = "console"
DOCKER_BIN = "/usr/bin/docker"
DOCKER_SYSTEM_HOME = "/var/lib/system-docker"
DOCKER_SYSTEM_HOST = "unix:///var/run/system-docker.sock"
DOCKER_HOST = "unix:///var/run/docker.sock"
IMAGES_PATH = "/"
IMAGES_PATTERN = "images*.tar"
SYS_INIT = "/sbin/init-sys"
USER_INIT = "/sbin/init-user"
MODULES_ARCHIVE = "/modules.tar"
DEBUG = false
LABEL = "label"
HASH = "io.rancher.os.hash"
ID = "io.rancher.os.id"
DETACH = "io.rancher.os.detach"
REMOVE = "io.rancher.os.remove"
CREATE_ONLY = "io.rancher.os.createonly"
RELOAD_CONFIG = "io.rancher.os.reloadconfig"
2015-03-15 04:27:04 +00:00
)
var (
2015-03-20 18:35:21 +00:00
VERSION string
IMAGE_VERSION string
2015-03-18 13:23:27 +00:00
CloudConfigFile = "/var/lib/rancher/conf/cloud-config-rancher.yml"
2015-03-15 04:27:04 +00:00
ConfigFile = "/var/lib/rancher/conf/rancher.yml"
PrivateConfigFile = "/var/lib/rancher/conf/rancher-private.yml"
)
type ContainerConfig struct {
Id string `yaml:"id,omitempty"`
Cmd string `yaml:"run,omitempty"`
MigrateVolumes bool `yaml:"migrate_volumes,omitempty"`
ReloadConfig bool `yaml:"reload_config,omitempty"`
CreateOnly bool `yaml:create_only,omitempty`
Service *project.ServiceConfig `yaml:service,omitempty`
2015-03-15 04:27:04 +00:00
}
type Config struct {
2015-04-16 06:16:23 +00:00
Environment map[string]string `yaml:"environment,omitempty"`
BundledServices map[string]Config `yaml:"bundled_services,omitempty"`
BootstrapContainers map[string]*project.ServiceConfig `yaml:"bootstrap_containers,omitempty"`
2015-04-03 21:59:24 +00:00
BootstrapDocker DockerConfig `yaml:"bootstrap_docker,omitempty"`
CloudInit CloudInit `yaml:"cloud_init,omitempty"`
Console ConsoleConfig `yaml:"console,omitempty"`
Debug bool `yaml:"debug,omitempty"`
Disable []string `yaml:"disable,omitempty"`
2015-04-16 06:16:23 +00:00
Services map[string]bool `yaml:"services,omitempty"`
Modules []string `yaml:"modules,omitempty"`
Network NetworkConfig `yaml:"network,omitempty"`
Ssh SshConfig `yaml:"ssh,omitempty"`
State StateConfig `yaml:"state,omitempty"`
SystemContainers map[string]*project.ServiceConfig `yaml:"system_containers,omitempty"`
SystemDocker DockerConfig `yaml:"system_docker,omitempty"`
Upgrade UpgradeConfig `yaml:"upgrade,omitempty"`
UserContainers []ContainerConfig `yaml:"user_containers,omitempty"`
UserDocker DockerConfig `yaml:"user_docker,omitempty"`
2015-03-15 05:21:22 +00:00
}
type ConsoleConfig struct {
2015-03-18 13:23:27 +00:00
Tail bool `yaml:"tail,omitempty"`
Persistent bool `yaml:"persistent,omitempty"`
2015-03-15 04:27:04 +00:00
}
type UpgradeConfig struct {
2015-03-19 21:57:53 +00:00
Url string `yaml:"url,omitempty"`
Image string `yaml:"image,omitempty"`
Rollback string `yaml:"rollback,omitempty"`
2015-03-15 04:27:04 +00:00
}
2015-03-18 13:23:27 +00:00
type DnsConfig struct {
Nameservers []string `yaml:"nameservers,flow,omitempty"`
Search []string `yaml:"search,flow,omitempty"`
Domain string `yaml:"domain,omitempty"`
}
2015-03-15 04:27:04 +00:00
type NetworkConfig struct {
2015-03-18 13:23:27 +00:00
Dns DnsConfig `yaml:"dns,omitempty"`
Interfaces map[string]InterfaceConfig `yaml:"interfaces,omitempty"`
PostRun *ContainerConfig `yaml:"post_run,omitempty"`
2015-03-15 04:27:04 +00:00
}
type InterfaceConfig struct {
Match string `yaml:"match,omitempty"`
DHCP bool `yaml:"dhcp,omitempty"`
Address string `yaml:"address,omitempty"`
2015-03-25 09:39:27 +00:00
IPV4LL bool `yaml:"ipv4ll,omitempty"`
2015-03-15 04:27:04 +00:00
Gateway string `yaml:"gateway,omitempty"`
MTU int `yaml:"mtu,omitempty"`
2015-04-03 21:59:24 +00:00
Bridge bool `yaml:"bridge,omitempty"`
2015-03-15 04:27:04 +00:00
}
2015-03-18 13:23:27 +00:00
type DockerConfig struct {
TLS bool `yaml:"tls,omitempty"`
TLSArgs []string `yaml:"tls_args,flow,omitempty"`
Args []string `yaml:"args,flow,omitempty"`
2015-04-03 21:59:24 +00:00
ExtraArgs []string `yaml:"extra_args,flow,omitempty"`
2015-03-18 13:23:27 +00:00
ServerCert string `yaml:"server_cert,omitempty"`
ServerKey string `yaml:"server_key,omitempty"`
CACert string `yaml:"ca_cert,omitempty"`
CAKey string `yaml:"ca_key,omitempty"`
2015-03-15 04:27:04 +00:00
}
type SshConfig struct {
Keys map[string]string `yaml:"keys,omitempty"`
}
2015-03-18 13:23:27 +00:00
type StateConfig struct {
FsType string `yaml:"fstype,omitempty"`
Dev string `yaml:"dev,omitempty"`
Required bool `yaml:"required,omitempty"`
Autoformat []string `yaml:"autoformat,omitempty"`
2015-03-15 04:27:04 +00:00
}
type CloudInit struct {
Datasources []string `yaml:"datasources,omitempty"`
}
2015-03-20 18:35:21 +00:00
func init() {
if VERSION == "" {
VERSION = "v0.0.0-dev"
}
if IMAGE_VERSION == "" {
2015-04-10 14:32:32 +00:00
IMAGE_VERSION = DEFAULT_IMAGE_VERSION
}
2015-03-20 18:35:21 +00:00
}