network

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsurePodMasquerade added in v1.1.4

func EnsurePodMasquerade(podCIDR string) error

EnsurePodMasquerade programs a SNAT/masquerade rule for pod egress traffic so pods can reach external IPs. It is idempotent and mode-aware: iptables on systems that have the ip_tables kernel module, nftables otherwise.

This must be called before kubelet starts (so no pod ever starts without SNAT in place) and after flushNftablesNat (to restore the rule after the nat table is flushed for kube-proxy compatibility).

func GetHostResolvConf added in v1.1.1

func GetHostResolvConf(dataDir string) string

GetHostResolvConf returns the path to a resolv.conf file that contains real upstream nameservers suitable for use by pods. It checks common resolv.conf locations and validates that they contain usable nameservers (global unicast). If no valid resolv.conf is found, it generates a fallback with public DNS servers. This follows the same approach as k3s locateOrGenerateResolvConf.

func GetLocalIPs

func GetLocalIPs() ([]net.IP, error)

GetLocalIPs returns all non-loopback IPv4 addresses

func GetNodeIP

func GetNodeIP() (string, error)

GetNodeIP returns the first non-loopback IP address of the node

func IsComponentHealthy

func IsComponentHealthy(client *http.Client, request *http.Request, component string) error

IsComponentHealthy checks if a component is healthy by sending a health check request and waiting for a response.

func IsDNSName

func IsDNSName(name string) bool

IsDNSName returns true if the given string is a valid DNS name it follows the RFC 1123 specification for DNS names

func IsIPv4Address

func IsIPv4Address(ip string) bool

IsIPv4Address returns true if the given string is a valid IPv4 address

Types

This section is empty.

Jump to

Keyboard shortcuts

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