Skip to content

Thheinen/efs accesspoints #2783

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

Merged
merged 4 commits into from
Aug 14, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This file is used to list changes made in each version of the AWS ParallelCluste
**ENHANCEMENTS**
- Allow custom actions on login nodes.
- Allow DCV connection on login nodes.
- Add new attribute `efs_access_point_ids` to specify optional EFS access points for the mounts

**BUG FIXES**
- Fix EFA kmod installation with RHEL 8.10 or newer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
default['cluster']['efs_fs_ids'] = ''
default['cluster']['efs_encryption_in_transits'] = ''
default['cluster']['efs_iam_authorizations'] = ''
default['cluster']['efs_access_point_ids'] = ''
default['cluster']['fsx_shared_dirs'] = ''
default['cluster']['fsx_fs_ids'] = ''
default['cluster']['fsx_dns_names'] = ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
id_array = node['cluster']['efs_fs_ids'].split(',')
encryption_array = node['cluster']['efs_encryption_in_transits'].split(',')
iam_array = node['cluster']['efs_iam_authorizations'].split(',')
access_point_id_array = node['cluster']['efs_access_point_ids'].split(',')

# Identify the previously mounted filesystems and remove them from the set of filesystems to mount
shared_dir_array.each_with_index do |dir, index|
Expand All @@ -23,6 +24,7 @@
id_array.delete_at(index)
encryption_array.delete_at(index)
iam_array.delete_at(index)
access_point_id_array.delete_at(index)
end

# Mount EFS directories with the efs resource
Expand All @@ -31,6 +33,7 @@
efs_fs_id_array id_array
efs_encryption_in_transit_array encryption_array
efs_iam_authorization_array iam_array
efs_access_point_id_array access_point_id_array
action :mount
not_if { shared_dir_array.empty? }
end
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
efs_encryption_in_transit_array [node['cluster']['efs_encryption_in_transits'].split(',')[index]]
efs_iam_authorization_array [node['cluster']['efs_iam_authorizations'].split(',')[index]]
efs_mount_point_array ['/home']
efs_access_point_id [node['cluster']['efs_access_point_ids'].split(',')[index]]
action :mount
end
break
Expand All @@ -73,6 +74,7 @@
efs_fs_id_array [node['cluster']['efs_fs_ids'].split(',')[index]]
efs_encryption_in_transit_array [node['cluster']['efs_encryption_in_transits'].split(',')[index]]
efs_iam_authorization_array [node['cluster']['efs_iam_authorizations'].split(',')[index]]
efs_access_point_id [node['cluster']['efs_access_point_ids'].split(',')[index]]
action :mount
end
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
property :efs_fs_id_array, Array, required: %i(mount unmount)
property :efs_encryption_in_transit_array, Array, required: false
property :efs_iam_authorization_array, Array, required: false
property :efs_access_point_id_array, Array, required: false
# This is the mount point on the EFS itself, as opposed to the local system directory, defaults to "/"
property :efs_mount_point_array, Array, required: false
property :efs_unmount_forced_array, Array, required: false
Expand All @@ -28,19 +29,23 @@
efs_fs_id_array = new_resource.efs_fs_id_array.dup
efs_encryption_in_transit_array = new_resource.efs_encryption_in_transit_array.dup
efs_iam_authorization_array = new_resource.efs_iam_authorization_array.dup
efs_access_point_id_array = new_resource.efs_access_point_id_array.dup
efs_mount_point_array = new_resource.efs_mount_point_array.dup

efs_fs_id_array.each_with_index do |efs_fs_id, index|
efs_shared_dir = efs_shared_dir_array[index]
efs_encryption_in_transit = efs_encryption_in_transit_array[index] unless efs_encryption_in_transit_array.nil?
efs_iam_authorization = efs_iam_authorization_array[index] unless efs_iam_authorization_array.nil?
efs_access_point_id = efs_access_point_id_array[index] unless efs_access_point_id_array.nil?

# Path needs to be fully qualified, for example "shared/temp" becomes "/shared/temp"
efs_shared_dir = "/#{efs_shared_dir}" unless efs_shared_dir.start_with?('/')

# See reference of mount options: https://docs.aws.amazon.com/efs/latest/ug/automount-with-efs-mount-helper.html
mount_options = "_netdev,noresvport"
if efs_encryption_in_transit == "true"
if efs_access_point_id
mount_options = "iam,tls,access_point=#{efs_access_point_id}"
elsif efs_encryption_in_transit == "true"
mount_options += ",tls"
if efs_iam_authorization == "true"
mount_options += ",iam"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ raid:
<% efs_shared_dir_array = node['cluster']['efs_shared_dirs'].split(',') -%>
<% efs_encryption_in_transit_array = node['cluster']['efs_encryption_in_transits'].split(',') -%>
<% efs_iam_authorization_array = node['cluster']['efs_iam_authorizations'].split(',') -%>
<% efs_access_point_id_array = node['cluster']['efs_access_point_ids'].split(',') -%>
efs:
<% efs_fs_ids_array.each_with_index do |efs_fs_id, index| -%>
- efs_fs_id: <%= efs_fs_id %>
mount_dir: <%= efs_shared_dir_array[index] %>
efs_encryption_in_transit: <%= efs_encryption_in_transit_array[index] %>
efs_iam_authorization: <%= efs_iam_authorization_array[index] %>
efs_access_point_id: <%= efs_access_point_id_array[index] %>
<% end -%>
<%# FSX %>
<% fsx_fs_id_array = node['cluster']['fsx_fs_ids'].split(',') -%>
Expand Down
Loading