Skip to content

Controller · manager

Asset controller

The Asset controller turns each Asset into a ManagementEndpoint. It finds the address of the BMC in the ledger and writes the full spec of the endpoint.

Reconciles
Asset (For). Controller name asset.
Writes
The ManagementEndpoint with the same name as the Asset, and the Asset condition Materialized.
Talks to
Nothing outside the cluster. It reads the ledger file that the manager loaded at start.
Requeue
None. A change to the Asset or to its endpoint starts the next pass.
Lane
LaneAsset, the first lane that SetupAll wires.
Source
asset_controller.go
Kind Relation Why a change starts a pass
Asset For You wrote or changed the Asset.
ManagementEndpoint Owns Somebody changed or deleted the endpoint. The controller writes it again.
The Asset reconcile loop: read the Asset, check bmcMac, look it up in the ledger, then create or update the endpoint.Read the Asset1Stopgone, or being deletedIs spec.bmcMac set?2noNoBMCMacLook up bmcMac in the ledger3missingLedgerEntryInvalid / NoLedgerEntryCreate or update the endpointaddress, credentialsRef, TLS4ownedMaterializeConflictanother Asset owns itMaterialized = TrueEndpointMaterialized5next pass: Asset or endpoint event
One pass of the Asset controller. Each exit sets Materialized to False and records an event.
  1. Read the Asset. If it is gone or has a deletion timestamp, stop. Garbage collection removes the endpoint, because the Asset owns it.
  2. If spec.bmcMac is empty, set Materialized to False with the reason NoBMCMac.
  3. Find the MAC in the ledger. If the ledger skipped the line for this MAC, the reason is LedgerEntryInvalid. If the MAC is not in the ledger, the reason is NoLedgerEntry.
  4. Create or update the endpoint with the same name as the Asset. The spec gets the address from the ledger, the credentialsRef from the Asset and the TLS policy from the manager flags.
  5. Set the owner reference to the Asset and set Materialized to True.
The ledger is read once
The manager reads the ledger file at start. After you edit the ledger ConfigMap, restart the Deployment. The message of NoLedgerEntry gives the command.
An event only on change
The controller records a Warning event only when the reason or the message of Materialized changes. The condition stays; the event is for people who watch events.
No fight over a name
If an endpoint with the same name belongs to another Asset, the controller does not change it. It sets MaterializeConflict.
Object or field When Field manager
ManagementEndpoint spec (all of it) and owner reference Each pass with a ledger entry manager (create or update)
Asset status.conditions[Materialized] When the condition changes manager (status update)
Event on the Asset When the verdict changes pk-metal event source
Condition Status Reason Meaning
Materialized True EndpointMaterialized The endpoint exists at the address from the ledger.
Materialized False NoBMCMac The Asset names no BMC MAC.
Materialized False NoLedgerEntry The MAC is not in the ledger.
Materialized False LedgerEntryInvalid The ledger line for the MAC did not parse.
Materialized False MaterializeConflict An endpoint with this name belongs to another Asset.
You see Cause Do this
Materialized=False, NoLedgerEntry The MAC is not in the ledger, or has a typo. Add the line to the ledger, then restart the manager. See Enroll hosts.
Materialized=False, LedgerEntryInvalid The ledger line has a syntax error. Correct the line. The manager log names it.
Materialized=False, MaterializeConflict Two Assets have the same name. Rename one Asset.
No Host after a long time The endpoint does not reach the BMC. Use BMC unreachable.
API groupResourcesVerbsScope
metal.platform-kit.orgassetsgetlistwatchcluster
metal.platform-kit.orgassets/statusupdatecluster
metal.platform-kit.orgassets/finalizersupdatecluster
metal.platform-kit.orgmanagementendpointsgetlistwatchcreateupdatecluster
events.k8s.ioeventscreatepatchcluster

The rule on assets/finalizers is necessary because the endpoint has a blocking owner reference to the Asset.