Documentation ¶
Overview ¶
Package util contains utility functions which are used in the agent implementation.
Index ¶
- Constants
- func ConfigureLinkAddresses(idx int, ipNets []*net.IPNet) error
- func DialLocalSocket(address string) (net.Conn, error)
- func GenerateContainerInterfaceKey(containerID string) string
- func GenerateContainerInterfaceName(podName, podNamespace, containerID string) string
- func GenerateNodeTunnelInterfaceKey(nodeName string) string
- func GenerateNodeTunnelInterfaceName(nodeName string) string
- func GetIPNetDeviceFromIP(localIP net.IP) (*net.IPNet, *net.Interface, error)
- func GetIPWithFamily(ips []net.IP, addrFamily uint8) (net.IP, error)
- func GetIPv4Addr(ips []net.IP) net.IP
- func GetNSDevInterface(nsPath, dev string) (*net.Interface, error)
- func GetNSPath(netnsName string) (string, error)
- func GetNSPeerDevBridge(nsPath, dev string) (*net.Interface, string, error)
- func GetNetLink(dev string) netlink.Link
- func ListenLocalSocket(address string) (net.Listener, error)
- func SetLinkUp(name string) (net.HardwareAddr, int, error)
- type LinkNotFound
Constants ¶
const ( FamilyIPv4 uint8 = 4 FamilyIPv6 uint8 = 6 )
Variables ¶
This section is empty.
Functions ¶
func ConfigureLinkAddresses ¶ added in v0.11.3
ConfigureLinkAddresses adds the provided addresses to the interface identified by index idx, if they are missing from the interface. Any other existing address already configured for the interface will be removed, unless it is a link-local address.
func DialLocalSocket ¶ added in v0.7.0
DialLocalSocket connects to a Unix domain socket.
func GenerateContainerInterfaceKey ¶ added in v0.3.0
GenerateContainerInterfaceKey generates a unique string for a Pod's interface as: container/<Container-ID>. We must use ContainerID instead of PodNamespace + PodName because there could be more than one container associated with the same Pod at some point. For example, when deleting a StatefulSet Pod with 0 second grace period, the Pod will be removed from the Kubernetes API very quickly and a new Pod will be created immediately, and kubelet may process the deletion of the previous Pod and the addition of the new Pod simultaneously.
func GenerateContainerInterfaceName ¶
GenerateContainerInterfaceName generates a unique interface name using the Pod's namespace, name and containerID. The output should be deterministic (so that multiple calls to GenerateContainerInterfaceName with the same parameters return the same value). The output has the length of interfaceNameLength(15). The probability of collision should be neglectable.
func GenerateNodeTunnelInterfaceKey ¶ added in v0.3.0
GenerateNodeTunnelInterfaceKey generates a unique string for a Node's tunnel interface as: node/<Node-name>.
func GenerateNodeTunnelInterfaceName ¶ added in v0.3.0
GenerateNodeTunnelInterfaceName generates a unique interface name for the tunnel to the Node, using the Node's name.
func GetIPNetDeviceFromIP ¶ added in v0.4.0
GetIPNetDeviceFromIP returns a local IP/mask and associated device from IP.
func GetIPWithFamily ¶ added in v0.11.0
func GetNSDevInterface ¶ added in v0.5.0
GetNSDevInterface returns interface of dev in namespace nsPath.
func GetNSPeerDevBridge ¶ added in v0.5.0
GetPeerLinkBridge returns peer device and its attached bridge (if applicable) for device dev in network space indicated by nsPath
func GetNetLink ¶ added in v0.4.0
GetNetLink returns dev link from name.
func ListenLocalSocket ¶ added in v0.7.0
ListenLocalSocket creates a listener on a Unix domain socket.
Types ¶
type LinkNotFound ¶ added in v0.7.0
type LinkNotFound struct {
// contains filtered or unexported fields
}
Directories ¶
Path | Synopsis |
---|---|
Package ethtool provides Go wrappers for ioctl ethtool system calls on Linux
|
Package ethtool provides Go wrappers for ioctl ethtool system calls on Linux |
Package systcl contains utility functions to read and write sysctl configuration on Linux.
|
Package systcl contains utility functions to read and write sysctl configuration on Linux. |
Package winfirewall contains utility functions to configure the Windows firewall.
|
Package winfirewall contains utility functions to configure the Windows firewall. |