Propagate service tags on Tasks

closes #188

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2020-08-04 18:20:34 +02:00
parent 8582cb3928
commit e7bc8081ba
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
3 changed files with 8 additions and 24 deletions

View File

@ -179,6 +179,7 @@ func (b Backend) Convert(project *types.Project) (*cloudformation.Template, erro
},
},
},
PropagateTags: ecsapi.PropagateTagsService,
SchedulingStrategy: ecsapi.SchedulingStrategyReplica,
ServiceRegistries: []ecs.Service_ServiceRegistry{serviceRegistry},
Tags: []tags.Tag{

View File

@ -37,29 +37,13 @@ func Convert(project *types.Project, service types.ServiceConfig) (*ecs.TaskDefi
fmt.Sprintf(" %s.local", project.Name),
}))
tags := []tags.Tag{
{
Key: compose.ProjectTag,
Value: project.Name,
},
{
Key: compose.ServiceTag,
Value: service.Name,
},
}
tags = append(tags, toTags(service.Labels)...)
return &ecs.TaskDefinition{
ContainerDefinitions: []ecs.TaskDefinition_ContainerDefinition{
{
Command: service.Command,
DisableNetworking: service.NetworkMode == "none",
DnsSearchDomains: service.DNSSearch,
DnsServers: service.DNS,
DockerLabels: map[string]string{
compose.ProjectTag: project.Name,
compose.ServiceTag: service.Name,
},
Command: service.Command,
DisableNetworking: service.NetworkMode == "none",
DnsSearchDomains: service.DNSSearch,
DnsServers: service.DNS,
DockerSecurityOptions: service.SecurityOpt,
EntryPoint: service.Entrypoint,
Environment: toKeyValuePair(service.Environment),
@ -93,9 +77,8 @@ func Convert(project *types.Project, service types.ServiceConfig) (*ecs.TaskDefi
SystemControls: toSystemControls(service.Sysctls),
Ulimits: toUlimits(service.Ulimits),
User: service.User,
VolumesFrom: nil,
WorkingDirectory: service.WorkingDir,
VolumesFrom: nil,
WorkingDirectory: service.WorkingDir,
},
},
Cpu: cpu,
@ -107,7 +90,6 @@ func Convert(project *types.Project, service types.ServiceConfig) (*ecs.TaskDefi
PlacementConstraints: toPlacementConstraints(service.Deploy),
ProxyConfiguration: nil,
RequiresCompatibilities: []string{ecsapi.LaunchTypeFargate},
Tags: tags,
}, nil
}

View File

@ -116,6 +116,7 @@
]
}
},
"PropagateTags": "SERVICE",
"SchedulingStrategy": "REPLICA",
"ServiceRegistries": [
{