clusterctl

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2026 License: GPL-3.0, LGPL-3.0

README

clusterctl

One binary to administer HPC clusters: reach the hosts of a site, select nodes with ClusterShell node set syntax, run commands on them in parallel, drive their service processors, reinstall them and administer Slurm.

$ clusterctl node select '@idle&@rack:R02'
exe[0004-0009]

$ clusterctl exec -n '@idle' --dedup -- uname -r
exe[0001-0009] (9)
  5.14.0-570.el9.x86_64
exe0010 (1)
  4.18.0-553.el8.x86_64

$ clusterctl slurm node drain 'ticket 4711: failing DIMM' -n exe0007
About to drain 1 host: exe0007
  reason: ticket 4711: failing DIMM
Continue? [y/N] y
drained exe0007

$ clusterctl provision reinstall -n '@rack:R02' --dry-run
Would reinstall 10 hosts: exe[0001-0010]
  everything on these machines is lost

Manual: https://gsi-hpc.github.io/clusterctl/ · Design notes: doc/

What it does

Reach everything One host key file the team keeps in version control, one generated ssh configuration, and sshuttle profiles for the networks behind a gateway.
Select and fan out ClusterShell node sets, groups from node attributes, tables or the workload manager, and bounded parallel execution that reports every node.
Operate hardware Redfish with a pinned certificate, FreeIPMI and ipmitool run on a host that can reach the service network, rack power units, and the InfiniBand fabric.
Reinstall nodes DHCP inspection, per-node PXE and GRUB boot paths, age or sops encrypted secrets streamed to the node, and the configuration management client.
Administer Slurm Nodes and their drain reasons, the queue and the accounting database, accounts, users and fair share.
Serve several clusters Domains, naming, roles, networks and the inventory live in YAML, not in the code.
Work with an agent An MCP server that lets an AI agent read the cluster and plan changes, which you confirm before anything is sent.

Install

With mise, which pins a version per project and verifies the download:

$ mise use -g github:GSI-HPC/clusterctl
$ clusterctl version

Or take the binary for your platform from the releases:

$ curl -fsSL -o clusterctl.tar.gz \
    https://github.com/GSI-HPC/clusterctl/releases/latest/download/clusterctl_linux_amd64.tar.gz
$ tar xzf clusterctl.tar.gz
$ install -m 0755 clusterctl ~/.local/bin/

Or build it:

$ go install github.com/GSI-HPC/clusterctl/cmd/clusterctl@latest

Go 1.26 or newer. The toolchain downloads itself if yours is older.

Get started

