From a3519e649e06fb42b8a6c4b3b4450ca1ae2fee48 Mon Sep 17 00:00:00 2001 From: Jean Dupouy Date: Tue, 15 Aug 2023 22:10:13 +0200 Subject: [PATCH 1/2] Allow sidecar containers to be marked as essential Implements #4884 --- builtin/aws/ecs/platform.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/builtin/aws/ecs/platform.go b/builtin/aws/ecs/platform.go index 37167b91e4c..e21bed92ddf 100644 --- a/builtin/aws/ecs/platform.go +++ b/builtin/aws/ecs/platform.go @@ -1590,7 +1590,7 @@ func (p *Platform) resourceTaskDefinitionCreate( } c := &ecs.ContainerDefinition{ - Essential: aws.Bool(false), + Essential: aws.Bool(container.Essential), Name: aws.String(container.Name), Image: aws.String(container.Image), PortMappings: []*ecs.PortMapping{ @@ -2866,6 +2866,11 @@ type ContainerConfig struct { // The container health check command HealthCheck *HealthCheckConfig `hcl:"health_check,block"` + // If the essential parameter of a container is marked as true, and that container fails + // or stops for any reason, all other containers that are part of the task are stopped. + // Note: Contrary to the container definition API, this defaults to false. + Essential bool `hcl:"essential,optional"` + // The environment variables to pass to a container Environment map[string]string `hcl:"static_environment,optional"` From bf89e0773a95c63f99546ba8e5a045af01018cc0 Mon Sep 17 00:00:00 2001 From: izeau Date: Wed, 16 Aug 2023 07:35:13 +0200 Subject: [PATCH 2/2] Add documentation on the essential parameter --- builtin/aws/ecs/platform.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/builtin/aws/ecs/platform.go b/builtin/aws/ecs/platform.go index e21bed92ddf..6d5b8cb5290 100644 --- a/builtin/aws/ecs/platform.go +++ b/builtin/aws/ecs/platform.go @@ -3306,6 +3306,11 @@ deploy { "The protocol used for port mapping.", ) + doc.SetField( + "essential", + "If true, and the container stops for any reason, all other containers are stopped", + ) + doc.SetField( "static_environment", "Environment variables to expose to this container",