IpamHost

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:

IpamHost metadata

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

      Warning

      Labels and annotations that are not documented in this API Reference are generated automatically by Container Cloud. Do not modify them using the Container Cloud API.

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

IpamHost configuration

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 obtained during the bare metal host inspection. Each NIC entry contains such fields as name, mac, ip, and so on. The primary field defines which NIC was used for PXE booting. Only one NIC can be primary. The IP address is not configurable and is provided only for debug purposes.

  • 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

IpamHost status

The status field of the IpamHost resource describes the observed state of the object. It contains the following fields:

  • ipAllocationResult Deprecated since 2.12.0

    Status of IP allocation for the primary NIC (PXE boot). Possible values are OK, ERR (if no IP address was allocated), or a text message that should be interpreted as a warning. This field is deprecated as of Container Cloud 2.12.0 and will be removed in one of the following releases. Use l2RenderResult instead.

  • netconfigV2

    The netplan configuration file in plain text that is rendered using the corresponding L2Template. This field contains valid data if l2RenderResult retains the OK result.

  • l2RenderResult

    Result of the netplan configuration file rendering (the file is stored in netconfigV2), if applicable. Possible values are: OK for success, ERR for failure, information or warning message.

  • netconfigFiles

    List of netplan configuration files rendered using the corresponding L2Template. It is used to configure host networking during bare metal host provisioning (BaremetalHost retains a copy of this configuration) and during Kubernetes node deployment (refer to Workflow of the netplan configuration using an L2 template for details). Its contents are changed only if rendering of netplan configuration was successful. So, it always retains the last successfully rendered netplan configuration. Every item in this list contains:

    • content

      The base64-encoded netplan configuration file that was rendered using the corresponding L2Template.

    • path

      The file path for the netplan configuration file on the target host.

  • netconfigFilesState

    Status of netplan configuration files that are present in netconfigFiles. Possible values are:

    • OK - netplan configuration files in netconfigFiles are ready to use and in sync with netconfigV2.

    • OK, inconsistent - netplan configuration files in netconfigFiles are ready to use but they are not in sync with netconfigV2. This can happen when netconfigV2 cannot be rendered. Refer to l2RenderResult for more information about the failure. In this case, netconfigFiles holds the last valid data before netconfigV2 got broken.

    • ERR - failure while rendering netplan configuration files. Contains information or a warning message, for example, ERR: Primary(PXE) NIC check fail:….

  • objCreated

    Date, time, and IPAM version of the IpamHost CR creation.

  • objStatusUpdated

    Date, time, and IPAM version of the last update of the status field in the IpamHost CR.

  • objUpdated

    Date, time, and IPAM version of the last IpamHost CR update by kaas-ipam.

  • serviceMap

    Dictionary of services and their endpoints (IP address and optional interface name) that have the ipam/SVC-<serviceName> label. These addresses are added to the ServiceMap dictionary during rendering of an L2 template for a given IpamHost. For details, see Service labels and their life cycle.

  • osMetadataNetwork Deprecated since 2.12.0

    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.

    This field is absent when template-based provisioning is in use. The field is deprecated as of Container Cloud 2.12.0 and will be removed in one of the following releases. Use netconfigV2 instead.

Configuration example:

status:
  l2RenderResult: OK
  l2TemplateRef: namespace_name/l2-template-name/1/2589/88865f94-04f0-4226-886b-2640af95a8ab
  netconfigFiles:
    - content: ...<base64-encoded netconfig>...
      path: /etc/netplan/60-kaas-lcm-netplan.yaml
  netconfigFilesState: OK
  netconfigV2:
    ...
    <Netplan-config, rendered from L2Template>
    ...
  serviceMap:
    ipam/SVC-ceph-cluster:
      - ifName: ceph-br2
        ipAddress: 10.0.10.11
      - ifName: ceph-br1
        ipAddress: 10.0.12.22
    ipam/SVC-ceph-public:
      - ifName: ceph-public
        ipAddress: 10.1.1.15
    ipam/SVC-k8s-lcm:
      - ifName: k8s-lcm
        ipAddress: 10.0.1.52
  objCreated: 2021-10-21T19:09:32Z  by  v5.1.0-20210930-121522-f5b2af8
  objStatusUpdated: 2021-10-21T19:14:18.748114886Z  by  v5.1.0-20210930-121522-f5b2af8
  objUpdated: 2021-10-21T19:09:32.606968024Z  by  v5.1.0-20210930-121522-f5b2af8