ServerMaintenance 
ServerMaintenance represents a maintenance operation for a physical server. It transitions a Server from its current operational state (e.g., Available/Reserved) into a Maintenance state. Each ServerMaintenance object tracks the lifecycle of a maintenance task, ensuring servers are properly taken offline, updated, and restored.
Key Points 
ServerMaintenanceis namespaced and may represent various maintenance operations.- Only one 
ServerMaintenancecan be active perServerat a time. Others remain pending. - When the active 
ServerMaintenancecompletes, the next pending one (if any) starts. - If no more maintenance tasks are pending, the 
Serverreturns to its previous operational state. policydetermines how maintenance starts:- OwnerApproval: Requires a label (e.g., 
ok-to-maintenance: "true") on theServerClaim. - Enforced: Does not require owner approval.
 
- OwnerApproval: Requires a label (e.g., 
 
Workflow 
- A separate operator (e.g., 
foo-maintenance-operator) or user creates aServerMaintenanceresource referencing a specificServer. - If a 
Serveris claimed, a labelmetal.ironcore.dev/maintanence-needed: "true"is added to theServerClaim. - If 
policyisOwnerApprovaland nook-to-maintenancelabel is set on theServerClaim, theServerMaintenancestays inPending. TheServeralso remains unchanged. - If 
policyisOwnerApprovaland theok-to-maintenancelabel is present (or ifalwaysPerformMaintenanceis enabled), or if the policy isEnforced, themetal-operatortransitions theServerintoMaintenanceand updates theServerMaintenancestate accordingly. - The 
ServerMaintenanceReconcilercreates aServerBootConfigurationout of theServerMaintenance'sServerBootConfigurationTemplateand applies it to theServer. The power state of theServercan set by providing theServerPowerfield in theServerMaintenanceobject. Once the maintenance task is complete, the maintenance operator sets theServerMaintenancestate toCompleted. - (optional) In case no 
ServerBootConfigurationTemplateis provided, the maintenance operator powers off theServer, applies aServerBootConfiguration(if needed), performs the maintenance, and setsServerMaintenancetoCompleted. - The 
metal-operatortransitions theServerback to its prior state. If additionalServerMaintenanceobjects are pending, the next one is processed. 
Example 
yaml
apiVersion: metal.ironcore.dev/v1alpha1
kind: ServerMaintenance
metadata:
  name: bios-update
  namespace: ops
  annotations:
    metal.ironcore.dev/reason: "BIOS update"
spec:
  policy: OwnerApproval
  serverRef:
    name: server-foo
  serverPower: On # or Off
  serverBootConfigurationTemplate:
    name: bios-update-config
    spec:
      image: "bios-update-image"
      serverRef:
        name: server-foo
      ignitionSecretRef:
        name: bios-update-ignitionIf policy: OwnerApproval and no ok-to-maintenance label exists on the ServerClaim, this ServerMaintenance remains Pending, and the Server stays as is. Once the label is added (or if the operator setting alwaysPerformMaintenance is enabled), the metal-operator transitions the Server to Maintenance, and the maintenance operator performs the maintenance task.