Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cloudformation/storage/storage-stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ Parameters:
Default: ''
SubnetTwo:
Description: ID of the Subnet (second Availability Zone) where the storage will be deployed.
Type: AWS::EC2::Subnet::Id
# The type has to be String to allow empty values.
Type: String
Default: ''
SubnetThree:
Description: ID of the Subnet (third Availability Zone) where the storage will be deployed.
Expand Down Expand Up @@ -115,6 +116,9 @@ Parameters:
Conditions:
CreateEbs: !Equals [!Ref CreateEbs, 'true']
CreateEfs: !Equals [!Ref CreateEfs, 'true']
CreateMountTargetResourceEfs0SubnetTwo: !And
- !Equals [!Ref CreateEfs, 'true']
- !Not [!Equals [!Ref SubnetTwo, '']]
CreateMountTargetResourceEfs0SubnetThree: !And
- !Equals [!Ref CreateEfs, 'true']
- !Not [!Equals [!Ref SubnetThree, '']]
Expand Down Expand Up @@ -157,7 +161,7 @@ Resources:
SubnetId: !Ref SubnetOne
MountTargetResourceEfs0SubnetTwo:
Type: 'AWS::EFS::MountTarget'
Condition: CreateEfs
Condition: CreateMountTargetResourceEfs0SubnetTwo
Properties:
FileSystemId: !Ref EfsFileSystem
SecurityGroups:
Expand Down
23 changes: 8 additions & 15 deletions tests/integration-tests/tests/update/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import os.path as os_path
import re
import time
from collections import defaultdict
from datetime import datetime

import boto3
Expand Down Expand Up @@ -1004,14 +1003,11 @@ def create_stack(vpc_stack, bucket_name, file_cache_path):
if request.config.getoption(option):
stack = CfnStack(name=request.config.getoption(option), region=region, template=None)
else:
# Choose subnets from different availability zones
subnet_ids = vpc_stack.get_all_public_subnets() + vpc_stack.get_all_private_subnets()
subnets = boto3.client("ec2").describe_subnets(SubnetIds=subnet_ids)["Subnets"]
subnets_by_az = defaultdict(list)
for subnet in subnets:
subnets_by_az[subnet["AvailabilityZone"]].append(subnet["SubnetId"])
azs = [az for az in subnets_by_az.keys()]
one_subnet_per_az = [subnets_by_az[az][0] for az in azs]
# Deploy the storage in the private subnet used by the cluster compute nodes.
# The head node, login nodes and compute nodes all live in the same Availability Zone,
# so a single EFS mount target in the compute node subnet covers every node in the cluster.
# The other single-AZ storage resources (FSx, File Cache, EBS) are co-located there as well.
compute_subnet_id = vpc_stack.get_private_subnet()

# The EBS volume must be placed in the same AZ where the head node is.
# The head node is deployed in the public subnet.
Expand All @@ -1029,12 +1025,9 @@ def create_stack(vpc_stack, bucket_name, file_cache_path):
params = [
# Networking
{"ParameterKey": "Vpc", "ParameterValue": vpc},
{"ParameterKey": "SubnetOne", "ParameterValue": one_subnet_per_az[0]},
{"ParameterKey": "SubnetTwo", "ParameterValue": one_subnet_per_az[1]},
{
"ParameterKey": "SubnetThree",
"ParameterValue": "" if len(one_subnet_per_az) == 2 else one_subnet_per_az[2],
},
{"ParameterKey": "SubnetOne", "ParameterValue": compute_subnet_id},
{"ParameterKey": "SubnetTwo", "ParameterValue": ""},
{"ParameterKey": "SubnetThree", "ParameterValue": ""},
# EBS
{"ParameterKey": "CreateEbs", "ParameterValue": "true"},
{"ParameterKey": "EbsVolumeAz", "ParameterValue": ebs_volume_az},
Expand Down
Loading