Skip to content

Commit

Permalink
Move aarch64 capacity provider association
Browse files Browse the repository at this point in the history
  • Loading branch information
farski committed Jan 8, 2025
1 parent a8346f6 commit 6dddc2a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
1 change: 1 addition & 0 deletions spire/templates/root.yml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ Resources:
VpcPublicSubnet1Id: !GetAtt SharedVpcStack.Outputs.PublicSubnet1Id
VpcPublicSubnet2Id: !GetAtt SharedVpcStack.Outputs.PublicSubnet2Id
VpcPublicSubnet3Id: !GetAtt SharedVpcStack.Outputs.PublicSubnet3Id
Aarch64AsgCapacityProviderName: !GetAtt SharedEcsAsgAarch64Stack.Outputs.CapacityProviderName
EcsClusterName: !GetAtt SharedEcsClusterStack.Outputs.EcsClusterName
SharedEcsAsgInstanceSecurityGroupId: !GetAtt SharedEcsAsgSecurityGroupStack.Outputs.InstanceSecurityGroupId
LoadBalancerSecurityGroupId: !GetAtt SharedAlbStack.Outputs.LoadBalancerSecurityGroupId
Expand Down
19 changes: 5 additions & 14 deletions spire/templates/shared-ecs/asg-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,9 @@ Resources:
- !Ref VpcPublicSubnet2Id
- !Ref VpcPublicSubnet3Id

# The capacity provider is associated with the ECS cluster in the x86-64
# template, for that's where the association resource was originally created
# and it's a pain to move.
DefaultCapacityProvider:
Type: AWS::ECS::CapacityProvider
Properties:
Expand All @@ -424,21 +427,9 @@ Resources:
- { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId }
- { Key: prx:ops:environment, Value: !Ref EnvironmentType }
- { Key: prx:dev:application, Value: Common }
ClusterCapacityProviderAssociation:
Type: AWS::ECS::ClusterCapacityProviderAssociations
Properties:
Cluster: !Ref EcsClusterName
CapacityProviders:
- !Ref DefaultCapacityProvider
- !If [IsStaging, FARGATE, !Ref "AWS::NoValue"]
- !If [IsStaging, FARGATE_SPOT, !Ref "AWS::NoValue"]
DefaultCapacityProviderStrategy:
# With only one default capacity provider, the base and weight won't
# factor into scheduling; everything will be even within the ASG
- Base: 0
Weight: 1
CapacityProvider: !Ref DefaultCapacityProvider

Outputs:
AsgName:
Value: !Ref Asg
CapacityProviderName:
Value: !Ref DefaultCapacityProvider
5 changes: 5 additions & 0 deletions spire/templates/shared-ecs/asg-x86-64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Parameters:
VpcPublicSubnet1Id: { Type: AWS::EC2::Subnet::Id }
VpcPublicSubnet2Id: { Type: AWS::EC2::Subnet::Id }
VpcPublicSubnet3Id: { Type: AWS::EC2::Subnet::Id }
Aarch64AsgCapacityProviderName: { Type: String }
EcsClusterName: { Type: String }
SharedEcsAsgInstanceSecurityGroupId: { Type: AWS::EC2::SecurityGroup::Id }
LoadBalancerSecurityGroupId: { Type: AWS::EC2::SecurityGroup::Id }
Expand Down Expand Up @@ -433,11 +434,15 @@ Resources:
- { Key: prx:ops:environment, Value: !Ref EnvironmentType }
- { Key: prx:dev:application, Value: Common }
ClusterCapacityProviderAssociation:
# This is handling associations for capacity providers, even ones not
# created in this template. It exists here because we used to only have one
# ASG template, and moving it is sort of a pain.
Type: AWS::ECS::ClusterCapacityProviderAssociations
Properties:
Cluster: !Ref EcsClusterName
CapacityProviders:
- !Ref DefaultCapacityProvider
- !Ref Aarch64AsgCapacityProviderName
- !If [IsStaging, FARGATE, !Ref "AWS::NoValue"]
- !If [IsStaging, FARGATE_SPOT, !Ref "AWS::NoValue"]
DefaultCapacityProviderStrategy:
Expand Down

0 comments on commit 6dddc2a

Please sign in to comment.