Skip to content

Commit c80b4c3

Browse files
committed
feat: add min health percent to Fargate recipes
1 parent 4bbabf6 commit c80b4c3

File tree

9 files changed

+66
-6
lines changed

9 files changed

+66
-6
lines changed

site/content/docs/cicd/recipes/ASP.NET Core App to Amazon ECS using AWS Fargate.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
* ID: DesiredCount
3030
* Description: The desired number of ECS tasks to run for the service.
3131
* Type: Int
32+
* **Minimum Healthy Percent**
33+
* ID: MinHealthyPercent
34+
* Description: The minimum number of tasks, specified as a percentage of the Amazon ECS service's 'Desired Task Count' value, that must continue to run and remain healthy during a deployment.
35+
* Type: Int
3236
* **Container Port**
3337
* ID: Port
3438
* Description: The port the container is listening for requests on.

site/content/docs/cicd/recipes/Service on Amazon Elastic Container Service (ECS) using AWS Fargate.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
* ID: DesiredCount
3030
* Description: The desired number of ECS tasks to run for the service.
3131
* Type: Int
32+
* **Minimum Healthy Percent**
33+
* ID: MinHealthyPercent
34+
* Description: The minimum number of tasks, specified as a percentage of the Amazon ECS service's 'Desired Task Count' value, that must continue to run and remain healthy during a deployment.
35+
* Type: Int
3236
* **Application IAM Role**
3337
* ID: ApplicationIAMRole
3438
* Description: The Identity and Access Management (IAM) role that provides AWS credentials to the application to access AWS services.

src/AWS.Deploy.Recipes/CdkTemplates/AspNetAppEcsFargate/Generated/Configurations/Configuration.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ public partial class Configuration
2323
/// </summary>
2424
public double DesiredCount { get; set; }
2525

26+
/// <summary>
27+
/// The minimum number of tasks, specified as a percentage of the Amazon ECS service's <see cref="DesiredCount"/> value,
28+
/// that must continue to run and remain healthy during a deployment.
29+
/// </summary>
30+
public double MinHealthyPercent { get; set; }
31+
2632
/// <summary>
2733
/// The name of the ECS service running in the cluster.
2834
/// </summary>

src/AWS.Deploy.Recipes/CdkTemplates/AspNetAppEcsFargate/Generated/Recipe.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ private void ConfigureECSClusterAndService(IRecipeProps<Configuration> recipeCon
191191
Cluster = EcsCluster,
192192
TaskDefinition = AppTaskDefinition,
193193
DesiredCount = settings.DesiredCount,
194+
MinHealthyPercent = settings.MinHealthyPercent,
194195
ServiceName = settings.ECSServiceName,
195196
AssignPublicIp = settings.Vpc.IsDefault,
196197
SecurityGroups = EcsServiceSecurityGroups.ToArray()

src/AWS.Deploy.Recipes/CdkTemplates/ConsoleAppECSFargateService/Generated/Configurations/Configuration.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ public partial class Configuration
1818
/// </summary>
1919
public double DesiredCount { get; set; }
2020

21+
/// <summary>
22+
/// The minimum number of tasks, specified as a percentage of the Amazon ECS service's <see cref="DesiredCount"/> value,
23+
/// that must continue to run and remain healthy during a deployment.
24+
/// </summary>
25+
public double MinHealthyPercent { get; set; }
26+
2127
/// <summary>
2228
/// The Identity and Access Management Role that provides AWS credentials to the application to access AWS services.
2329
/// </summary>

src/AWS.Deploy.Recipes/CdkTemplates/ConsoleAppECSFargateService/Generated/Recipe.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ private void ConfigureService(Configuration settings)
181181
Cluster = EcsCluster,
182182
TaskDefinition = AppTaskDefinition,
183183
AssignPublicIp = settings.Vpc.IsDefault,
184-
DesiredCount = settings.DesiredCount
184+
DesiredCount = settings.DesiredCount,
185+
MinHealthyPercent = settings.MinHealthyPercent
185186
};
186187

187188

