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

[v15] AWS OIDC - Deploy ECS Service: increase number of replicas to 2 #37805

Merged
merged 2 commits into from Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/integrations/awsoidc/deployservice.go
Expand Up @@ -43,8 +43,14 @@ var (
// requiredCapacityProviders contains the FARGATE type which is required to deploy a Teleport Service.
requiredCapacityProviders = []string{launchTypeFargateString}

// oneAgent is used to define the desired agent count when creating a service.
oneAgent = int32(1)
// twoAgents is used to define the desired agent count when creating a service.
// Deploying two agents in a FARGATE LaunchType Service, will most likely deploy
// each one in a different AZ, as long as the Subnets include mustiple AZs.
// From AWS Docs:
// > Task placement strategies and constraints aren't supported for tasks using the Fargate launch type.
// > Fargate will try its best to spread tasks across accessible Availability Zones.
// > https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement.html#fargate-launch-type
twoAgents = int32(2)
)

const (
Expand Down Expand Up @@ -725,7 +731,7 @@ func upsertService(ctx context.Context, clt DeployServiceClient, req upsertServi

updateServiceResp, err := clt.UpdateService(ctx, &ecs.UpdateServiceInput{
Service: aws.String(req.ServiceName),
DesiredCount: &oneAgent,
DesiredCount: &twoAgents,
TaskDefinition: &taskARN,
Cluster: aws.String(req.ClusterName),
NetworkConfiguration: deployServiceNetworkConfiguration(req.SubnetIDs, req.SecurityGroups),
Expand All @@ -742,7 +748,7 @@ func upsertService(ctx context.Context, clt DeployServiceClient, req upsertServi

createServiceOut, err := clt.CreateService(ctx, &ecs.CreateServiceInput{
ServiceName: aws.String(req.ServiceName),
DesiredCount: &oneAgent,
DesiredCount: &twoAgents,
LaunchType: ecsTypes.LaunchTypeFargate,
TaskDefinition: &taskARN,
Cluster: aws.String(req.ClusterName),
Expand Down