Skip to content

Commit cfdb5fa

Browse files
thheinenmapk-amazon
authored andcommitted
Add EFS access point support (aws-parallelcluster#2337)
Signed-off-by: Thomas Heinen <t.heinen@reply.de>
1 parent 4796b24 commit cfdb5fa

File tree

7 files changed

+22
-2
lines changed

7 files changed

+22
-2
lines changed

cli/src/pcluster/config/cluster_config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ def __init__(
371371
deletion_policy: str = None,
372372
encryption_in_transit: bool = None,
373373
iam_authorization: bool = None,
374+
accesspoint_id: str = None,
374375
):
375376
super().__init__()
376377
self.mount_dir = Resource.init_param(mount_dir)
@@ -387,6 +388,7 @@ def __init__(
387388
)
388389
self.encryption_in_transit = Resource.init_param(encryption_in_transit, default=False)
389390
self.iam_authorization = Resource.init_param(iam_authorization, default=False)
391+
self.accesspoint_id = Resource.init_param(accesspoint_id)
390392

391393
def _register_validators(self, context: ValidatorContext = None): # noqa: D102 #pylint: disable=unused-argument
392394
self._register_validator(SharedStorageNameValidator, name=self.name)
@@ -398,6 +400,7 @@ def _register_validators(self, context: ValidatorContext = None): # noqa: D102
398400
EfsMountOptionsValidator,
399401
encryption_in_transit=self.encryption_in_transit,
400402
iam_authorization=self.iam_authorization,
403+
accesspoint_id=self.accesspoint_id,
401404
name=self.name,
402405
)
403406

cli/src/pcluster/schemas/cluster_schema.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ class EfsSettingsSchema(BaseSchema):
321321
deletion_policy = fields.Str(
322322
validate=validate.OneOf(DELETION_POLICIES), metadata={"update_policy": UpdatePolicy.SUPPORTED}
323323
)
324+
accesspoint_id = fields.Str(
325+
validate=validate.Regexp(r"^fsap-[0-9a-z]{17}$"),
326+
)
324327
encryption_in_transit = fields.Bool(metadata={"update_policy": UpdatePolicy.UNSUPPORTED})
325328
iam_authorization = fields.Bool(metadata={"update_policy": UpdatePolicy.UNSUPPORTED})
326329

@@ -331,7 +334,7 @@ def validate_file_system_id_ignored_parameters(self, data, **kwargs):
331334
messages = []
332335
if data.get("file_system_id") is not None:
333336
for key in data:
334-
if key is not None and key not in ["encryption_in_transit", "iam_authorization", "file_system_id"]:
337+
if key is not None and key not in ["encryption_in_transit", "iam_authorization", "file_system_id", "accesspoint_id"]:
335338
messages.append(EFS_MESSAGES["errors"]["ignored_param_with_efs_fs_id"].format(efs_param=key))
336339
if messages:
337340
raise ValidationError(message=messages)

cli/src/pcluster/templates/cluster_stack.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,7 @@ def _add_efs_storage(self, id: str, shared_efs: SharedEfs):
11211121
shared_efs.encryption_in_transit
11221122
)
11231123
self.shared_storage_attributes[SharedStorageType.EFS]["IamAuthorizations"].append(shared_efs.iam_authorization)
1124+
self.shared_storage_attributes[SharedStorageType.EFS]["AccesspointIds"].append(shared_efs.accesspoint_id)
11241125

11251126
return efs_id
11261127

@@ -1300,6 +1301,10 @@ def _add_head_node(self):
13001301
"efs_iam_authorizations": to_comma_separated_string(
13011302
self.shared_storage_attributes[SharedStorageType.EFS]["IamAuthorizations"], use_lower_case=True
13021303
),
1304+
"efs_accesspoint_ids": to_comma_separated_string(
1305+
self.shared_storage_attributes[SharedStorageType.EFS]["AccesspointIds"],
1306+
use_lower_case=True,
1307+
),
13031308
"fsx_fs_ids": get_shared_storage_ids_by_type(self.shared_storage_infos, SharedStorageType.FSX),
13041309
"fsx_mount_names": to_comma_separated_string(
13051310
self.shared_storage_attributes[SharedStorageType.FSX]["MountNames"]

cli/src/pcluster/templates/login_nodes_stack.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ def _add_login_nodes_pool_launch_template(self):
235235
self._shared_storage_attributes[SharedStorageType.EFS]["IamAuthorizations"],
236236
use_lower_case=True,
237237
),
238+
"efs_accesspoint_ids": to_comma_separated_string(
239+
self._shared_storage_attributes[SharedStorageType.EFS]["AccesspointIds"],
240+
use_lower_case=True,
241+
),
238242
"enable_intel_hpc_platform": "true" if self._config.is_intel_hpc_platform_enabled else "false",
239243
"ephemeral_dir": DEFAULT_EPHEMERAL_DIR,
240244
"fsx_fs_ids": get_shared_storage_ids_by_type(self._shared_storage_infos, SharedStorageType.FSX),

cli/src/pcluster/templates/queues_stack.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@ def _add_compute_resource_launch_template(
335335
self._shared_storage_attributes[SharedStorageType.EFS]["IamAuthorizations"],
336336
use_lower_case=True,
337337
),
338+
"efs_accesspoint_ids": to_comma_separated_string(
339+
self._shared_storage_attributes[SharedStorageType.EFS]["AccesspointIds"],
340+
use_lower_case=True,
341+
),
338342
"fsx_fs_ids": get_shared_storage_ids_by_type(self._shared_storage_infos, SharedStorageType.FSX),
339343
"fsx_mount_names": to_comma_separated_string(
340344
self._shared_storage_attributes[SharedStorageType.FSX]["MountNames"]

cli/src/pcluster/validators/efs_validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class EfsMountOptionsValidator(Validator):
1818
IAM Authorization requires Encryption in Transit.
1919
"""
2020

21-
def _validate(self, encryption_in_transit: bool, iam_authorization: bool, name: str):
21+
def _validate(self, encryption_in_transit: bool, iam_authorization: bool, accesspoint_id: str, name: str):
2222
if iam_authorization and not encryption_in_transit:
2323
self._add_failure(
2424
"EFS IAM authorization cannot be enabled when encryption in-transit is disabled. "

cli/src/pcluster3_config_converter/pcluster3_config_converter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ def convert_efs_settings(self, section_name):
296296
("efs_kms_key_id", "KmsKeyId"),
297297
("provisioned_throughput", "ProvisionedThroughput", "getint"),
298298
("throughput_mode", "ThroughputMode"),
299+
("accesspoint_id", "AccesspointId"),
299300
]
300301
efs_section, efs_dict, _section_label = self.convert_storage_base(
301302
"efs", efs_label.strip(), additional_items

0 commit comments

Comments
 (0)