Skip to content

Commit

Permalink
tests: add integration test for configless slurm
Browse files Browse the repository at this point in the history
Signed-off-by: Jason C. Nucciarone <[email protected]>
  • Loading branch information
NucciTheBoss committed Jun 25, 2024
1 parent 4d0e52f commit 2cf64b5
Show file tree
Hide file tree
Showing 5 changed files with 272 additions and 0 deletions.
170 changes: 170 additions & 0 deletions tests/integration/configless-slurm/configless-slurm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Copyright 2024 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: "configless slurm integration test"
provider:
lxd:
acts:
ldap-server:
name: "Provision IAM integration"
run-on: noble
keep-alive: true
input:
- host-path: testdata/glauth.conf
path: glauth.cfg
scenes:
- name: "Install LDAP server (glauth)"
run: |
while timeout -k 370 360 snap install glauth --edge; [ $? != 0 ]
do sleep 1
done
- name: "Start LDAP server"
run: |
mv glauth.cfg /var/snap/glauth/common/etc/glauth/glauth.d
snap start glauth
nfs-server:
name: "Provision shared storage integration"
run-on: noble
keep-alive: true
input:
- host-path: testdata/sssd.conf
path: sssd.conf
- host-path: testdata/exports.conf
path: exports
scenes:
- name: "Install NFS server (nfs-kernel-server)"
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get install -y nfs-kernel-server sssd-ldap
- name: "Connect to IAM provider"
run: |
mv sssd.conf /etc/sssd
chmod 0600 /etc/sssd/sssd.conf
chown root:root /etc/sssd/sssd.conf
systemctl restart sssd
- name: "Start NFS server"
run: |
mkdir -p /home/researcher
chown researcher:researchers /home/researcher
mv exports /etc
exportfs -a
systemctl restart nfs-server
controller:
name: "Provision workload scheduler (controller)"
run-on: noble
keep-alive: true
input:
- host-path: testdata/slurm.snap
path: slurm.snap
- host-path: testdata/slurm.conf
path: slurm.conf
- host-path: testdata/sssd.conf
path: sssd.conf
output:
- key: munge
path: /var/snap/slurm/common/etc/munge/munge.key
scenes:
- name: "Install Slurm (slurmctld + munge)"
run: |
export DEBIAN_FRONTEND=noninteractive
while timeout -k 370 360 snap install ./slurm.snap --dangerous --classic; [ $? != 0 ]
do sleep 1
done
apt-get install -y nfs-common sssd-ldap
- name: "Connect to IAM provider"
run: |
mv sssd.conf /etc/sssd
chmod 0600 /etc/sssd/sssd.conf
chown root:root /etc/sssd/sssd.conf
systemctl restart sssd
- name: "Mount shared storage"
run: |
mount -t nfs nfs-server:/home /home
- name: "Start controller service"
run: |
export CONTROLLER_HOSTNAME=$(hostname -I | xargs)
envsubst < slurm.conf > /var/snap/slurm/common/etc/slurm/slurm.conf
snap start slurm.slurmctld
snap restart slurm.munged
compute:
name: "Provision workload scheduler (compute)"
run-on: noble
keep-alive: true
input:
- host-path: testdata/slurm.snap
path: slurm.snap
- key: munge
path: munge.key
- host-path: testdata/sssd.conf
path: sssd.conf
scenes:
- name: "Install Slurm (slurmd + munge)"
run: |
export DEBIAN_FRONTEND=noninteractive
while timeout -k 370 360 snap install ./slurm.snap --dangerous --classic; [ $? != 0 ]
do sleep 1
done
apt-get install -y nfs-common sssd-ldap
- name: "Connect to IAM provider"
run: |
mv sssd.conf /etc/sssd
chmod 0600 /etc/sssd/sssd.conf
chown root:root /etc/sssd/sssd.conf
systemctl restart sssd
- name: "Mount shared storage"
run: |
mount -t nfs nfs-server:/home /home
- name: "Start compute service"
run: |
mv munge.key /var/snap/slurm/common/etc/munge/munge.key
snap set slurm slurmd.config-server=controller:6817
snap restart slurm.munged
snap start slurm.slurmd
run-sim:
name: "Run example workload"
run-on: controller
keep-alive: true
scenes:
- name: "Submit job to cluster"
run: |
sudo -u researcher \
slurm.srun -N 1 -p all echo hello world
cleanup-compute:
name: "Cleanup compute node"
run-on: compute
scenes:
- name: "Unmount /home"
run: |
umount /home
cleanup-controller:
name: "Cleanup controller node"
run-on: controller
scenes:
- name: "Unmount /home"
run: |
umount /home
cleanup-nfs-server:
name: "Cleanup nfs-server node"
run-on: nfs-server
scenes:
- name: "Stop NFS server"
run: |
systemctl stop nfs-server
2 changes: 2 additions & 0 deletions tests/integration/configless-slurm/testdata/exports.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/srv *(ro,sync,subtree_check)
/home *(rw,sync,no_subtree_check)
53 changes: 53 additions & 0 deletions tests/integration/configless-slurm/testdata/glauth.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[ldap]
enabled = true
listen = "0.0.0.0:363"

