Documentation ¶
Index ¶
- Constants
- Variables
- func CanUseWinKernelProxier(kcompat KernelCompatTester) (bool, error)
- func ConjureMac(macPrefix string, ip net.IP) string
- func CountBytesLines(b []byte) int
- func Enum(p v1.Protocol) uint16
- func ExternalPolicyLocal(service *localv1.Service) bool
- func GetClusterIPByFamily(ipFamily v1.IPFamily, service *localv1.Service) string
- func GetLocalAddrSet() netutils.IPSet
- func GetLocalAddrs() ([]net.IP, error)
- func GetNodeAddresses(cidrs []string, nw NetworkInterfacer) (sets.String, error)
- func IPPart(s string) string
- func InternalPolicyLocal(service *localv1.Service) bool
- func IsZeroCIDR(cidr string) bool
- func LogAndEmitIncorrectIPVersionEvent(recorder events.EventRecorder, ...)
- func MapCIDRsByIPFamily(cidrStrings []string) map[v1.IPFamily][]string
- func MapIPsByIPFamily(ips *localv1.IPSet) map[v1.IPFamily][]string
- func OtherIPFamily(ipFamily v1.IPFamily) v1.IPFamily
- func PortPart(s string) (int, error)
- func RevertPorts(...)
- func WriteBytesLine(buf *bytes.Buffer, bytes []byte)
- func WriteLine(buf *bytes.Buffer, words ...string)
- func WriteRuleLine(buf *bytes.Buffer, chainName string, words ...string)
- type ExternalIPInfo
- type KernelCompatTester
- type LoadBalancerIngressInfo
- type NetworkInterfacer
- type RealNetwork
- type WindowsKernelCompatTester
Constants ¶
const ( // IPv4ZeroCIDR is the CIDR block for the whole IPv4 address space IPv4ZeroCIDR = "0.0.0.0/0" // IPv6ZeroCIDR is the CIDR block for the whole IPv6 address space IPv6ZeroCIDR = "::/0" )
Variables ¶
var ( // ErrAddressNotAllowed indicates the address is not allowed ErrAddressNotAllowed = errors.New("address not allowed") // ErrNoAddresses indicates there are no addresses for the hostname ErrNoAddresses = errors.New("No addresses for hostname") )
Functions ¶
func CanUseWinKernelProxier ¶
func CanUseWinKernelProxier(kcompat KernelCompatTester) (bool, error)
CanUseWinKernelProxier returns true if we should use the Kernel Proxier instead of the "classic" userspace Proxier. This is determined by checking the windows kernel version and for the existence of kernel features.
func ConjureMac ¶
Uses mac prefix and IPv4 address to return a mac address This ensures mac addresses are unique for proper load balancing There is a possibility of MAC collisions but this Mac address is used for remote windowsEndpoint only and not sent on the wire.
func CountBytesLines ¶
CountBytesLines counts the number of lines in a bytes slice
func ExternalPolicyLocal ¶
ExternalPolicyLocal checks if service has ETP = Local.
func GetClusterIPByFamily ¶
GetClusterIPByFamily returns a service clusterip by family
func GetLocalAddrSet ¶
GetLocalAddrSet return a local IPSet. If failed to get local addr, will assume no local ips.
func GetLocalAddrs ¶
GetLocalAddrs returns a list of all network addresses on the local system
func GetNodeAddresses ¶
func GetNodeAddresses(cidrs []string, nw NetworkInterfacer) (sets.String, error)
GetNodeAddresses return all matched node IP addresses based on given cidr slice. Some callers, e.g. IPVS proxier, need concrete IPs, not ranges, which is why this exists. NetworkInterfacer is injected for test purpose. We expect the cidrs passed in is already validated. Given an empty input `[]`, it will return `0.0.0.0/0` and `::/0` directly. If multiple cidrs is given, it will return the minimal IP sets, e.g. given input `[1.2.0.0/16, 0.0.0.0/0]`, it will only return `0.0.0.0/0`. NOTE: GetNodeAddresses only accepts CIDRs, if you want concrete IPs, e.g. 1.2.3.4, then the input should be 1.2.3.4/32.
func IPPart ¶
IPPart returns just the IP part of an IP or IP:port or endpoint string. If the IP part is an IPv6 address enclosed in brackets (e.g. "[fd00:1::5]:9999"), then the brackets are stripped as well.
func InternalPolicyLocal ¶
InternalPolicyLocal checks if service has ITP = Local.
func IsZeroCIDR ¶
IsZeroCIDR checks whether the input CIDR string is either the IPv4 or IPv6 zero CIDR
func LogAndEmitIncorrectIPVersionEvent ¶
func LogAndEmitIncorrectIPVersionEvent(recorder events.EventRecorder, fieldName, fieldValue, svcNamespace, svcName string, svcUID types.UID)
LogAndEmitIncorrectIPVersionEvent logs and emits incorrect IP version event.
func MapCIDRsByIPFamily ¶
MapCIDRsByIPFamily maps a slice of IPs to their respective IP families (v4 or v6)
func MapIPsByIPFamily ¶
MapIPsByIPFamily maps a slice of IPs to their respective IP families (v4 or v6)
func OtherIPFamily ¶
OtherIPFamily returns the other ip family
func RevertPorts ¶
RevertPorts is closing ports in replacementPortsMap but not in originalPortsMap. In other words, it only closes the ports opened in this sync.
func WriteBytesLine ¶
WriteBytesLine write bytes to buffer, terminate with newline
Types ¶
type ExternalIPInfo ¶
type KernelCompatTester ¶
type KernelCompatTester interface {
IsCompatible() error
}
KernelCompatTester tests whether the required kernel capabilities are present to run the windows kernel proxier.
type LoadBalancerIngressInfo ¶
type NetworkInterfacer ¶
NetworkInterfacer defines an interface for several net library functions. Production code will forward to net library functions, and unit tests will override the methods for testing purposes.
type RealNetwork ¶
type RealNetwork struct{}
RealNetwork implements the NetworkInterfacer interface for production code, just wrapping the underlying net library function calls.
func (RealNetwork) InterfaceAddrs ¶
func (RealNetwork) InterfaceAddrs() ([]net.Addr, error)
InterfaceAddrs wraps net.InterfaceAddrs(), it's a part of NetworkInterfacer interface.
type WindowsKernelCompatTester ¶
type WindowsKernelCompatTester struct{}
func (WindowsKernelCompatTester) IsCompatible ¶
func (lkct WindowsKernelCompatTester) IsCompatible() error
IsCompatible returns true if winkernel can support this mode of proxy