net

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcNodeCidrSize

func CalcNodeCidrSize(podSubnet string) string

CalcNodeCidrSize determines the size of the subnets used on each node, based on the pod subnet provided. For IPv4, we assume that the pod subnet will be /16 and use /24. If the pod subnet cannot be parsed, the IPv4 value will be used (/24).

For IPv6, the algorithm will do two three. First, the node CIDR will be set to a multiple of 8, using the available bits for easier readability by user. Second, the number of nodes will be 512 to 64K to attempt to maximize the number of nodes (see NOTE below). Third, pod networks of /113 and larger will be rejected, as the amount of bits available is too small.

A special case is when the pod network size is /112, where /120 will be used, only allowing 256 nodes and 256 pods.

If the pod network size is /113 or larger, the node CIDR will be set to the same size and this will be rejected later in validation.

NOTE: Currently, the design allows a maximum of 64K nodes. This algorithm splits the available bits to maximize the number used for nodes, but still have the node CIDR be a multiple of eight.

Copied from github.com/kubernetes/kubernetes/cmd/kubeadm/app/phases/controlplane/manifests.go

func DetectHostIPv4

func DetectHostIPv4() (string, error)

DetectHostIPv4 attempts to determine the host IPv4 address by finding the first non-loopback device with an assigned IPv4 address.

func GetDNSIP

func GetDNSIP(svcSubnet string) (net.IP, error)

GetDNSIP returns a dnsIP, which is 10th IP in svcSubnet CIDR range

Copied from github.com/kubernetes/kubernetes/cmd/kubeadm/app/constants/constants.go

func SplitHostPort

func SplitHostPort(s string) (string, int32, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL