github.com/elfadel/cilium@v1.6.12/pkg/defaults/node.go (about) 1 // Copyright 2016-2017 Authors of Cilium 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package defaults 16 17 import ( 18 "net" 19 ) 20 21 const ( 22 // IPv6NodeAllocPrefixLen is the length of the prefix used for allocation per node 23 IPv6NodeAllocPrefixLen = 112 24 25 // IPv6NodePrefixLen is the length used to allocate container IPv6 addresses from. 26 IPv6NodePrefixLen = 96 27 28 // DefaultIPv4Prefix is the prefix for all the IPv4 addresses. 29 // %d is substituted with the last byte of first global IPv4 address 30 // configured on the system. 31 DefaultIPv4Prefix = "10.%d.0.1" 32 33 // DefaultIPv4PrefixLen is the length used to allocate container IPv4 addresses from. 34 DefaultIPv4PrefixLen = 16 35 36 // DefaultIPv4ClusterPrefixLen is the IPv4 prefix length of the entire cluster. 37 DefaultIPv4ClusterPrefixLen = 8 38 39 // DefaultNAT46Prefix is the IPv6 prefix to represent NATed IPv4 addresses. 40 DefaultNAT46Prefix = "0:0:0:0:0:FFFF::/96" 41 42 // HostDevice is the name of the device that connects the cilium IP 43 // space with the host's networking model 44 HostDevice = "cilium_host" 45 ) 46 47 var ( 48 // Default addressing schema 49 // 50 // cluster: beef:beef:beef:beef::/64 51 // node: beef:beef:beef:beef:<node>:<node>:/96 52 // state: beef:beef:beef:beef:<node>:<node>:<state>:/112 53 // lxc: beef:beef:beef:beef:<node>:<node>:<state>:<lxc>/128 54 55 // ClusterIPv6Mask represents the CIDR Mask for an entire cluster. 56 ClusterIPv6Mask = net.CIDRMask(64, 128) 57 58 // NodeIPv6Mask represents the CIDR Mask for the cilium node. 59 NodeIPv6Mask = net.CIDRMask(96, 128) 60 61 // StateIPv6Mask represents the CIDR Mask for the state position. 62 StateIPv6Mask = net.CIDRMask(112, 128) 63 64 // ContainerIPv6Mask is the IPv6 prefix length for address assigned to 65 // container. The default is L3 only and thus /128. 66 ContainerIPv6Mask = net.CIDRMask(128, 128) 67 68 // ContainerIPv4Mask is the IPv4 prefix length for address assigned to 69 // container. The default is L3 only and thus /32. 70 ContainerIPv4Mask = net.CIDRMask(32, 32) 71 72 // IPv6DefaultRoute is the default IPv6 route. 73 IPv6DefaultRoute = net.IPNet{IP: net.IPv6zero, Mask: net.CIDRMask(0, 128)} 74 75 // IPv4DefaultRoute is the default IPv4 route. 76 IPv4DefaultRoute = net.IPNet{IP: net.IPv4zero, Mask: net.CIDRMask(0, 32)} 77 )