1
0
mirror of https://github.com/rancher/os.git synced 2025-09-04 00:04:25 +00:00

Merge branch 'deniseschannon-WIP'

This commit is contained in:
Darren Shepherd
2015-04-30 21:58:40 -07:00
6 changed files with 102 additions and 86 deletions

View File

@@ -76,7 +76,7 @@ The image supports RancherOS cloud config functionality. Additionally, it merges
* Add GCE daemon support. (Manages users) * Add GCE daemon support. (Manages users)
## Documentation for Rancher Labs ## Documentation for RancherOS
Please refer to our [website](http://rancherio.github.io/os/) to read all about RancherOS. It has detailed information on how it works, getting-started and other details. Please refer to our [website](http://rancherio.github.io/os/) to read all about RancherOS. It has detailed information on how it works, getting-started and other details.

View File

@@ -194,9 +194,9 @@ func Dump(private, full bool) (string, error) {
func (c *Config) configureConsole() error { func (c *Config) configureConsole() error {
if console, ok := c.SystemContainers[CONSOLE_CONTAINER]; ok { if console, ok := c.SystemContainers[CONSOLE_CONTAINER]; ok {
if c.Console.Persistent { if c.Console.Persistent {
console.Labels = append(console.Labels, REMOVE+"=false") console.Labels.MapParts()[REMOVE] = "false"
} else { } else {
console.Labels = append(console.Labels, REMOVE+"=true") console.Labels.MapParts()[REMOVE] = "true"
} }
} }

View File

@@ -79,10 +79,10 @@ func NewConfig() *Config {
"udev": { "udev": {
Net: "host", Net: "host",
Privileged: true, Privileged: true,
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
DETACH + "=false", DETACH: "false",
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
Volumes: []string{ Volumes: []string{
"/dev:/host/dev", "/dev:/host/dev",
"/lib/modules:/lib/modules", "/lib/modules:/lib/modules",
@@ -95,12 +95,13 @@ func NewConfig() *Config {
SystemContainers: map[string]*project.ServiceConfig{ SystemContainers: map[string]*project.ServiceConfig{
"udev": { "udev": {
Image: "udev", Image: "udev",
Restart: "always",
Net: "host", Net: "host",
Privileged: true, Privileged: true,
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
DETACH + "=true", DETACH: "true",
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
Environment: []string{ Environment: []string{
"DAEMON=true", "DAEMON=true",
}, },
@@ -113,10 +114,10 @@ func NewConfig() *Config {
Net: "none", Net: "none",
ReadOnly: true, ReadOnly: true,
Privileged: true, Privileged: true,
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
CREATE_ONLY + "=true", CREATE_ONLY: "true",
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
Volumes: []string{ Volumes: []string{
"/dev:/host/dev", "/dev:/host/dev",
"/var/lib/rancher/conf:/var/lib/rancher/conf", "/var/lib/rancher/conf:/var/lib/rancher/conf",
@@ -133,10 +134,10 @@ func NewConfig() *Config {
Net: "none", Net: "none",
ReadOnly: true, ReadOnly: true,
Privileged: true, Privileged: true,
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
CREATE_ONLY + "=true", CREATE_ONLY: "true",
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
Volumes: []string{ Volumes: []string{
"/init:/sbin/halt:ro", "/init:/sbin/halt:ro",
"/init:/sbin/poweroff:ro", "/init:/sbin/poweroff:ro",
@@ -158,10 +159,10 @@ func NewConfig() *Config {
Net: "none", Net: "none",
ReadOnly: true, ReadOnly: true,
Privileged: true, Privileged: true,
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
CREATE_ONLY + "=true", CREATE_ONLY: "true",
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
Volumes: []string{ Volumes: []string{
"/home:/home", "/home:/home",
"/opt:/opt", "/opt:/opt",
@@ -173,10 +174,10 @@ func NewConfig() *Config {
Net: "none", Net: "none",
ReadOnly: true, ReadOnly: true,
Privileged: true, Privileged: true,
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
CREATE_ONLY + "=true", CREATE_ONLY: "true",
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
Volumes: []string{ Volumes: []string{
"/var/lib/rancher:/var/lib/rancher", "/var/lib/rancher:/var/lib/rancher",
"/var/lib/docker:/var/lib/docker", "/var/lib/docker:/var/lib/docker",
@@ -189,10 +190,10 @@ func NewConfig() *Config {
Net: "none", Net: "none",
ReadOnly: true, ReadOnly: true,
Privileged: true, Privileged: true,
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
CREATE_ONLY + "=true", CREATE_ONLY: "true",
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
VolumesFrom: []string{ VolumesFrom: []string{
"docker-volumes", "docker-volumes",
"command-volumes", "command-volumes",
@@ -205,11 +206,11 @@ func NewConfig() *Config {
Image: "cloudinit", Image: "cloudinit",
Privileged: true, Privileged: true,
Net: "host", Net: "host",
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
RELOAD_CONFIG + "=true", RELOAD_CONFIG: "true",
DETACH + "=false", DETACH: "false",
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
Environment: []string{ Environment: []string{
"CLOUD_INIT_NETWORK=false", "CLOUD_INIT_NETWORK=false",
}, },
@@ -222,10 +223,10 @@ func NewConfig() *Config {
Image: "network", Image: "network",
Privileged: true, Privileged: true,
Net: "host", Net: "host",
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
DETACH + "=false", DETACH: "false",
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
Links: []string{ Links: []string{
"cloud-init-pre", "cloud-init-pre",
}, },
@@ -237,11 +238,11 @@ func NewConfig() *Config {
"cloud-init": { "cloud-init": {
Image: "cloudinit", Image: "cloudinit",
Privileged: true, Privileged: true,
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
RELOAD_CONFIG + "=true", RELOAD_CONFIG: "true",
DETACH + "=false", DETACH: "false",
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
Net: "host", Net: "host",
Links: []string{ Links: []string{
"cloud-init-pre", "cloud-init-pre",
@@ -254,11 +255,12 @@ func NewConfig() *Config {
}, },
"ntp": { "ntp": {
Image: "ntp", Image: "ntp",
Restart: "always",
Privileged: true, Privileged: true,
Net: "host", Net: "host",
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
Links: []string{ Links: []string{
"cloud-init", "cloud-init",
"network", "network",
@@ -266,11 +268,12 @@ func NewConfig() *Config {
}, },
"syslog": { "syslog": {
Image: "syslog", Image: "syslog",
Restart: "always",
Privileged: true, Privileged: true,
Net: "host", Net: "host",
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
VolumesFrom: []string{ VolumesFrom: []string{
"system-volumes", "system-volumes",
}, },
@@ -278,13 +281,14 @@ func NewConfig() *Config {
}, },
"userdocker": { "userdocker": {
Image: "userdocker", Image: "userdocker",
Restart: "always",
Privileged: true, Privileged: true,
Pid: "host", Pid: "host",
Ipc: "host", Ipc: "host",
Net: "host", Net: "host",
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
Links: []string{ Links: []string{
"network", "network",
}, },
@@ -295,10 +299,10 @@ func NewConfig() *Config {
"userdockerwait": { "userdockerwait": {
Image: "userdockerwait", Image: "userdockerwait",
Net: "host", Net: "host",
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
DETACH + "=false", DETACH: "false",
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
Links: []string{ Links: []string{
"userdocker", "userdocker",
}, },
@@ -312,9 +316,9 @@ func NewConfig() *Config {
Links: []string{ Links: []string{
"cloud-init", "cloud-init",
}, },
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
SCOPE + "=" + SYSTEM, SCOPE: SYSTEM,
}, }),
VolumesFrom: []string{ VolumesFrom: []string{
"all-volumes", "all-volumes",
}, },

View File

@@ -77,7 +77,7 @@ func (c *containerBasedService) Name() string {
} }
func isSystemService(serviceConfig *project.ServiceConfig) bool { func isSystemService(serviceConfig *project.ServiceConfig) bool {
return util.GetValue(serviceConfig.Labels, config.SCOPE) == config.SYSTEM return serviceConfig.Labels.MapParts()[config.SCOPE] == config.SYSTEM
} }
func (c *ContainerFactory) Create(project *project.Project, name string, serviceConfig *project.ServiceConfig) (project.Service, error) { func (c *ContainerFactory) Create(project *project.Project, name string, serviceConfig *project.ServiceConfig) (project.Service, error) {

View File

@@ -79,10 +79,10 @@ outer:
Privileged: true, Privileged: true,
Image: "autoformat", Image: "autoformat",
Command: format, Command: format,
Labels: []string{ Labels: project.NewSliceorMap(map[string]string{
config.DETACH + "=false", config.DETACH: "false",
config.SCOPE + "=" + config.SYSTEM, config.SCOPE: config.SYSTEM,
}, }),
LogDriver: "json-file", LogDriver: "json-file",
Environment: []string{ Environment: []string{
"MAGIC=" + boot2dockerMagic, "MAGIC=" + boot2dockerMagic,

View File

@@ -18,6 +18,27 @@ INITRD_CURRENT=${BUILD}/initrd-current
INITRD_TEST=${BUILD}/initrd.test INITRD_TEST=${BUILD}/initrd.test
USER_DATA=cloud-init/openstack/latest/user_data USER_DATA=cloud-init/openstack/latest/user_data
while [ "$#" -gt 0 ]; do
case $1 in
--append)
shift 1
QEMU_APPEND="${QEMU_APPEND} $1"
;;
--cloud-config)
shift 1
CLOUD_CONFIG=$(readlink -f "$1") || :
if [ ! -f ${CLOUD_CONFIG} ]; then
echo No such file: "'"${CLOUD_CONFIG}"'" 1>&2
exit 1
fi
;;
*)
break
;;
esac
shift 1
done
if [[ ! -e ${KERNEL} || ! -e ${INITRD} ]]; then if [[ ! -e ${KERNEL} || ! -e ${INITRD} ]]; then
echo "Failed to find ${KERNEL} or ${INITRD}" 1>&2 echo "Failed to find ${KERNEL} or ${INITRD}" 1>&2
exit 1 exit 1
@@ -56,26 +77,17 @@ fi
mkdir -p $(dirname $USER_DATA) mkdir -p $(dirname $USER_DATA)
echo "#cloud-config" > ${USER_DATA} if [ -n "$CLOUD_CONFIG" ]; then
echo "ssh_authorized_keys:" >> ${USER_DATA} cat ${CLOUD_CONFIG} > ${USER_DATA}
for i in ${HOME}/.ssh/*.pub; do else
if [ -e $i ]; then echo "#cloud-config" > ${USER_DATA}
echo " - $(<$i)" >> ${USER_DATA} echo "ssh_authorized_keys:" >> ${USER_DATA}
fi for i in ${HOME}/.ssh/*.pub; do
done if [ -e $i ]; then
echo " - $(<$i)" >> ${USER_DATA}
while [ "$#" -gt 0 ]; do fi
case $1 in done
--append) fi
shift 1
QEMU_APPEND="${QEMU_APPEND} $1"
;;
*)
break
;;
esac
shift 1
done
qemu-system-x86_64 -serial stdio \ qemu-system-x86_64 -serial stdio \
-kernel ${KERNEL} \ -kernel ${KERNEL} \