Documentation
¶
Index ¶
- func DisableIPv6Sysctls() error
- func EnsurePodMasquerade(podCIDR string) error
- func GetHostResolvConf(dataDir string, containerMode bool) string
- func GetLocalIPs() ([]net.IP, error)
- func GetNodeIP() (string, error)
- func IsComponentHealthy(client *http.Client, request *http.Request, component string) error
- func IsDNSName(name string) bool
- func IsIPv4Address(ip string) bool
- func ResolveNodeIP(override string) (ip string, pinned bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableIPv6Sysctls ¶ added in v1.1.5
func DisableIPv6Sysctls() error
DisableIPv6Sysctls writes 1 to the kernel sysctl paths that disable IPv6 on all interfaces. It is idempotent — paths already set to 1 are skipped. All paths are attempted regardless of failure; errors are aggregated and returned.
func EnsurePodMasquerade ¶ added in v1.1.4
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
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.
func GetLocalIPs ¶
GetLocalIPs returns all non-loopback IPv4 addresses
func GetNodeIP ¶
GetNodeIP returns a non-loopback IPv4 address of the node, preferring a private (RFC 1918) address over a public one. On a host with several private addresses the first one encountered is returned, so the choice is not guaranteed to be stable across reboots — pin a specific address with --node-ip when that matters.
func IsComponentHealthy ¶
IsComponentHealthy checks if a component is healthy by sending a health check request and waiting for a response.
func IsDNSName ¶
IsDNSName returns true if the given string is a valid DNS name it follows the RFC 1123 specification for DNS names
func IsIPv4Address ¶
IsIPv4Address returns true if the given string is a valid IPv4 address
func ResolveNodeIP ¶ added in v1.1.8
ResolveNodeIP returns the node IP to advertise and whether it was explicitly pinned via a valid override. When override is a valid IPv4 it is used as-is and pinned is true — a value not bound to a local interface is still allowed but logged (e.g. a VIP). An empty or unparseable override falls back to auto-detection via GetNodeIP with pinned false, so a typo does not silently switch the caller into "pinned" behavior.
Types ¶
This section is empty.