This section describes the Subnet
resource used in Mirantis
Container Cloud API to allocate IP addresses for the cluster nodes.
For demonstration purposes, the Container Cloud Subnet
custom resource (CR) can be split into the following major sections:
The Container Cloud Subnet
CR contains the following fields:
apiVersion
API version of the object that is ipam.mirantis.com/v1alpha1
.
kind
Object type that is Subnet
metadata
This field contains the following subfields:
name
Name of the Subnet
object.
namespace
Project in which the Subnet
object was created.
labels
Key-value pairs that are attached to the object:
ipam/DefaultSubnet: "1"
Indicates that the subnet was automatically created for the PXE network. The subnet with this label is unique for a specific region and global for all clusters and projects in the region.
ipam/UID
Unique ID of a subnet.
kaas.mirantis.com/provider
Provider type.
kaas.mirantis.com/region
Region type.
Configuration example:
apiVersion: ipam.mirantis.com/v1alpha1
kind: Subnet
metadata:
name: kaas-mgmt
namespace: default
labels:
ipam/DefaultSubnet: "1"
ipam/UID: 1bae269c-c507-4404-b534-2c135edaebf5
kaas.mirantis.com/provider: baremetal
kaas.mirantis.com/region: region-one
The spec
field of the Subnet
resource describes the desired state of
a subnet. It contains the following fields:
cidr
A valid IPv4 CIDR, for example, 10.11.0.0/24
.
gateway
A valid gateway address, for example, 10.11.0.9
.
includeRanges
A list of IP address ranges within the given CIDR that should be used in
the allocation of IPs for nodes. The gateway, network, broadcast, and DNS
addresses will be excluded (protected) automatically if they intersect with
one of the range. The IPs outside the given ranges will not be used in
the allocation. Each element of the list can be either an interval
10.11.0.5-10.11.0.70
or a single address 10.11.0.77
. The
includeRanges
parameter is mutually exclusive with excludeRanges
.
excludeRanges
A list of IP address ranges within the given CIDR that should not be
used in the allocation of IPs for nodes. The IPs within the given CIDR
but outside the given ranges will be used in the allocation.
The gateway, network, broadcast, and DNS addresses will be excluded
(protected) automatically if they are included in the CIDR.
Each element of the list can be either an interval 10.11.0.5-10.11.0.70
or a single address 10.11.0.77
. The excludeRanges
parameter
is mutually exclusive with includeRanges
.
useWholeCidr
If set to false
(by default), the subnet address and broadcast
address will be excluded from the address allocation.
If set to true
, the subnet address and the broadcast address
are included into the address allocation for nodes.
nameservers
The list of IP addresses of name servers. Each element of the list
is a single address, for example, 172.18.176.6
.
Configuration example:
spec:
cidr: 172.16.48.0/24
excludeRanges:
- 172.16.48.99
- 172.16.48.101-172.16.48.145
gateway: 172.16.48.1
nameservers:
- 172.18.176.6
The status
field of the Subnet
resource describes the actual state of
a subnet. It contains the following fields:
allocatable
The number of IP addresses that are available for allocation.
allocatedIPs
The list of allocated IP addresses in the IP:<IPAddr object UID>
format.
capacity
The total number of IP addresses to be allocated, including the sum of allocatable and already allocated IP addresses.
cidr
The IPv4 CIDR for a subnet.
gateway
The gateway address for a subnet.
nameservers
The list of IP addresses of name servers.
ranges
The list of IP address ranges within the given CIDR that are used in the allocation of IPs for nodes.
Configuration example:
status:
allocatable: 51
allocatedIPs:
- 172.16.48.200:24e94698-f726-11ea-a717-0242c0a85b02
- 172.16.48.201:2bb62373-f726-11ea-a717-0242c0a85b02
- 172.16.48.202:37806659-f726-11ea-a717-0242c0a85b02
capacity: 54
cidr: 172.16.48.0/24
gateway: 172.16.48.1
lastUpdate: "2020-09-15T12:27:58Z"
nameservers:
- 172.18.176.6
ranges:
- 172.16.48.200-172.16.48.253
statusMessage: OK