Skip to content

Commit 73debc1

Browse files
authored
[libjwt] Add support for building libjwt before building slurm.
Add support for building libjwt before compiling slurm as this is required to enable the standard JWT authentication mechanism for slurmrestd.
1 parent be1543f commit 73debc1

File tree

7 files changed

+81
-7
lines changed

7 files changed

+81
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ This file is used to list changes made in each version of the AWS ParallelCluste
99
**CHANGES**
1010
- Upgrade Slurm to version 21.08.8-2.
1111

12+
**ENHANCEMENTS**
13+
- Add support for enabling JWT authentication Slurm.
14+
1215
3.1.3
1316
------
1417

attributes/default.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@
163163
default['cluster']['munge']['user_id'] = node['cluster']['reserved_base_uid'] + 2
164164
default['cluster']['munge']['group'] = node['cluster']['munge']['user']
165165
default['cluster']['munge']['group_id'] = node['cluster']['munge']['user_id']
166+
# JWT
167+
default['cluster']['jwt']['version'] = '1.12.0'
168+
default['cluster']['jwt']['url'] = "https://github.com/benmcollins/libjwt/archive/refs/tags/v#{node['cluster']['jwt']['version']}.tar.gz"
169+
default['cluster']['jwt']['sha1'] = '1c6fec984a8e0ca1122bfc3552a49f45bdb0c4e8'
166170

167171
# NVIDIA
168172
default['cluster']['nvidia']['enabled'] = 'no'

cookbooks/aws-parallelcluster-config/recipes/base.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@
3333
end
3434

3535
# Execution timeout 3600 seconds
36-
execute "Setup of ephemeral drivers" do
37-
user "root"
38-
command "/usr/local/sbin/setup-ephemeral-drives.sh"
36+
unless virtualized?
37+
execute "Setup of ephemeral drivers" do
38+
user "root"
39+
command "/usr/local/sbin/setup-ephemeral-drives.sh"
40+
end
3941
end
4042

4143
# Increase somaxconn and tcp_max_syn_backlog for large scale setting
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# frozen_string_literal: true
2+
3+
#
4+
# Cookbook:: aws-parallelcluster-slurm
5+
# Recipe:: install_jwt
6+
#
7+
# Copyright:: Amazon.com, Inc. or its affiliates. All Rights Reserved.
8+
#
9+
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
10+
# License. A copy of the License is located at
11+
#
12+
# http://aws.amazon.com/apache2.0/
13+
#
14+
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
15+
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
jwt_version = node['cluster']['jwt']['version']
19+
jwt_tarball = "#{node['cluster']['sources_dir']}/libjwt-#{jwt_version}.tar.gz"
20+
21+
remote_file jwt_tarball do
22+
source node['cluster']['jwt']['url']
23+
mode '0644'
24+
retries 3
25+
retry_delay 5
26+
not_if { ::File.exist?(jwt_tarball) }
27+
end
28+
29+
ruby_block "Validate libjwt Tarball Checksum" do
30+
block do
31+
require 'digest'
32+
checksum = Digest::SHA1.file(jwt_tarball).hexdigest # nosemgrep
33+
raise "Downloaded Tarball Checksum #{checksum} does not match expected checksum #{node['cluster']['jwt']['sha1']}" if checksum != node['cluster']['jwt']['sha1']
34+
end
35+
end
36+
37+
jwt_build_deps = value_for_platform(
38+
'ubuntu' => {
39+
'default' => 'libjansson-dev',
40+
},
41+
'default' => 'jansson-devel'
42+
)
43+
44+
package jwt_build_deps do
45+
retries 3
46+
retry_delay 5
47+
end
48+
49+
bash 'libjwt' do
50+
user 'root'
51+
group 'root'
52+
cwd Chef::Config[:file_cache_path]
53+
code <<-LIBJWT
54+
set -e
55+
tar xf #{jwt_tarball}
56+
cd libjwt-#{jwt_version}
57+
autoreconf --force --install
58+
./configure --prefix=/opt/libjwt
59+
CORES=$(grep processor /proc/cpuinfo | wc -l)
60+
make -j $CORES
61+
sudo make install
62+
LIBJWT
63+
end

cookbooks/aws-parallelcluster-slurm/recipes/install_slurm.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
shell '/bin/bash'
5151
end
5252

53+
include_recipe 'aws-parallelcluster-slurm::install_jwt'
54+
5355
slurm_tarball = "#{node['cluster']['sources_dir']}/slurm-#{node['cluster']['slurm']['version']}.tar.gz"
5456

5557
# Get slurm tarball
@@ -83,7 +85,7 @@
8385
8486
tar xf #{slurm_tarball}
8587
cd slurm-slurm-#{node['cluster']['slurm']['version']}
86-
./configure --prefix=/opt/slurm --with-pmix=/opt/pmix --enable-slurmrestd
88+
./configure --prefix=/opt/slurm --with-pmix=/opt/pmix --with-jwt=/opt/libjwt --enable-slurmrestd
8789
CORES=$(grep processor /proc/cpuinfo | wc -l)
8890
make -j $CORES
8991
make install

system_tests/bootstrap.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ cp system_tests/systemctl /bin/systemctl
5353

5454
echo "cookbook_path [\"/etc/chef/cookbooks\"]" > /etc/chef/client.rb
5555

56-
mkdir -p /lib/modules/`uname -r`
56+
mkdir -p /lib/modules/${KERNEL_RELEASE}
5757

5858
platform=$(cat /etc/*-release | grep ID_LIKE | sed 's/.*=//')
5959

6060
if [ "$platform" == "debian" ]; then
61-
apt install -y linux-modules-`uname -r`
61+
apt install -y linux-modules-${KERNEL_RELEASE}
6262
else
6363
yum install -y kernel-modules
6464
fi

system_tests/systemd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ mkdir -p /home/ubuntu/.ssh
3535
chown -R ubuntu:ubuntu /home/ubuntu/.ssh
3636

3737
mkdir -p /opt/parallelcluster
38-
echo "aws-parallelcluster-cookbook-3.0.1" > /opt/parallelcluster/.bootstrapped
38+
echo "aws-parallelcluster-cookbook-3.2.0" > /opt/parallelcluster/.bootstrapped
3939

4040
mkdir -p /opt/parallelcluster/scripts
4141
mkdir -p /etc/parallelcluster

0 commit comments

Comments
 (0)