1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 14:23:11 +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)
## 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.

View File

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

View File

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

View File

@@ -77,7 +77,7 @@ func (c *containerBasedService) Name() string {
}
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) {

View File

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

View File

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