[backend]
datastore = "config"
baseDN = "dc=glauth,dc=com"
nameformat = "cn"
groupformat = "ou"
anonymousdse = true

[behaviors]
IgnoreCapabilities = false
LimitFailedBinds = true
NumberOfFailedBinds = 3
PeriodOfFailedBinds = 10
BlockFailedBindsFor = 60
PruneSourceTableEvery = 600
PruneSourcesOlderThan = 600

[[users]]
name = "researcher"
givenname="Researcher"
sn="Science"
mail = "[email protected]"
uidnumber = 5002
primarygroup = 5501
loginShell = "/bin/bash"
homeDir = "/home/researcher"
passsha256 = "6478579e37aff45f013e14eeb30b3cc56c72ccdc310123bcdf53e0333e3f416a" # dogood
passappsha256 = [
"c32255dbf6fd6b64883ec8801f793bccfa2a860f2b1ae1315cd95cdac1338efa", # TestAppPw1
"c9853d5f2599e90497e9f8cc671bd2022b0fb5d1bd7cfff92f079e8f8f02b8d3", # TestAppPw2
"4939efa7c87095dacb5e7e8b8cfb3a660fa1f5edcc9108f6d7ec20ea4d6b3a88", # TestAppPw3
]

[[users]]
name = "serviceuser"
mail = "[email protected]"
uidnumber = 5003
primarygroup = 5502
passsha256 = "652c7dc687d98c9889304ed2e408c74b611e86a40caa51c4b43f1dd5913c5cd0" # mysecret
[[users.capabilities]]
action = "search"
object = "*"

[[groups]]
name = "researchers"
gidnumber = 5501

[[groups]]
name = "svcaccts"
gidnumber = 5502
26 changes: 26 additions & 0 deletions tests/integration/configless-slurm/testdata/slurm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
SlurmctldHost=controller(${CONTROLLER_HOSTNAME})
SlurmctldParameters=enable_configless
ClusterName=test-cluster

AuthType=auth/munge
FirstJobId=65536
InactiveLimit=120
ProctrackType=proctrack/linuxproc
KillWait=30
MaxJobCount=10000
MinJobAge=3600
ReturnToService=0
SchedulerType=sched/backfill
SlurmctldLogFile=/var/snap/slurm/common/var/log/slurm/slurmctld.log
SlurmdLogFile=/var/snap/slurm/common/var/log/slurm/slurmd.log
SlurmdSpoolDir=/var/snap/slurm/common/var/lib/slurm/slurmd
StateSaveLocation=/var/snap/slurm/common/var/lib/slurm/checkpoint
SwitchType=switch/none
TmpFS=/tmp
WaitTime=30

# Node Configurations
NodeName=compute CPUs=1 RealMemory=1000 TmpDisk=10000

# Partition Configurations
PartitionName=all Nodes=compute MaxTime=30 MaxNodes=1 State=UP
21 changes: 21 additions & 0 deletions tests/integration/configless-slurm/testdata/sssd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[sssd]
config_file_version = 2
services = nss, pam, ssh
domains = sssd

[nss]

[pam]

[domain/sssd]
cache_credentials = True
id_provider = ldap
auth_provider = ldap
ldap_uri = ldap://ldap-server:363
ldap_search_base = dc=glauth,dc=com
ldap_default_bind_dn = cn=serviceuser,ou=svcaccts,dc=glauth,dc=com
ldap_default_authtok_type = password
ldap_default_authtok = mysecret
ldap_group_member = member
ldap_schema = rfc2307bis
enumerate = True

0 comments on commit 2cf64b5

Please sign in to comment.