Skip to content

Commit 6bb079f

Browse files
committed
Replace munge auth plugin by slurm
1 parent f64b5e7 commit 6bb079f

File tree

8 files changed

+34
-114
lines changed

8 files changed

+34
-114
lines changed

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,20 +1067,15 @@ is a free and open-source job scheduler for Linux and Unix-like kernels,
10671067
used by many of the world's supercomputers and computer clusters.
10681068
[reference](https://en.wikipedia.org/wiki/Slurm_Workload_Manager)
10691069

1070-
> [MUNGE](https://github.com/dun/munge) (MUNGE Uid 'N' Gid Emporium) is
1071-
an authentication service for creating and validating credentials. It is
1072-
designed to be highly scalable for use in an HPC cluster environment.
1073-
[reference](https://dun.github.io/munge/)
1074-
10751070
This class installs base packages and config files that are essential
1076-
to all Slurm's roles. It also installs and configure Munge service.
1071+
to all Slurm's roles.
10771072

10781073
### parameters
10791074

10801075
| Variable | Description | Type |
10811076
| :---------------------- | :----------------------- | :------ |
10821077
| `cluster_name` | Name of the cluster | String |
1083-
| `munge_key` | Base64 encoded Munge key | String |
1078+
| `auth_key` | Base64 encoded Slurm auth key | String |
10841079
| `slurm_version` | Slurm version to install | Enum['24.05', '24.11', '25.05', '25.11'] |
10851080
| `os_reserved_memory` | Memory in MB reserved for the operating system on the compute nodes | Integer |
10861081
| `suspend_time` | Idle time (seconds) for nodes to becomes eligible for suspension. | Integer |
@@ -1098,7 +1093,7 @@ to all Slurm's roles. It also installs and configure Munge service.
10981093

10991094
```yaml
11001095
profile::slurm::base::cluster_name: "%{alias('terraform.data.cluster_name')}"
1101-
profile::slurm::base::munge_key: ENC[PKCS7, ...]
1096+
profile::slurm::base::auth_key: ENC[PKCS7, ...]
11021097
profile::slurm::base::slurm_version: '23.11'
11031098
profile::slurm::base::os_reserved_memory: 512
11041099
profile::slurm::base::suspend_time: 3600

bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ENC_CMD="eyaml encrypt -o block --pkcs7-public-key=${PKCS7_KEY}"
77
(
88
$ENC_CMD -l 'jupyterhub::prometheus_token' -s $(uuidgen)
99
$ENC_CMD -l 'profile::consul::acl_api_token' -s $(uuidgen)
10-
$ENC_CMD -l 'profile::slurm::base::munge_key' -s $(openssl rand 1024 | openssl enc -A -base64)
10+
$ENC_CMD -l 'profile::slurm::base::auth_key' -s $(openssl rand 1024 | openssl enc -A -base64)
1111
$ENC_CMD -l 'profile::slurm::accounting::password' -s $(openssl rand -base64 9)
1212
$ENC_CMD -l 'profile::freeipa::mokey::password' -s $(openssl rand -base64 9)
1313
$ENC_CMD -l 'profile::freeipa::server::ds_password' -s $(openssl rand -base64 9)

site/profile/files/base/prepare4image.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ systemctl daemon-reload
3030

3131
systemctl stop rsyslog
3232
: > /var/log/messages
33-
test -d /var/log/munge && : > /var/log/munge/munged.log
3433
: > /var/log/secure
3534
: > /var/log/cron
3635
test -d /var/log/audit && : > /var/log/audit/audit.log
-958 Bytes
Binary file not shown.

site/profile/files/slurm/munge_socket.te

Lines changed: 0 additions & 10 deletions
This file was deleted.

site/profile/manifests/slurm.pp

Lines changed: 27 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Slurm base class that is included in each different profile.
2-
# The class configures the slurm and munge users, install the
2+
# The class configures the slurm user, install the
33
# base slurm packages and configures everything that is required
44
# on all types of nodes.
55
# @param cluster_name Specifies the name of the cluster as it appears in slurm.conf
6-
# @param munge_key Specifies the munge secret key that allows slurm nodes to communicate
6+
# @param auth_key Specifies the auth secret key that allows slurm nodes to communicate
77
# @param slurm_version Specifies which version of Slurm to install
88
# @param os_reserved_memory Specifies the amount of memory reserved for the operating system in compute node
99
class profile::slurm::base (
1010
String $cluster_name,
11-
String $munge_key,
11+
String $auth_key,
1212
Enum['24.05', '24.11', '25.05', '25.11'] $slurm_version,
1313
Integer $os_reserved_memory,
1414
Integer $suspend_time = 3600,
@@ -39,64 +39,10 @@
3939
before => Package['slurm']
4040
}
4141

42-
group { 'munge':
43-
ensure => 'present',
44-
gid => '2002'
45-
}
46-
47-
user { 'munge':
48-
ensure => 'present',
49-
groups => 'munge',
50-
uid => '2002',
51-
home => '/var/lib/munge',
52-
comment => 'MUNGE Uid N Gid Emporium',
53-
shell => '/sbin/nologin',
54-
before => Package['munge']
55-
}
56-
5742
package { 'xauth':
5843
ensure => 'installed',
5944
}
6045

61-
package { 'munge':
62-
ensure => 'installed',
63-
}
64-
65-
# Sometime /var/run/munge is not created.
66-
# Munge RPM provides /usr/lib/tmpfiles.d/munge.conf
67-
# tmpfiles.d config was replaced with RuntimeDirectory as of munge 0.5.14
68-
# but we are stuck with 0.5.13 as upstream has not updated munge
69-
# since 2021. The next 2 file_lines make sure munge does not rely on
70-
# systemd-tmpfiles-setup.service.
71-
# Ref: https://github.com/dun/munge/commit/3eed37e3ca73c14b679394df7be151d27566b0fe
72-
# Ref: https://github.com/dun/munge/issues/75
73-
file_line { 'munge_runtimedirectory':
74-
path => '/usr/lib/systemd/system/munge.service',
75-
match => '^RuntimeDirectory=',
76-
line => 'RuntimeDirectory=munge',
77-
after => 'Group=munge',
78-
require => Package['munge'],
79-
notify => Service['munge'],
80-
}
81-
82-
file_line { 'munge_runtimedirectorymode':
83-
path => '/usr/lib/systemd/system/munge.service',
84-
match => '^RuntimeDirectoryMode=',
85-
line => 'RuntimeDirectoryMode=0755',
86-
after => 'Group=munge',
87-
require => Package['munge'],
88-
notify => Service['munge'],
89-
}
90-
91-
# Fix a warning in systemctl status munge about the location of the PID file.
92-
file_line { 'munge_pidfile':
93-
path => '/usr/lib/systemd/system/munge.service',
94-
match => '^PIDFile=',
95-
line => 'PIDFile=/run/munge/munged.pid',
96-
require => Package['munge'],
97-
notify => Service['munge'],
98-
}
99-
10046
file { '/var/log/slurm':
10147
ensure => 'directory',
10248
owner => 'slurm',
@@ -116,12 +62,6 @@
11662
seltype => 'usr_t'
11763
}
11864

119-
file { '/etc/munge':
120-
ensure => 'directory',
121-
owner => 'munge',
122-
group => 'munge'
123-
}
124-
12565
file { '/etc/slurm/cgroup.conf':
12666
ensure => 'present',
12767
owner => 'slurm',
@@ -155,20 +95,15 @@
15595
content => $slurm_path,
15696
}
15797

158-
file { '/etc/munge/munge.key':
98+
file { '/etc/slurm/slurm.key':
15999
ensure => 'present',
160-
owner => 'munge',
161-
group => 'munge',
162-
mode => '0400',
163-
content => $munge_key,
164-
before => Service['munge']
165-
}
166-
167-
service { 'munge':
168-
ensure => 'running',
169-
enable => true,
170-
subscribe => File['/etc/munge/munge.key'],
171-
require => Package['munge']
100+
owner => 'slurm',
101+
group => 'slurm',
102+
mode => '0600',
103+
content => $auth_key,
104+
require => [
105+
File['/etc/slurm'],
106+
]
172107
}
173108

174109
$yumrepo_prefix = "https://download.copr.fedorainfracloud.org/results/cmdntrf/Slurm${slurm_version}/"
@@ -187,7 +122,6 @@
187122
name => "slurm-${slurm_version}*",
188123
require => [
189124
Exec['enable_powertools'],
190-
Package['munge'],
191125
Yumrepo['slurm-copr-repo'],
192126
Yumrepo['epel'],
193127
],
@@ -197,7 +131,6 @@
197131
ensure => 'installed',
198132
require => [
199133
Package['slurm'],
200-
Package['munge'],
201134
Yumrepo['slurm-copr-repo']],
202135
}
203136

@@ -211,7 +144,6 @@
211144
ensure => 'installed',
212145
require => [
213146
Package['slurm'],
214-
Package['munge'],
215147
Yumrepo['slurm-copr-repo']
216148
],
217149
}
@@ -261,16 +193,6 @@
261193
require => File['/etc/slurm'],
262194
}
263195

264-
# SELinux policy required to allow confined users to submit job with Slurm 19, 20, 21.
265-
# Slurm commands tries to write to a socket in /var/run/munge.
266-
# Confined users cannot stat this file, neither write to it. The policy
267-
# allows user_t to getattr and write var_run_t sock file.
268-
# To get the policy, we had to disable dontaudit rules with : sudo semanage -DB
269-
selinux::module { 'munge_socket':
270-
ensure => 'present',
271-
source_pp => 'puppet:///modules/profile/slurm/munge_socket.pp',
272-
}
273-
274196
file {'/etc/slurm/nodes.conf':
275197
ensure => 'present',
276198
owner => 'slurm',
@@ -325,7 +247,6 @@
325247
name => "slurm-slurmdbd-${slurm_version}*",
326248
require => [
327249
Package['slurm'],
328-
Package['munge'],
329250
Yumrepo['slurm-copr-repo']
330251
],
331252
}
@@ -338,6 +259,7 @@
338259
File['/etc/slurm/slurmdbd.conf'],
339260
],
340261
subscribe => [
262+
File['/etc/slurm/slurm.key'],
341263
Mysql::Db['slurm_acct_db'],
342264
],
343265
before => Service['slurmctld']
@@ -515,7 +437,6 @@
515437
package { 'slurm-slurmctld':
516438
ensure => 'installed',
517439
require => [
518-
Package['munge'],
519440
Package['slurm'],
520441
],
521442
}
@@ -531,6 +452,7 @@
531452
File['/etc/slurm/slurm-addendum.conf'],
532453
File['/etc/slurm/gres.conf'],
533454
File['/etc/slurm/nodes.conf'],
455+
File['/etc/slurm/slurm.key'],
534456
]
535457
}
536458

@@ -757,6 +679,7 @@
757679
File['/etc/slurm/slurm.conf'],
758680
File['/etc/slurm/slurm-addendum.conf'],
759681
File['/etc/slurm/nodes.conf'],
682+
File['/etc/slurm/slurm.key'],
760683
],
761684
require => [
762685
Package['slurm-slurmd'],
@@ -799,4 +722,17 @@
799722
# controller through Slurm command-line tools.
800723
class profile::slurm::submitter {
801724
contain profile::slurm::base
725+
package { 'slurm-sackd':
726+
require => Yumrepo['slurm-copr-repo']
727+
}
728+
service { 'sackd':
729+
ensure => running,
730+
enable => true,
731+
subscribe => [
732+
File['/etc/slurm/slurm.key'],
733+
]
734+
require => [
735+
Package['slurm-sackd'],
736+
],
737+
}
802738
}

site/profile/templates/slurm/slurm.conf.epp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ JobAcctGatherParams=NoOverMemoryKill
2222

2323
# MANAGEMENT POLICIES
2424
ClusterName=<%= $cluster_name %>
25-
AuthType=auth/munge
26-
CryptoType=crypto/munge
25+
AuthType=auth/slurm
26+
CredType=cred/slurm
2727
SlurmUser=slurm
2828
# SCHEDULER CONFIGURATIONS
2929
SchedulerType=sched/backfill

site/profile/templates/slurm/slurmdbd.conf.epp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
AuthType=auth/munge
1+
AuthType=auth/slurm
22
LogFile=/var/log/slurm/slurmdbd.log
33
PidFile=/var/run/slurmdbd/slurmdbd.pid
44
DbdHost=<%= $dbd_host %>

0 commit comments

Comments
 (0)