Documentation
¶
Index ¶
- func CheckConnectionToHost(ctx context.Context, targetURL url.URL, opts ...ConnectionOption) error
- func ContainsIP(cidr string, ip net.IP) (bool, error)
- func ExtractCIDRsFromNodeNetworks(networks []types.RemoteNodeNetwork) []string
- func ExtractFlagValue(args []string, flag string) string
- func ExtractNodeIPFromFlags(kubeletArgs []string) (net.IP, error)
- func FindNetworkInterfaceForIP(nodeIP net.IP) (*net.Interface, error)
- func GetNodeIP(kubeletArgs []string, nodeName string, network Network) (net.IP, error)
- func IsIPInCIDRs(ip net.IP, cidrs []string) (bool, error)
- func IsProxyEnabled() bool
- func ValidateClusterRemoteNetworkConfig(cluster *types.Cluster) error
- func ValidateIPInRemoteNodeNetwork(ipAddr net.IP, remoteNodeNetwork []types.RemoteNodeNetwork) error
- func ValidateMTU(mtu int) error
- func ValidateNetworkInterfaceMTUForIP(nodeIP net.IP) error
- func ValidateNodeIP(nodeIP net.IP, network Network) error
- func WithCluster(cluster *types.Cluster) func(*NetworkInterfaceValidator)
- func WithMTUValidation(validate bool) func(*NetworkInterfaceValidator)
- func WithNetwork(network Network) func(*NetworkInterfaceValidator)
- type ConnectionOption
- type ConnectionOptions
- type DefaultKubeletNetwork
- type Network
- type NetworkInterfaceValidator
- type ProxyValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckConnectionToHost ¶
CheckConnectionToHost checks if a connection can be established to the host specified in the URL.
func ContainsIP ¶ added in v1.0.10
ContainsIP checks if the given IP is within the specified CIDR block
func ExtractCIDRsFromNodeNetworks ¶ added in v1.0.10
func ExtractCIDRsFromNodeNetworks(networks []types.RemoteNodeNetwork) []string
ExtractCIDRsFromNodeNetworks extracts CIDR blocks from remote node networks
func ExtractFlagValue ¶ added in v1.0.10
ExtractFlagValue extracts the value of a specific flag from kubelet arguments
func ExtractNodeIPFromFlags ¶ added in v1.0.10
ExtractNodeIPFromFlags extracts the node IP from kubelet flags
func FindNetworkInterfaceForIP ¶ added in v1.0.10
FindNetworkInterfaceForIP finds the network interface that has the given IP address
func GetNodeIP ¶ added in v1.0.10
GetNodeIP determines the node's IP address based on kubelet configuration and system information.
func IsIPInCIDRs ¶ added in v1.0.10
IsIPInCIDRs checks if the given IP is within any of the specified CIDR blocks
func IsProxyEnabled ¶ added in v1.0.10
func IsProxyEnabled() bool
func ValidateClusterRemoteNetworkConfig ¶ added in v1.0.10
ValidateClusterRemoteNetworkConfig validates that the cluster has proper remote network configuration
func ValidateIPInRemoteNodeNetwork ¶ added in v1.0.10
func ValidateIPInRemoteNodeNetwork(ipAddr net.IP, remoteNodeNetwork []types.RemoteNodeNetwork) error
ValidateIPInRemoteNodeNetwork validates that the given IP is within the remote node networks
func ValidateMTU ¶ added in v1.0.10
ValidateMTU validates that the MTU value is within acceptable ranges MTU should be <= 1500 (standard Ethernet) or between 8000-9001 (jumbo frames)
func ValidateNetworkInterfaceMTUForIP ¶ added in v1.0.10
ValidateNetworkInterfaceMTUForIP validates MTU for the network interface associated with the given IP
func ValidateNodeIP ¶ added in v1.0.10
ValidateNodeIP validates that the given node IP belongs to the current host.
ValidateNodeIP adapts the unexported 'validateNodeIP' function from kubelet. Source: https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet_node_status.go#L796
func WithCluster ¶ added in v1.0.10
func WithCluster(cluster *types.Cluster) func(*NetworkInterfaceValidator)
func WithMTUValidation ¶ added in v1.0.10
func WithMTUValidation(validate bool) func(*NetworkInterfaceValidator)
func WithNetwork ¶ added in v1.0.10
func WithNetwork(network Network) func(*NetworkInterfaceValidator)
Types ¶
type ConnectionOption ¶ added in v1.0.7
type ConnectionOption func(*ConnectionOptions)
func WithProxyFunc ¶ added in v1.0.7
this is overridable mainly for testing purposes to avoid using environment variables to manipulate the proxy environment and because the default ProxyFunc always skips the proxy for localhost/loopback addresses, it does not require that they be listed in the NO_PROXY environment variable. This makes testing difficult since we would need to manipulate the dns resolution on the test machine (ex: modify /etc/hosts).
type ConnectionOptions ¶ added in v1.0.7
type DefaultKubeletNetwork ¶ added in v1.0.10
type DefaultKubeletNetwork struct{}
DefaultKubeletNetwork provides the network util functions used by kubelet.
func (DefaultKubeletNetwork) InterfaceAddrs ¶ added in v1.0.10
func (u DefaultKubeletNetwork) InterfaceAddrs() ([]net.Addr, error)
func (DefaultKubeletNetwork) LookupIP ¶ added in v1.0.10
func (u DefaultKubeletNetwork) LookupIP(host string) ([]net.IP, error)
func (DefaultKubeletNetwork) ResolveBindAddress ¶ added in v1.0.10
type Network ¶ added in v1.0.10
type Network interface {
LookupIP(host string) ([]net.IP, error)
ResolveBindAddress(bindAddress net.IP) (net.IP, error)
InterfaceAddrs() ([]net.Addr, error)
}
Network interfaces with the host's network stack.
func NewDefaultNetwork ¶ added in v1.0.10
func NewDefaultNetwork() Network
NewDefaultNetwork creates a new instance of DefaultKubeletNetwork
type NetworkInterfaceValidator ¶ added in v1.0.10
type NetworkInterfaceValidator struct {
// contains filtered or unexported fields
}
func NewNetworkInterfaceValidator ¶ added in v1.0.10
func NewNetworkInterfaceValidator(opts ...func(*NetworkInterfaceValidator)) NetworkInterfaceValidator
func (NetworkInterfaceValidator) Run ¶ added in v1.0.10
func (v NetworkInterfaceValidator) Run(ctx context.Context, informer validation.Informer, node *api.NodeConfig) error
type ProxyValidator ¶ added in v1.0.10
type ProxyValidator struct{}
ProxyValidator validates proxy configuration
func NewProxyValidator ¶ added in v1.0.10
func NewProxyValidator() ProxyValidator
NewProxyValidator creates a new ProxyValidator
func (ProxyValidator) Run ¶ added in v1.0.10
func (v ProxyValidator) Run(ctx context.Context, informer validation.Informer, node *api.NodeConfig) error
Run validates proxy configuration
func (ProxyValidator) Validate ¶ added in v1.0.10
func (v ProxyValidator) Validate(node *api.NodeConfig) error