Documentation
¶
Overview ¶
Package network provides network interface management functionality for the AWS Multi-ENI Controller.
Index ¶
- func IsRetryable(err error) bool
- func IsValidInterfaceForENI(ifaceName string, eniPattern string, ignoreList []string) (bool, error)
- func NormalizeInterfaceName(name string) string
- func ParseInterfaceIndex(ifaceName string) (int, error)
- func RetryWithBackoff(ctx context.Context, config RetryConfig, operation string, fn func() error) error
- func SanitizeInterfaceName(name string) string
- func ValidateDeviceIndex(index int) error
- func ValidateENIPattern(pattern string) error
- func ValidateInterfaceName(name string) error
- func ValidateInterfaceState(state string) error
- func ValidateMACAddress(mac string) error
- func ValidateMTU(mtu int) error
- func ValidateNetworkConfiguration(ifaceName string, mtu int, deviceIndex int, pciAddress string) error
- func ValidatePCIAddress(addr string) error
- type InterfaceInfo
- type Manager
- func (m *Manager) BringDownInterface(ifaceName string) error
- func (m *Manager) BringDownInterfaceWithRetry(ctx context.Context, ifaceName string) error
- func (m *Manager) BringUpInterface(ifaceName string) error
- func (m *Manager) BringUpInterfaceWithRetry(ctx context.Context, ifaceName string) error
- func (m *Manager) ConfigureInterfaceFromNodeENI(ifaceName string, nodeENI networkingv1alpha1.NodeENI) error
- func (m *Manager) ConfigureInterfaceWithRetry(ctx context.Context, ifaceName string, nodeENI interface{}) error
- func (m *Manager) GetAllInterfaces() ([]InterfaceInfo, error)
- func (m *Manager) GetInterfaceNameForDeviceIndex(deviceIndex int) (string, error)
- func (m *Manager) RetryInterfaceOperation(ctx context.Context, operation string, ifaceName string, fn func() error) error
- func (m *Manager) SetMTU(ifaceName string, mtu int) error
- func (m *Manager) SetMTUWithRetry(ctx context.Context, ifaceName string, mtu int) error
- func (m *Manager) ValidateInterfaceWithRetry(ctx context.Context, ifaceName string) error
- func (m *Manager) WaitForInterface(ifaceName string, timeout time.Duration) error
- func (m *Manager) WaitForInterfaceWithRetry(ctx context.Context, ifaceName string, timeout time.Duration) error
- type RetryConfig
- type RetryableError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidInterfaceForENI ¶
IsValidInterfaceForENI checks if an interface name is valid for ENI operations
func NormalizeInterfaceName ¶
NormalizeInterfaceName normalizes an interface name to a standard format
func ParseInterfaceIndex ¶
ParseInterfaceIndex extracts the numeric index from an interface name
func RetryWithBackoff ¶
func RetryWithBackoff(ctx context.Context, config RetryConfig, operation string, fn func() error) error
RetryWithBackoff executes a function with exponential backoff retry
func SanitizeInterfaceName ¶
SanitizeInterfaceName sanitizes an interface name by removing invalid characters
func ValidateDeviceIndex ¶
ValidateDeviceIndex validates a device index
func ValidateENIPattern ¶
ValidateENIPattern validates an ENI pattern regex
func ValidateInterfaceName ¶
ValidateInterfaceName validates a network interface name
func ValidateInterfaceState ¶
ValidateInterfaceState validates an interface state string
func ValidateMACAddress ¶
ValidateMACAddress validates a MAC address format
func ValidateNetworkConfiguration ¶
func ValidateNetworkConfiguration(ifaceName string, mtu int, deviceIndex int, pciAddress string) error
ValidateNetworkConfiguration validates a complete network configuration
func ValidatePCIAddress ¶
ValidatePCIAddress validates a PCI address format
Types ¶
type InterfaceInfo ¶
type InterfaceInfo struct {
Name string
Index int
State string
MTU int
PCIAddress string
MACAddress string
IsAWSENI bool
DeviceIndex int
}
InterfaceInfo represents information about a network interface
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles network interface operations
func NewManager ¶
func NewManager(cfg *config.ENIManagerConfig) *Manager
NewManager creates a new network interface manager
func (*Manager) BringDownInterface ¶
BringDownInterface brings down a network interface
func (*Manager) BringDownInterfaceWithRetry ¶
BringDownInterfaceWithRetry brings down an interface with retry logic
func (*Manager) BringUpInterface ¶
BringUpInterface brings up a network interface with retry logic
func (*Manager) BringUpInterfaceWithRetry ¶
BringUpInterfaceWithRetry brings up an interface with retry logic
func (*Manager) ConfigureInterfaceFromNodeENI ¶
func (m *Manager) ConfigureInterfaceFromNodeENI(ifaceName string, nodeENI networkingv1alpha1.NodeENI) error
ConfigureInterfaceFromNodeENI configures an interface based on NodeENI specification
func (*Manager) ConfigureInterfaceWithRetry ¶
func (m *Manager) ConfigureInterfaceWithRetry(ctx context.Context, ifaceName string, nodeENI interface{}) error
ConfigureInterfaceWithRetry configures an interface with retry logic
func (*Manager) GetAllInterfaces ¶
func (m *Manager) GetAllInterfaces() ([]InterfaceInfo, error)
GetAllInterfaces returns information about all network interfaces
func (*Manager) GetInterfaceNameForDeviceIndex ¶
GetInterfaceNameForDeviceIndex returns the interface name for a given device index
func (*Manager) RetryInterfaceOperation ¶
func (m *Manager) RetryInterfaceOperation(ctx context.Context, operation string, ifaceName string, fn func() error) error
RetryInterfaceOperation retries a network interface operation
func (*Manager) SetMTUWithRetry ¶
SetMTUWithRetry sets MTU with retry logic
func (*Manager) ValidateInterfaceWithRetry ¶
ValidateInterfaceWithRetry validates an interface configuration with retry logic
func (*Manager) WaitForInterface ¶
WaitForInterface waits for an interface to appear
type RetryConfig ¶
type RetryConfig struct {
MaxAttempts int // Maximum number of retry attempts
BaseDelay time.Duration // Base delay between retries
MaxDelay time.Duration // Maximum delay between retries
Multiplier float64 // Backoff multiplier
}
RetryConfig holds configuration for retry operations
func DefaultRetryConfig ¶
func DefaultRetryConfig() RetryConfig
DefaultRetryConfig returns default retry configuration
type RetryableError ¶
RetryableError represents an error that can be retried
func NewRetryableError ¶
func NewRetryableError(err error, retryable bool) *RetryableError
NewRetryableError creates a new retryable error
func (*RetryableError) Error ¶
func (e *RetryableError) Error() string
func (*RetryableError) Unwrap ¶
func (e *RetryableError) Unwrap() error