mirror of
https://github.com/rancher/os.git
synced 2025-08-09 18:48:05 +00:00
Changes required due to labels type change in ServiceConfig
This commit is contained in:
parent
5eeba6e070
commit
0e4f0fe292
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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",
|
||||||
@ -98,10 +98,10 @@ func NewConfig() *Config {
|
|||||||
Restart: "always",
|
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",
|
||||||
},
|
},
|
||||||
@ -114,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",
|
||||||
@ -134,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",
|
||||||
@ -159,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",
|
||||||
@ -174,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",
|
||||||
@ -190,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",
|
||||||
@ -206,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",
|
||||||
},
|
},
|
||||||
@ -223,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",
|
||||||
},
|
},
|
||||||
@ -238,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",
|
||||||
@ -258,9 +258,9 @@ func NewConfig() *Config {
|
|||||||
Restart: "always",
|
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",
|
||||||
@ -271,9 +271,9 @@ func NewConfig() *Config {
|
|||||||
Restart: "always",
|
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",
|
||||||
},
|
},
|
||||||
@ -286,9 +286,9 @@ func NewConfig() *Config {
|
|||||||
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",
|
||||||
},
|
},
|
||||||
@ -299,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",
|
||||||
},
|
},
|
||||||
@ -316,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",
|
||||||
},
|
},
|
||||||
|
@ -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) {
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user