The Metal3Data resource represents the rendered data instances created from
Metal3DataTemplate objects. It contains the host-specific configuration data
that has been generated for a particular bare metal host and links to the
associated secrets.
A Metal3Data object is created automatically by the CAPM3 controller when a
Metal3Machine references a Metal3DataTemplate. It contains:
- Index: A unique index assigned to the host
- Claim reference: Link to the
Metal3DataClaimthat requested this data - Secret references: Links to the generated metadata and network data secrets
- Template reference: Link to the
Metal3DataTemplatethat was used
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: Metal3Data
metadata:
name: <template-name>-<index>
namespace: <namespace>
ownerReferences:
- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
controller: true
kind: Metal3DataTemplate
name: <template-name>
spec:
templateReference: <reference-name> # Optional
index: <index>
claim:
name: <machine-name>
namespace: <namespace>
metaData:
name: <machine-name>-metadata-<index>
namespace: <namespace>
networkData:
name: <machine-name>-networkdata-<index>
namespace: <namespace>
template:
name: <template-name>
namespace: <namespace>
status:
ready: <boolean>
error: <boolean>
errorMessage: "<error-message>"- Claim Creation: When a
Metal3Machinereferences aMetal3DataTemplate, aMetal3DataClaimis created - Index Assignment: The controller selects the lowest available index for the new claim
- Data Generation: A
Metal3Dataobject is created with the assigned index - Secret Generation: The controller renders the template and creates metadata and network data secrets
- Status Update: The
readystatus is set totruewhen all secrets are created successfully
Important: If the Metal3DataTemplate object is updated, the generated
secrets will not be updated automatically. This behavior is intentional to
allow for reprovisioning of the nodes in the exact same state as they were
initially provisioned.
To apply template updates to existing nodes, it is necessary to perform a rolling upgrade of all nodes that reference the updated template.
Indexes are managed automatically by the controller:
- Starting Point: Indexes always start from 0
- Increment: Each new index increments by 1
- Availability Check: The controller selects the lowest available index not in use
- Conflict Resolution: If a conflict occurs during creation, the controller retries with a new index
The Metal3Data object name follows the pattern:
<template-name>-<index>
For example:
- Template:
worker-template - Index:
0 - Result:
worker-template-0
The controller generates two types of secrets for each Metal3Data instance:
Contains host-specific metadata in YAML format.
Naming: <machine-name>-metadata-<index>
Content: Rendered metadata based on the template configuration
Contains network configuration in JSON format following the Nova network_data.json format.
Naming: <machine-name>-networkdata-<index>
Content: Rendered network configuration based on the template
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: Metal3Data
metadata:
name: worker-template-0
namespace: default
ownerReferences:
- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
controller: true
kind: Metal3DataTemplate
name: worker-template
spec:
index: 0
claim:
name: worker-0
namespace: default
metaData:
name: worker-0-metadata-0
namespace: default
networkData:
name: worker-0-networkdata-0
namespace: default
template:
name: worker-template
namespace: default
status:
ready: true
error: false
errorMessage: ""- Create a Metal3DataTemplate with your desired configuration
- Reference the template in your Metal3MachineTemplate
- Create Metal3Machines - CAPM3 automatically creates Metal3Data instances
- Access the secrets for provisioning BareMetalHosts
If a Metal3Machine is created without a dataTemplate but with metaData or
networkData fields set, the controller will:
- Look for existing secrets with the specified names
- Set the status fields accordingly
- Start BareMetalHost provisioning when secrets are available
When a Metal3Machine references a dataTemplate:
- A
Metal3DataClaimis created automatically - The claim controller creates a
Metal3Datainstance - The
Metal3Datacontroller generates the required secrets - The
Metal3Machinecontroller uses the secrets for provisioning
You can mix template-based and manual configuration:
- Set
dataTemplatefor one type of data (e.g., network data) - Set
metaDataornetworkDatadirectly for the other type - The manual configuration overrides the template for that specific secret