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