From 0f8a2c13d4b544ce6a4e320d2c3f2147cd95970c Mon Sep 17 00:00:00 2001 From: Jacopo De Amicis Date: Thu, 1 Feb 2024 19:04:38 +0100 Subject: [PATCH] Fetch slurmdbd configuration from S3 if available Remove previously implemented logic to configur s3 mountpoint for the configuration of the external slurmdbd Signed-off-by: Jacopo De Amicis --- .../recipes/external_slurmdbd_config.rb | 4 +- ...rb => retrieve_slurmdbd_config_from_s3.rb} | 38 +++++++------------ 2 files changed, 16 insertions(+), 26 deletions(-) rename cookbooks/aws-parallelcluster-slurm/recipes/config/{config_external_slurmdbd_s3_mountpoint.rb => retrieve_slurmdbd_config_from_s3.rb} (52%) diff --git a/cookbooks/aws-parallelcluster-entrypoints/recipes/external_slurmdbd_config.rb b/cookbooks/aws-parallelcluster-entrypoints/recipes/external_slurmdbd_config.rb index cc8544c436..eeeeb45524 100644 --- a/cookbooks/aws-parallelcluster-entrypoints/recipes/external_slurmdbd_config.rb +++ b/cookbooks/aws-parallelcluster-entrypoints/recipes/external_slurmdbd_config.rb @@ -52,8 +52,6 @@ include_recipe 'aws-parallelcluster-slurm::config_head_node_directories' -include_recipe 'aws-parallelcluster-slurm::config_external_slurmdbd_s3_mountpoint' - # TODO: move this template to a separate recipe # TODO: add a logic in update_munge_key.sh.erb to skip sharing munge key to shared dir template "#{node['cluster']['scripts_dir']}/slurm/update_munge_key.sh" do @@ -80,4 +78,6 @@ # TODO: add a logic in munge_key_manager to skip sharing munge key to shared dir include_recipe 'aws-parallelcluster-slurm::config_munge_key' +include_recipe 'aws-parallelcluster-slurm::retrieve_slurmdbd_config_from_s3' + include_recipe "aws-parallelcluster-slurm::config_slurm_accounting" diff --git a/cookbooks/aws-parallelcluster-slurm/recipes/config/config_external_slurmdbd_s3_mountpoint.rb b/cookbooks/aws-parallelcluster-slurm/recipes/config/retrieve_slurmdbd_config_from_s3.rb similarity index 52% rename from cookbooks/aws-parallelcluster-slurm/recipes/config/config_external_slurmdbd_s3_mountpoint.rb rename to cookbooks/aws-parallelcluster-slurm/recipes/config/retrieve_slurmdbd_config_from_s3.rb index e0afc9614f..5ac6113b52 100644 --- a/cookbooks/aws-parallelcluster-slurm/recipes/config/config_external_slurmdbd_s3_mountpoint.rb +++ b/cookbooks/aws-parallelcluster-slurm/recipes/config/retrieve_slurmdbd_config_from_s3.rb @@ -2,7 +2,7 @@ # # Cookbook:: aws-parallelcluster-slurm -# Recipe:: config_external_slurmdbd_s3_mountpoint +# Recipe:: retrieve_slurmdbd_config_from_s3 # # Copyright:: 2013-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. # @@ -20,31 +20,21 @@ # This is considered fine for the external slurmdbd stack. # A deeper evaluation would be required for further uses of this tool in AWS ParallelCluster. -ext = platform?('ubuntu') ? "deb" : "rpm" -subtree = arm? ? "arm64" : "x86_64" -mount_s3_url = "https://s3.amazonaws.com/mountpoint-s3-release/latest/#{subtree}/mount-s3.#{ext}" -download_path = "/tmp/mount-s3.#{ext}" +bucket_name = node['slurmdbd_conf_bucket'] +config_files = ["slurmdbd.conf", "slurm_external_slurmdbd.conf"] -remote_file 'download mountpoint-s3' do - source mount_s3_url - path download_path - retries 3 - retry_delay 5 - action :create_if_missing -end +config_files.each do |config_file| -if platform?('ubuntu') - # The Chef apt_package resource does not support the source attribute, so we use the dpkg_package resource instead. - dpkg_package "Install mountpoint-s3" do - source download_path - end -else - package "Install mountpoint-s3" do - source download_path + remote_object config_file do + url "s3://#{bucket_name}/#{config_file}" + destination "#{node['cluster']['slurm']['install_dir']}/etc/#{config_file}" + sensitive true + ignore_failure true end -end -execute 'mount slurmdbd configuration via S3' do - command "mount-s3 --allow-delete --uid $(id -u slurm) --gid $(id -g slurm) --dir-mode 0755 --file-mode 0600 #{node['slurmdbd_conf_bucket']} /opt/slurm/etc/" - user 'root' + file "#{node['cluster']['slurm']['install_dir']}/etc/#{config_file}" do + mode '0600' + owner node['cluster']['slurm']['user'] + group node['cluster']['slurm']['group'] + end end