Caution
This feature is available starting from the Container Cloud release 2.2.0.
This section contains an exemplary L2 template for automatic multiple
subnet creation as described in Automate multiple subnet creation using SubnetPool. This template
also contains the L3Layout
section that allows defining the Subnet
scopes and enables optional auto-creation of the Subnet
objects
from the SubnetPool
objects.
For details on how to create L2 templates, see Create L2 templates.
Example of an L2 template for multiple subnets:
apiVersion: ipam.mirantis.com/v1alpha1
kind: L2Template
metadata:
name: test-managed
namespace: managed-ns
spec:
clusterRef: child-cluster
autoIfMappingPrio:
- provision
- eno
- ens
- enp
l3Layout:
- subnetName: pxe-subnet
scope: global
- subnetName: subnet-1
subnetPool: kaas-mgmt
scope: namespace
- subnetName: subnet-2
subnetPool: kaas-mgmt
scope: cluster
npTemplate: |
version: 2
ethernets:
onboard1gbe0:
dhcp4: false
dhcp6: false
match:
macaddress: {{mac 0}}
set-name: {{nic 0}}
addresses:
- {{ip "0:pxe-subnet"}}
nameservers:
addresses: {{nameservers_from_subnet "pxe-subnet"}}
gateway4: {{gateway_from_subnet "pxe-subnet"}}
onboard1gbe1:
dhcp4: false
dhcp6: false
match:
macaddress: {{mac 1}}
set-name: {{nic 1}}
ten10gbe0s0:
dhcp4: false
dhcp6: false
match:
macaddress: {{mac 2}}
set-name: {{nic 2}}
addresses:
- {{ip "2:subnet-1"}}
ten10gbe0s1:
dhcp4: false
dhcp6: false
match:
macaddress: {{mac 3}}
set-name: {{nic 3}}
addresses:
- {{ip "3:subnet-2"}}
In the template above, the following networks are defined
in the l3Layout
section:
pxe-subnet
- global PXE network that already exists. A subnet name
must refer to the PXE subnet created for the region.
subnet-1
- unless already created, this subnet will be created
from the kaas-mgmt
subnet pool. The subnet name must be unique within
the project. This subnet is shared between the project clusters.
subnet-2
- will be created from the kaas-mgmt
subnet pool.
This subnet has the cluster
scope. Therefore, the real name of the
Subnet
CR object consists of the subnet name defined in l3Layout
and the cluster UID.
But the npTemplate
section of the L2 template must contain only
the subnet name defined in l3Layout
.
The subnets of the cluster
scope are not shared between clusters.
Caution
Using the l3Layout
section, define all subnets of a cluster.
Otherwise, do not use the l3Layout
section.
Defining only part of subnets is not allowed.