networkutils

package
v1.12.6 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 23 Imported by: 25

Documentation

Overview

Package networkutils is a collection of iptables and netlink functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePodHostVethName added in v1.12.0

func GeneratePodHostVethName(prefix string, podNamespace string, podName string) string

GeneratePodHostVethName generates the name for Pod's host-side veth device. The veth name is generated in a way that aligns with the value expected by Calico for NetworkPolicy enforcement.

func GeneratePodHostVethNameSuffix added in v1.12.0

func GeneratePodHostVethNameSuffix(podNamespace string, podName string) string

GeneratePodHostVethNameSuffix generates the name suffix for Pod's hostVeth.

func GetConfigForDebug added in v1.2.0

func GetConfigForDebug() map[string]interface{}

GetConfigForDebug returns the active values of the configuration env vars (for debugging purposes).

func GetEthernetMTU added in v1.6.1

func GetEthernetMTU(envMTUValue string) int

GetEthernetMTU gets the MTU setting from AWS_VPC_ENI_MTU if set, or takes the passed in string. Defaults to 9001 if not set.

func IncrementIPv4Addr added in v1.6.4

func IncrementIPv4Addr(ip net.IP) (net.IP, error)

IncrementIPv4Addr returns incremented IPv4 address

Types

type NetworkAPIs

type NetworkAPIs interface {
	// SetupNodeNetwork performs node level network configuration
	SetupHostNetwork(vpcCIDRs []string, primaryMAC string, primaryAddr *net.IP, enablePodENI bool,
		v4Enabled bool, v6Enabled bool) error
	// SetupENINetwork performs ENI level network configuration. Not needed on the primary ENI
	SetupENINetwork(eniIP string, mac string, deviceNumber int, subnetCIDR string) error
	// UpdateHostIptablesRules updates the nat table iptables rules on the host
	UpdateHostIptablesRules(vpcCIDRs []string, primaryMAC string, primaryAddr *net.IP, v4Enabled bool, v6Enabled bool) error
	UseExternalSNAT() bool
	GetExcludeSNATCIDRs() []string
	GetExternalServiceCIDRs() []string
	GetRuleList() ([]netlink.Rule, error)
	GetRuleListBySrc(ruleList []netlink.Rule, src net.IPNet) ([]netlink.Rule, error)
	UpdateRuleListBySrc(ruleList []netlink.Rule, src net.IPNet) error
	UpdateExternalServiceIpRules(ruleList []netlink.Rule, externalIPs []string) error
	GetLinkByMac(mac string, retryInterval time.Duration) (netlink.Link, error)
}

NetworkAPIs defines the host level and the ENI level network related operations

func New

func New() NetworkAPIs

New creates a linuxNetwork object

Directories

Path Synopsis
Package mock_networkutils is a generated GoMock package.
Package mock_networkutils is a generated GoMock package.

Jump to

Keyboard shortcuts

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