$ mkdir -p ~/.config/clusterctl
$ cp examples/site/*.yaml ~/.config/clusterctl/    # then edit them
$ clusterctl config validate
$ clusterctl doctor
$ clusterctl node list

examples/site/ is a complete configuration to copy. The manual walks through it, and doc/migration.md maps every command and setting of the shell toolkit clusterctl replaces to its counterpart.

Shell completion

$ clusterctl completion bash > /etc/bash_completion.d/clusterctl
$ clusterctl completion zsh  > "${fpath[1]}/_clusterctl"

Node set completion offers the configured groups, and --context offers the configured contexts.

Exit codes

Code Meaning
0 Everything succeeded
1 At least one target failed
2 Usage or configuration error
3 A host could not be reached
130 Interrupted, or a confirmation declined

Using the node set engine

The node set implementation is offered as a library, because the Go ecosystem had none:

import "github.com/GSI-HPC/clusterctl/nodeset"

ns, err := nodeset.Parse("exe[0001-0010]!exe0003")
fmt.Println(ns)          // exe[0001-0002,0004-0010]
fmt.Println(ns.Len())    // 9

Contributing

The repository carries a mise.toml, so the toolchain comes from mise if you use it:

$ mise install  # Go and golangci-lint, at the versions CI uses
$ make test     # unit and command tests
$ make lint     # vet and formatting
$ make cover    # coverage
$ make build    # bin/clusterctl

The documentation site needs Hugo extended; see site/README.md.

Commits are Conventional Commits. Design notes and the decision records are in doc/; a change that takes a decision gets a record.

Licence

LGPL-3.0-or-later. See COPYING and COPYING.LESSER.

Directories

Path Synopsis
cmd
clusterctl command
Command clusterctl administers HPC clusters: it reaches the hosts of a site, selects and drives nodes, operates their service processors, provisions them and administers Slurm.
Command clusterctl administers HPC clusters: it reaches the hosts of a site, selects and drives nodes, operates their service processors, provisions them and administers Slurm.
internal
apis/v1alpha1
Package v1alpha1 defines the configuration objects clusterctl reads.
Package v1alpha1 defines the configuration objects clusterctl reads.
app
Package app wires the configuration, the transport and the node model into the context every command runs against.
Package app wires the configuration, the transport and the node model into the context every command runs against.
cli
Package cli defines the clusterctl command tree.
Package cli defines the clusterctl command tree.
config
Package config finds, validates, merges and resolves the clusterctl configuration.
Package config finds, validates, merges and resolves the clusterctl configuration.
credentials
Package credentials resolves the accounts used for service processors and power distribution units.
Package credentials resolves the accounts used for service processors and power distribution units.
dhcp
Package dhcp reads an ISC dhcpd configuration.
Package dhcp reads an ISC dhcpd configuration.
exitcode
Package exitcode defines the process exit codes clusterctl guarantees.
Package exitcode defines the process exit codes clusterctl guarantees.
fanout
Package fanout runs one request on many targets at once.
Package fanout runs one request on many targets at once.
fileutil
Package fileutil writes files the way a tool several administrators run at once has to: completely or not at all, and under a lock when the file is shared.
Package fileutil writes files the way a tool several administrators run at once has to: completely or not at all, and under a lock when the file is shared.
groups
Package groups resolves the @group references of a node set expression.
Package groups resolves the @group references of a node set expression.
hostkeys
Package hostkeys reads, writes and collects SSH host keys.
Package hostkeys reads, writes and collects SSH host keys.
inventory
Package inventory answers questions about the nodes of a site: their attributes, where they sit, what address they have and what they boot.
Package inventory answers questions about the nodes of a site: their attributes, where they sit, what address they have and what they boot.
ipmi
Package ipmi drives the FreeIPMI and ipmitool backends that talk to service processors over the management network.
Package ipmi drives the FreeIPMI and ipmitool backends that talk to service processors over the management network.
mcpserver
Package mcpserver offers clusterctl to an AI agent over the Model Context Protocol.
Package mcpserver offers clusterctl to an AI agent over the Model Context Protocol.
naming
Package naming turns short node names into host names and service processor names, replacing the prefix logic the shell tools carried.
Package naming turns short node names into host names and service processor names, replacing the prefix logic the shell tools carried.
output
Package output renders command results in the format the caller asked for.
Package output renders command results in the format the caller asked for.
redfish
Package redfish talks to the Redfish interface of a service processor.
Package redfish talks to the Redfish interface of a service processor.
safety
Package safety gates the commands that change or destroy something.
Package safety gates the commands that change or destroy something.
secrets
Package secrets decrypts the age encrypted files a site keeps beside its configuration.
Package secrets decrypts the age encrypted files a site keeps beside its configuration.
secrets/sopstest
Package sopstest writes sops encrypted files for tests, the way "sops --encrypt --encrypted-regex '^(data|binaryData)$'" writes them, so that no test depends on a sops binary or on a private key kept in the repository.
Package sopstest writes sops encrypted files for tests, the way "sops --encrypt --encrypted-regex '^(data|binaryData)$'" writes them, so that no test depends on a sops binary or on a private key kept in the repository.
shellquote
Package shellquote renders an argument vector as a POSIX shell word list.
Package shellquote renders an argument vector as a POSIX shell word list.
slurm
Package slurm reads and changes the state of a Slurm cluster through its command line clients, which run on a host that has them.
Package slurm reads and changes the state of a Slurm cluster through its command line clients, which run on a host that has them.
tmpl
Package tmpl expands the {placeholder} templates the configuration uses for host names and tunnel definitions.
Package tmpl expands the {placeholder} templates the configuration uses for host names and tunnel definitions.
tools/gendocs command
Command gendocs writes the generated part of the documentation site: the command reference and the JSON Schemas of the configuration kinds.
Command gendocs writes the generated part of the documentation site: the command reference and the JSON Schemas of the configuration kinds.
transport
Package transport runs commands on remote hosts through the OpenSSH client.
Package transport runs commands on remote hosts through the OpenSSH client.
tunnel
Package tunnel manages the sshuttle profiles a site offers.
Package tunnel manages the sshuttle profiles a site offers.
version
Package version reports the build provenance of the clusterctl binary.
Package version reports the build provenance of the clusterctl binary.
Package nodeset parses, folds and expands ClusterShell style node sets.
Package nodeset parses, folds and expands ClusterShell style node sets.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL