Controller · manager
HostClaim controller
The HostClaim controller binds each HostClaim to one Host, like a volume claim binds a volume. If the claim names a TalosNode, it proposes one boot operation. When you delete the claim, it releases the machine.
At a glance
Section titled “At a glance”- Reconciles
- HostClaim (
For). Controller namehostclaim. The same lane runshost-wipe. - Writes
spec.claimRefandspec.oson the Host, the claim status, boot and release HostOperations, and boot BootAssets.- Finalizer
metal.platform-kit.org/releaseon the claim. It holds the delete until the machine is back.- Talks to
- The Talos API of control planes, to read the etcd members before a node joins or leaves. It never talks to a BMC.
- Requeue
- None. Events on Hosts, operations, endpoints, Assets, Talos nodes and boot assets start the next pass.
- Flags
--checkin-timeout(default 30 minutes) and--release-shutdown-timeout(default 5 minutes).
Watches
Section titled “Watches”| Kind | Relation | Why a change starts a pass |
|---|---|---|
| HostClaim | For |
You wrote, changed or deleted the claim. |
| Host | Watches |
The Host appeared or became free. A waiting claim tries again. |
| HostOperation | Watches |
The boot or release operation moved. |
| ManagementEndpoint | Watches |
The media slots and boot targets shape the boot plan. |
| Asset | Watches, index .spec.assetRef.name |
Materialized says why a claim waits. |
| TalosNode | Watches |
The render or the check-in of the node moved. |
| BootAsset | Watches |
The boot media became ready. |
Reconcile loop
Section titled “Reconcile loop”- Read the claim. If it has a deletion timestamp, run the release (see below). If the claim is gone, unbind what it still holds.
- Add the finalizer
metal.platform-kit.org/release. - Resolve the target: the Asset, its endpoint, then the discovered systems. One system is the target. More than one needs
spec.systemRef. - If the claim held another Host before, release that Host first. A claim never holds two machines that run the same node.
- Bind: write
spec.claimRefandspec.oson the Host. The first writer wins. The API server rejects a second writer with a conflict. - Provision: if all inputs are ready, propose one boot HostOperation. Then follow it and record the hand-off.
- Stamp the phase and update the status if it changed.
Provision: what the boot waits for
Section titled “Provision: what the boot waits for”The controller proposes the boot only when each item below is true. If an item is false, Provisioned is False with the reason.
| Wait | Reason |
|---|---|
| You did not put the claim on hold. | HeldByUser |
| The Host is not in maintenance. | HostInMaintenance |
The Host is Verified. |
AwaitingVerification |
| The Host does not hold the install of another node. | DiskNotWiped |
| The TalosNode and TalosCluster exist, and the node has a rendered config. | AwaitingRender |
| The BMC has a media slot that can boot. | NoBootableMedia, SingleMediumUnsupported |
The boot assets are Ready. |
AwaitingBootAsset |
| The operator does not run on this machine. | SelfDisruption |
The boot plan has a hash. The hash names the operation, so the same plan never makes two operations. A new render, image or endpoint shape is a new plan. The boot has one of three shapes:
- Two media: the installer on a boot slot, the config medium on another slot.
- Config only: one slot, and the machine already runs Talos in maintenance mode.
- Embedded installer: one slot and a blank machine. One installer with the config built in. See One-slot BMC.
Release
Section titled “Release”When you delete the claim, the finalizer holds it until the machine is back.
-
Propose a release operation if one of these is true:
- The Host shows that the node runs (
OSReadyis True). - The hand-off record of the claim names the Host.
- A boot of the claim ran on the machine.
The operation takes the node out of its cluster, then powers the machine off and empties the media slots.
- The Host shows that the node runs (
-
If none of these is true, unbind the machine as it is. The controller first confirms against the API server that no boot ran.
-
Withdraw the boot operations that did not finish, after the release operation exists.
-
Clear
claimRef,spec.osand the power-off annotation on the Host. Remove the finalizer.
A held claim, or a Host in maintenance, stops the release before approval. If the node does not answer, nothing can wipe the disk. The Host then gets the annotation metal.platform-kit.org/disk-not-wiped. See Release a host.
The host-wipe helper
Section titled “The host-wipe helper”The lane also runs the controller host-wipe, For Host.
It acts only on a Host with the annotation metal.platform-kit.org/wipe, which pk-metal wipe sets.
- If the Host has no
metal.platform-kit.org/disk-not-wiped, remove the wipe request. - If a claim records an install on the Host, or the Host is in maintenance, do nothing.
- Make a factory BootAsset whose kernel argument
talos.experimental.wipe=systemwipes the system disk. - Propose a wipe operation: eject all slots, insert the image, set a one-time boot override, power cycle. It always needs approval.
- When the operation succeeded, remove both annotations.
Guards and decisions
Section titled “Guards and decisions”- Alert and hold
- If the Asset stops resolving under a live bind, the claim keeps the bind.
Boundstays True withBindRetained. A resolution failure never releases a machine. - Etcd membership
- Before a control plane joins or leaves, the controller reads etcd membership live from the control planes. It does not count TalosNodes. See Remove a node.
- Admission
- Only an admin may set
spec.os.nodeReforprovisioning.approval: Automatic. See Approval.
Writes
Section titled “Writes”| Object or field | When | Field manager |
|---|---|---|
Host spec.claimRef, spec.os |
Bind, re-stamp, release | manager (update) |
Host annotations metal.platform-kit.org/release-power-off, metal.platform-kit.org/disk-not-wiped, metal.platform-kit.org/wipe |
Release and wipe | manager (update) |
Claim finalizer metal.platform-kit.org/release |
First pass, end of release | manager (update) |
Claim status: Bound, Provisioned, hostRef, handOff, phase |
When it changed | manager (status update) |
HostOperations with label metal.platform-kit.org/purpose = provision, release, remove or wipe |
Propose (create) and withdraw (delete) | manager |
BootAssets with label metal.platform-kit.org/provisioning |
Before a boot | manager (create) |
Failure modes
Section titled “Failure modes”| You see | Cause | Do this |
|---|---|---|
Bound=False, AmbiguousSystem |
The endpoint fronts more than one system. | Set spec.systemRef. See Claim ambiguous. |
Bound=False, HostAlreadyClaimed |
Another claim holds the Host. | Delete the other claim, or choose another Asset. |
Provisioned=False, OperationFailed |
The boot operation failed. | Use Operation failed. |
Provisioned=False, AwaitingOperation |
The boot waits for approval. | Use pk-metal approve. |
Permissions
Section titled “Permissions”| API group | Resources | Verbs | Scope | Marker in |
|---|---|---|---|---|
metal.platform-kit.org | hostclaims | getlistwatchupdate | cluster | hostclaim_controller.go |
metal.platform-kit.org | hostclaims/status | update | cluster | hostclaim_controller.go |
metal.platform-kit.org | assets | getlistwatch | cluster | hostclaim_controller.go |
metal.platform-kit.org | managementendpoints | getlistwatch | cluster | hostclaim_controller.go |
metal.platform-kit.org | hosts | getlistwatchupdate | cluster | hostclaim_controller.go |
metal.platform-kit.org | hostoperations | getlistwatchcreatedelete | cluster | hostclaim_controller.go |
os.platform-kit.org | talosclusterstalosnodes | getlistwatch | cluster | hostclaim_controller.go |
os.platform-kit.org | bootassets | getlistwatchcreateupdatedelete | cluster | hostclaim_controller.go |
core | secrets | getlistwatch | namespace pk-metal | hostclaim_controller.go |
core | nodes | get | cluster | selfprotect.go |
metal.platform-kit.org | hostclaims | get | cluster | selfprotect.go |
Protocol model explains the model tests of the claim protocol.