Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docker labels #1173

Merged
merged 2 commits into from
Jul 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions sdk/instance/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ func (i *Instance) start(inst *instance.Instance, imageHash string, env []string
// After solving this by docker, switch back to deploy in parallel
configs := make([]container.ServiceOptions, 0)

labels := map[string]string{
"mesg.service": srv.Name,
"mesg.hash": inst.Hash.String(),
"mesg.sid": srv.Sid,
"mesg.engine": conf.Name,
}

// Create dependency container configs
for _, d := range srv.Dependencies {
volumes := extractVolumes(srv, d)
Expand All @@ -51,13 +44,19 @@ func (i *Instance) start(inst *instance.Instance, imageHash string, env []string
}
configs = append(configs, container.ServiceOptions{
Namespace: dependencyNamespace(instNamespace, d.Key),
Labels: labels,
Image: d.Image,
Args: d.Args,
Command: d.Command,
Env: d.Env,
Mounts: append(volumes, volumesFrom...),
Ports: extractPorts(d),
Labels: map[string]string{
"mesg.engine": conf.Name,
"mesg.sid": srv.Sid,
"mesg.service": srv.Hash.String(),
"mesg.instance": inst.Hash.String(),
"mesg.dependency": d.Key,
},
Image: d.Image,
Args: d.Args,
Command: d.Command,
Env: d.Env,
Mounts: append(volumes, volumesFrom...),
Ports: extractPorts(d),
Networks: []container.Network{
{ID: networkID, Alias: d.Key},
{ID: sharedNetworkID}, // TODO: to remove
Expand All @@ -73,10 +72,16 @@ func (i *Instance) start(inst *instance.Instance, imageHash string, env []string
}
configs = append(configs, container.ServiceOptions{
Namespace: dependencyNamespace(instNamespace, srv.Configuration.Key),
Labels: labels,
Image: imageHash,
Args: srv.Configuration.Args,
Command: srv.Configuration.Command,
Labels: map[string]string{
"mesg.engine": conf.Name,
"mesg.sid": srv.Sid,
"mesg.service": srv.Hash.String(),
"mesg.instance": inst.Hash.String(),
"mesg.dependency": srv.Configuration.Key,
},
Image: imageHash,
Args: srv.Configuration.Args,
Command: srv.Configuration.Command,
Env: xos.EnvMergeSlices(env, []string{
"MESG_TOKEN=" + inst.Hash.String(),
"MESG_ENDPOINT=" + endpoint,
Expand Down