Files
ilker c2ed05a7d3 hpcod: give a tenant a portal, and prove a job actually runs
Two of the four adoptions from section 21.

A provisioned tenant arrived with Slurm, MUNGE, OpenHPC, NFS /home and
sshd - everything a scheduler needs and nothing a user sees. Open OnDemand
4.2 now ships in the template and is configured per tenant at first boot. It
wants exactly the machine we already have, since the head node is both the
Slurm controller and the /home server, and because the software is in the
template it costs a tenant nothing at provision time: a cold provision with
the portal measured 141s against 134s without it.

Reachability is deliberately unsolved. The portal binds to the management
address alone - verified listening on 10.0.0.62:443 and nothing else - so it
is on neither the tenant fabric, where compute nodes have no business
reaching it, nor the internet. Publishing it needs a reverse proxy in the
control plane or a per-tenant DNS and certificate scheme, and that is a
decision about attack surface rather than a missing line of config. TLS is
self-signed and still worth having: without it the basic-auth password
crosses the management network in clear. The password is generated per
tenant on the head and never enters the template, so two tenants cannot
share one.

The second adoption is smaller and overdue. The verify role checked that the
cluster looked right; it now checks that it works, by running a job as the
cluster user and asserting every node appears in the output. The distinction
is not academic - during this system's development sinfo reported nodes idle
on a cluster that could not have run anything, more than once. A node
reaches "idle" by registering with slurmctld, which it can do while its
image is broken in ways that only surface when work lands on it.

Three assumptions in the first draft were wrong, and each is now handled
explicitly rather than by luck. The ondemand package ships config/ondemand.d
but not config/clusters.d, whose absence reads as "destination directory
does not exist" and says nothing about clusters. mod_ssl's own ssl.conf
claims 443 on the wildcard address, so Apache bound that first and then
refused OnDemand's specific listener with "Address already in use"; its
LoadModule lives in conf.modules.d, so standing the vhost down leaves TLS
intact. And the portal root answers 302, not 401 - it redirects to the
dashboard, which is where auth is enforced - so the probe follows redirects
and insists on the 401, since accepting the 302 alone would pass against a
portal that served its dashboard to anyone.

One bug caught before it shipped: the portal took its server name from
ansible_host, which on the first-boot path is "localhost", so the
certificate and listen address would both have been wrong. Terraform now
passes the management address through cloud-init, and B30 writes the same
variable so a control-plane run agrees with a first-boot one.

Verified on a cold provision from an empty state: terraform 38s,
self-configuration 43s, nodes 60s, 141s total; both nodes idle and each ran
a job; the portal answers 401 behind its redirect.
2026-09-20 09:30:53 +02:00

58 lines
2.0 KiB
YAML

---
# Deeper checks, run once the compute nodes have been powered on and have had
# time to PXE boot. Separated because booting is not instant: the node fetches
# a ~1.2 GiB image and unpacks it into RAM.
- name: Wait for every compute node to answer
ansible.builtin.wait_for:
host: "{{ item.ip }}"
port: 22
timeout: "{{ node_boot_timeout | default(900) }}"
loop: "{{ compute_nodes }}"
- name: Wait for Slurm to report the nodes idle
ansible.builtin.shell: |
set -o pipefail
sinfo -h -o '%t' | tr -d ' ' | sort -u
args:
executable: /bin/bash
register: verify_states
changed_when: false
retries: 30
delay: 10
until: verify_states.stdout_lines | reject('equalto', 'idle') | list | length == 0
# Everything above proves the cluster looks right. This proves it works.
#
# The distinction is not academic: during this system's development sinfo
# reported nodes idle on a cluster that could not have run anything, more
# than once. A node reaches "idle" by registering with slurmctld, which it
# can do while its image is broken in ways that only surface when work lands
# on it. Running an actual job as an actual user exercises MUNGE, the NFS
# home, the user's existence inside the node image, and the scheduler, in
# the one combination that matters.
- name: Run a job on every node, as a user rather than as root
become_user: "{{ hpc_user }}"
ansible.builtin.command:
cmd: >-
srun --nodes={{ compute_nodes | length }}
--ntasks={{ compute_nodes | length }}
--time=2 hostname
register: verify_job
changed_when: false
timeout: 180
- name: The job ran on every node
ansible.builtin.assert:
that: item.name in verify_job.stdout
fail_msg: >-
{{ item.name }} is registered and idle but did not run the test job.
Slurm considers it healthy; something in its image does not work.
loop: "{{ compute_nodes }}"
- name: Cluster is up
ansible.builtin.debug:
msg: >-
{{ compute_nodes | length }} nodes idle in partition
{{ slurm_partition }}, and each one ran a job