This section describes the IpamHost
resource used in Mirantis
Container Cloud API. The kaas-ipam
controller monitors
the current state of the bare metal Machine
, verifies if BareMetalHost
is successfully created and inspection is completed.
Then the kaas-ipam
controller fetches the information about the network
card, creates the IpamHost
object, and requests the IP address.
The IpamHost
object is created for each Machine
and contains
all configuration of the host network interfaces and IP address.
It also contains the information about associated BareMetalHost
,
Machine
, and MAC addresses.
For demonstration purposes, the Container Cloud IpamHost
custom resource (CR) is split into the following major sections:
The Container Cloud IpamHost
CR contains the following fields:
apiVersion
API version of the object that is ipam.mirantis.com/v1alpha1
kind
Object type that is IpamHost
metadata
The metadata
field contains the following subfields:
name
Name of the IpamHost
object
namespace
Project in which the IpamHost
object has been created
labels
Key-value pairs that are attached to the object:
cluster.sigs.k8s.io/cluster-name
References the Cluster
object name that IpamHost
is
assigned to
ipam/BMHostID
Unique ID of the associated BareMetalHost
object
ipam/MAC-XX-XX-XX-XX-XX-XX: "1"
Number of NICs of the host that the corresponding MAC address is assigned to
ipam/MachineID
Unique ID of the associated Machine
object
ipam/UID
Unique ID of the IpamHost
object
Configuration example:
apiVersion: ipam.mirantis.com/v1alpha1
kind: IpamHost
metadata:
name: master-0
namespace: default
labels:
cluster.sigs.k8s.io/cluster-name: kaas-mgmt
ipam/BMHostID: 57250885-f803-11ea-88c8-0242c0a85b02
ipam/MAC-0C-C4-7A-1E-A9-5C: "1"
ipam/MAC-0C-C4-7A-1E-A9-5D: "1"
ipam/MachineID: 573386ab-f803-11ea-88c8-0242c0a85b02
ipam/UID: 834a2fc0-f804-11ea-88c8-0242c0a85b02
The spec
field of the IpamHost
resource describes the desired
state of the object. It contains the following fields:
nicMACmap
Represents an unordered list of all NICs of the host.
Each NIC entry contains such fields as name
, mac
, ip
,
and so on. The primary
field defines that the current NIC is primary.
Only one NIC can be primary.
l2TemplateSelector
If specified, contains the name
(first priority) or label
of the L2 template that will be applied during a machine creation.
The l2TemplateSelector
field is copied from the Machine
providerSpec
object to the IpamHost
object only once,
during a machine creation. To modify l2TemplateSelector
after creation
of a Machine
CR, edit the IpamHost
object.
Configuration example:
spec:
nicMACmap:
- mac: 0c:c4:7a:1e:a9:5c
name: ens11f0
- ip: 172.16.48.157
mac: 0c:c4:7a:1e:a9:5d
name: ens11f1
primary: true
l2TemplateSelector:
label:xxx
The status
field of the IpamHost
resource describes the observed
state of the object. It contains the following fields:
ipAllocationResult
Status of IP allocation for the primary NIC (PXE boot). Possible values
are OK
or ERR
if no IP address was allocated.
l2RenderResult
Result of the L2 template rendering, if applicable. Possible values are
OK
or an error message.
lastUpdated
Date and time of the last IpamHost
status update.
nicMACmap
Unordered list of all NICs of host with a detailed description. Each
nicMACmap
entry contains additional fields such as ipRef
,
nameservers
, online
, and so on.
osMetadataNetwork
Configuration of the host OS metadata network. This configuration is used
in the cloud-init
tool and is applicable to the primary NIC only.
It is added when the IP address is allocated and
the ipAllocationResult
status is OK
.
versionIpam
IPAM version used during the last update of the object.
Configuration example:
status:
ipAllocationResult: OK
l2RenderResult: There are no available L2Templates
lastUpdated: "2020-09-16T11:02:39Z"
nicMACmap:
- mac: 0C:C4:7A:1E:A9:5C
name: ens11f0
- gateway: 172.16.48.1
ip: 172.16.48.200/24
ipRef: default/auto-0c-c4-7a-a8-d3-44
mac: 0C:C4:7A:1E:A9:5D
name: ens11f1
nameservers:
- 172.18.176.6
online: true
primary: true
osMetadataNetwork:
links:
- ethernet_mac_address: 0C:C4:7A:A8:D3:44
id: enp8s0f0
type: phy
networks:
- ip_address: 172.16.48.200
link: enp8s0f0
netmask: 255.255.255.0
routes:
- gateway: 172.16.48.1
netmask: 0.0.0.0
network: 0.0.0.0
type: ipv4
services:
- address: 172.18.176.6
type: dns
versionIpam: v3.0.999-20200807-130909-44151f8