src/AWS.Deploy.Recipes/RecipeDefinitions/ASP.NETAppECSFargate.recipe

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,25 @@
229229
}
230230
]
231231
},
232+
{
233+
"Id": "MinHealthyPercent",
234+
"Name": "Minimum Healthy Percent",
235+
"Category": "Compute",
236+
"Description": "The minimum number of tasks, specified as a percentage of the Amazon ECS service's 'Desired Task Count' value, that must continue to run and remain healthy during a deployment.",
237+
"Type": "Int",
238+
"DefaultValue": 100,
239+
"AdvancedSetting": true,
240+
"Updatable": true,
241+
"Validators": [
242+
{
243+
"ValidatorType": "Range",
244+
"Configuration": {
245+
"Min": 0,
246+
"Max": 100
247+
}
248+
}
249+
]
250+
},
232251
{
233252
"Id": "Port",
234253
"Name": "Container Port",

src/AWS.Deploy.Recipes/RecipeDefinitions/ConsoleAppECSFargateService.recipe

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,25 @@
281281
}
282282
]
283283
},
284+
{
285+
"Id": "MinHealthyPercent",
286+
"Name": "Minimum Healthy Percent",
287+
"Category": "Compute",
288+
"Description": "The minimum number of tasks, specified as a percentage of the Amazon ECS service's 'Desired Task Count' value, that must continue to run and remain healthy during a deployment.",
289+
"Type": "Int",
290+
"DefaultValue": 100,
291+
"AdvancedSetting": true,
292+
"Updatable": true,
293+
"Validators": [
294+
{
295+
"ValidatorType": "Range",
296+
"Configuration": {
297+
"Min": 0,
298+
"Max": 100
299+
}
300+
}
301+
]
302+
},
284303
{
285304
"Id": "ApplicationIAMRole",
286305
"Name": "Application IAM Role",

test/AWS.Deploy.CLI.IntegrationTests/WebAppWithDockerFileTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,25 @@ await _serviceCollection.RunDeployToolAsync(deployArgs,
6565
// Arrange input for deploy
6666
interactiveService.StdInWriter.Write(Environment.NewLine); // Select default recommendation
6767
interactiveService.StdInWriter.WriteLine("more"); // Select 'more'
68-
interactiveService.StdInWriter.WriteLine("13"); // Select 'Environment Architecture'
68+
interactiveService.StdInWriter.WriteLine("14"); // Select 'Environment Architecture'
6969
interactiveService.StdInWriter.WriteLine("1"); // Select 'X86_64'
70-
interactiveService.StdInWriter.WriteLine("13"); // Select 'Environment Architecture' again for Code Coverage
70+
interactiveService.StdInWriter.WriteLine("14"); // Select 'Environment Architecture' again for Code Coverage
7171
interactiveService.StdInWriter.WriteLine("1"); // Select 'X86_64'
72-
interactiveService.StdInWriter.WriteLine("8"); // Select 'Task CPU'
72+
interactiveService.StdInWriter.WriteLine("9"); // Select 'Task CPU'
7373
interactiveService.StdInWriter.WriteLine("2"); // Select '512 (.5 vCPU)'
7474
interactiveService.StdInWriter.Flush();
7575
});
7676

7777
var consoleOutput = interactiveService.StdOutReader.ReadAllLines();
7878

7979
// Assert 'Environment Architecture' is set to 'X86_64'
80-
var environmentArchitecture = Assert.IsType<string>(consoleOutput.LastOrDefault(x => x.StartsWith("13. Environment Architecture:")));
80+
var environmentArchitecture = Assert.IsType<string>(consoleOutput.LastOrDefault(x => x.StartsWith("14. Environment Architecture:")));
8181
var environmentArchitectureSplit = environmentArchitecture.Split(':').ToList().Select(x => x.Trim()).ToList();
8282
Assert.Equal(2, environmentArchitectureSplit.Count);
8383
Assert.Equal("X86_64", environmentArchitectureSplit[1]);
8484

8585
// Assert 'Task CPU' is set to '512'
86-
var taskCpu = Assert.IsType<string>(consoleOutput.LastOrDefault(x => x.StartsWith("8 . Task CPU:")));
86+
var taskCpu = Assert.IsType<string>(consoleOutput.LastOrDefault(x => x.StartsWith("9 . Task CPU:")));
8787
var taskCpuSplit = taskCpu.Split(':').ToList().Select(x => x.Trim()).ToList();
8888
Assert.Equal(2, taskCpuSplit.Count);
8989
Assert.Equal("512", taskCpuSplit[1]);

0 commit comments

Comments
 (0)