Skip to content

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.

Reconciles
HostClaim (For). Controller name hostclaim. The same lane runs host-wipe.
Writes
spec.claimRef and spec.os on the Host, the claim status, boot and release HostOperations, and boot BootAssets.
Finalizer
metal.platform-kit.org/release on 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).
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.
The HostClaim reconcile loop: release if deleted, add the finalizer, resolve the target, bind, provision.Read the claim1deletedRelease the machineclaim has a deletion timestampAdd the release finalizer2Resolve the target HostAsset → endpoint → system3Bound = FalseAssetNotFound, AmbiguousSystem …Release the old Host firstonly if the claim moved4Bound = FalseReplacingBind: write claimRef on the Host5Bound = FalseHostAlreadyClaimedProvisionpropose one boot operation6Provisioned = Falsethe reason it waitsStamp phase, update status7next pass: an event on a watched kind
One pass of the HostClaim controller.
  1. Read the claim. If it has a deletion timestamp, run the release (see below). If the claim is gone, unbind what it still holds.
  2. Add the finalizer metal.platform-kit.org/release.
  3. Resolve the target: the Asset, its endpoint, then the discovered systems. One system is the target. More than one needs spec.systemRef.
  4. If the claim held another Host before, release that Host first. A claim never holds two machines that run the same node.
  5. Bind: write spec.claimRef and spec.os on the Host. The first writer wins. The API server rejects a second writer with a conflict.
  6. Provision: if all inputs are ready, propose one boot HostOperation. Then follow it and record the hand-off.
  7. Stamp the phase and update the status if it changed.

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.

When you delete the claim, the finalizer holds it until the machine is back.

  1. Propose a release operation if one of these is true:

    • The Host shows that the node runs (OSReady is 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.

  2. If none of these is true, unbind the machine as it is. The controller first confirms against the API server that no boot ran.

  3. Withdraw the boot operations that did not finish, after the release operation exists.

  4. Clear claimRef, spec.os and 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 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.

  1. If the Host has no metal.platform-kit.org/disk-not-wiped, remove the wipe request.
  2. If a claim records an install on the Host, or the Host is in maintenance, do nothing.
  3. Make a factory BootAsset whose kernel argument talos.experimental.wipe=system wipes the system disk.
  4. Propose a wipe operation: eject all slots, insert the image, set a one-time boot override, power cycle. It always needs approval.
  5. When the operation succeeded, remove both annotations.
Alert and hold
If the Asset stops resolving under a live bind, the claim keeps the bind. Bound stays True with BindRetained. 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.nodeRef or provisioning.approval: Automatic. See Approval.
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)
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.
API groupResourcesVerbsScopeMarker in
metal.platform-kit.orghostclaimsgetlistwatchupdateclusterhostclaim_controller.go
metal.platform-kit.orghostclaims/statusupdateclusterhostclaim_controller.go
metal.platform-kit.orgassetsgetlistwatchclusterhostclaim_controller.go
metal.platform-kit.orgmanagementendpointsgetlistwatchclusterhostclaim_controller.go
metal.platform-kit.orghostsgetlistwatchupdateclusterhostclaim_controller.go
metal.platform-kit.orghostoperationsgetlistwatchcreatedeleteclusterhostclaim_controller.go
os.platform-kit.orgtalosclusterstalosnodesgetlistwatchclusterhostclaim_controller.go
os.platform-kit.orgbootassetsgetlistwatchcreateupdatedeleteclusterhostclaim_controller.go
coresecretsgetlistwatchnamespace pk-metalhostclaim_controller.go
corenodesgetclusterselfprotect.go
metal.platform-kit.orghostclaimsgetclusterselfprotect.go

Protocol model explains the model tests of the claim protocol.