Dev slurm lua

From GoogleCloudPlatform/k8s-bridge · View interactive version

Dev slurm lua is an AI agent skill from the GitHub repository GoogleCloudPlatform/k8s-bridge. Implements, modifies, and tests the Slurm Lua plugins (hack/job_submit.lua and hack/cli_filter.lua) that validate CLI options, place jobs on bridged partitions into auto-hold, and protect k8s-bridge job constraints. Use when adding allowed Slurm CLI flags, changing job submission or modification int

How to use this skill

Skill file

Slurm Lua Plugins Workflow (`dev-slurm-lua`)

1. Preconditions & Inputs

Before modifying or testing the Slurm Lua scripts, inspect:


2. Guardrails


3. Step-by-Step Procedure

Step 1: Modify `hack/cli_filter.lua` or `hack/job_submit.lua`

  1. CLI flag allowlist (hack/cli_filter.lua): Update ALLOWED_OPTIONS or pre_submit_validate while preserving existing hetjob, argv, and spank: handling.
  2. Submission & modification hooks (hack/job_submit.lua): Update slurm_job_submit or slurm_job_modify while preserving existing AutoHoldMarker hold/unhold and non-admin immutability invariants.
  3. Sync paired E2E tests: Update the paired E2E specs in Section 1 whenever ALLOWED_OPTIONS or Lua rejection rules change.

Step 2: Update Lua Scripts in an Active Cluster

Select the option matching your deployment. In both options, wait ~60s for kubelet ConfigMap propagation into slurm-controller-0 (or verify sha256sum /etc/slurm/cli_filter.lua in slurmctld matches hack/cli_filter.lua) before running scontrol reconfigure:

helm upgrade slurm oci://ghcr.io/slinkyproject/charts/slurm \
  --namespace slurm --reuse-values \
  --set-file 'configFiles.job_submit\.lua=hack/job_submit.lua' \
  --set-file 'configFiles.cli_filter\.lua=hack/cli_filter.lua' \
  --wait
kubectl -n slurm exec slurm-controller-0 -c slurmctld -- scontrol reconfigure
kubectl -n slurm create configmap slurm-job-submit-lua --from-file=job_submit.lua=hack/job_submit.lua --dry-run=client -o yaml | kubectl apply -f -
kubectl -n slurm create configmap slurm-cli-filter-lua --from-file=cli_filter.lua=hack/cli_filter.lua --dry-run=client -o yaml | kubectl apply -f -
kubectl -n slurm exec slurm-controller-0 -c slurmctld -- scontrol reconfigure

4. Verification

  1. Non-root verification on a running cluster: Run scripts/test-nonroot-submission.sh (defaults to deploy/slurm-login-slinky and k8s-partition, or pass LOGIN_DEPLOY=deploy/slurm-login PARTITION=workloadmixing-partition TEST_USER=foo on a Kind E2E cluster) to verify CLI option filtering, multi-partition rejection, and user-hold release takeover.
  2. Automated E2E verification: Run the flag rejection and partition mapping specs via skills/test-e2e-cluster/SKILL.md.

5. Handoffs & Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.