Documentation ¶
Index ¶
- Constants
- Variables
- func AddOFFlowWithSpecificAction(bridgeName, action string) (string, string, error)
- func AddRoutesGatewayIP(netinfo NetInfo, pod *v1.Pod, podAnnotation *PodAnnotation, ...) error
- func BridgeToNic(bridge string) error
- func ContainsCIDR(ipnet1, ipnet2 *net.IPNet) bool
- func CopyIPNets(ipnets []*net.IPNet) []*net.IPNet
- func CreateNodeGatewayRouterLRPAddrAnnotation(nodeAnnotation map[string]interface{}, nodeIPNetv4, nodeIPNetv6 *net.IPNet) (map[string]interface{}, error)
- func CreateNodeTransitSwitchPortAddrAnnotation(nodeAnnotation map[string]interface{}, nodeIPNetv4, nodeIPNetv6 *net.IPNet) (map[string]interface{}, error)
- func DefaultNetworkPodIPs(pod *v1.Pod) ([]net.IP, error)
- func DeleteConntrack(ip string, port int32, protocol kapi.Protocol, ...) error
- func DeleteConntrackServicePort(ip string, port int32, protocol kapi.Protocol, ...) error
- func DeleteNodeHostSubnetAnnotation(nodeAnnotator kube.Annotator)
- func DetectCheckPktLengthSupport(bridge string) (bool, error)
- func DetectSCTPSupport() (bool, error)
- func DoesEndpointSliceContainEligibleEndpoint(endpointSlice *discovery.EndpointSlice, epIP string, epPort int32, ...) bool
- func DoesNetworkRequireIPAM(netInfo NetInfo) bool
- func DoesNetworkRequireTunnelIDs(netInfo NetInfo) bool
- func EventRecorder(kubeClient kubernetes.Interface) record.EventRecorder
- func ExternalIDsForObject(obj K8sObject) map[string]string
- func FilterIPsSlice(s []string, filter []net.IPNet, keep bool) []string
- func GenerateId(length int) string
- func GenerateRandMAC() (net.HardwareAddr, error)
- func GetAllClusterSubnets() []*net.IPNet
- func GetBridgeName(iface string) string
- func GetChildStopChanWithTimeout(parentStopChan <-chan struct{}, duration time.Duration) chan struct{}
- func GetClusterIPs(service *kapi.Service) []string
- func GetClusterSubnets() ([]*net.IPNet, []*net.IPNet)
- func GetConntrackZone() int
- func GetDNSNames(ef *egressfirewall.EgressFirewall) []string
- func GetDPUHostInterface(bridgeName string) (string, error)
- func GetDeviceIDFromNetdevice(netdev string) (string, error)
- func GetEgressIPNetwork(node *v1.Node, eIPConfig *ParsedNodeEgressIPConfiguration, eIP net.IP) (string, error)
- func GetEligibleEndpointAddresses(endpoints []discovery.Endpoint, service *kapi.Service) []string
- func GetEligibleEndpointAddressesFromSlices(endpointSlices []*discovery.EndpointSlice, service *kapi.Service) []string
- func GetExec() kexec.Interface
- func GetExternalAndLBIPs(service *kapi.Service) []string
- func GetExternalIDValByKey(keyValString, key string) string
- func GetFilteredInterfaceAddrs(link netlink.Link, v4, v6 bool) ([]netlink.Addr, error)
- func GetFilteredInterfaceV4V6IPs(iface string) ([]*net.IPNet, error)
- func GetFunctionRepresentorName(deviceID string) (string, error)
- func GetGatewayRouterFromNode(node string) string
- func GetHybridOverlayPortName(nodeName string) string
- func GetIFNameAndMTUForAddress(ifAddress net.IP) (string, int, error)
- func GetIPFamily(v6 bool) int
- func GetIPFullMask(ip net.IP) net.IPMask
- func GetIPFullMaskString(ip string) string
- func GetIPNetFullMask(ipStr string) (*net.IPNet, error)
- func GetIPv6OnSubnet(iface string, ip *net.IPNet) (*net.IPNet, error)
- func GetIfaceId(podNamespace, podName string) string
- func GetK8sPodAllNetworkSelections(pod *v1.Pod) ([]*nadapi.NetworkSelectionElement, error)
- func GetK8sPodDefaultNetworkSelection(pod *v1.Pod) (*nadapi.NetworkSelectionElement, error)
- func GetLegacyK8sMgmtIntfName(nodeName string) string
- func GetLocalEligibleEndpointAddressesFromSlices(endpointSlices []*discovery.EndpointSlice, service *kapi.Service, ...) sets.Set[string]
- func GetLogicalPortName(podNamespace, podName string) string
- func GetMACAddressFromARP(neighIP net.IP) (net.HardwareAddr, error)
- func GetNADName(namespace, name string) string
- func GetNetdevNameFromDeviceId(deviceId string, deviceInfo nadapi.DeviceInfo) (string, error)
- func GetNicName(brName string) (string, error)
- func GetNodeAddresses(ipv4, ipv6 bool, nodes ...*v1.Node) (ipsv4 []net.IP, ipsv6 []net.IP, err error)
- func GetNodeChassisID() (string, error)
- func GetNodeEgressLabel() string
- func GetNodeGatewayIfAddr(subnet *net.IPNet) *net.IPNet
- func GetNodeHostAddrs(node *kapi.Node) ([]string, error)
- func GetNodeHybridOverlayIfAddr(subnet *net.IPNet) *net.IPNet
- func GetNodeID(node *kapi.Node) int
- func GetNodeInternalAddrs(node *v1.Node) (net.IP, net.IP)
- func GetNodeManagementIfAddr(subnet *net.IPNet) *net.IPNet
- func GetNodeNetworkIDsAnnotationNetworkIDs(node *kapi.Node) (map[string]int, error)
- func GetNodePrimaryIP(node *kapi.Node) (string, error)
- func GetNodeSubnetAnnotationNetworkNames(node *kapi.Node) ([]string, error)
- func GetNodeZone(node *kapi.Node) string
- func GetOFFlows(bridgeName string) ([]string, error)
- func GetOVSOfPort(args ...string) (string, string, error)
- func GetOVSPortMACAddress(portName string) (net.HardwareAddr, error)
- func GetOVSPortPodInfo(hostIfName string) (bool, string, string, error)
- func GetOpenFlowPorts(bridgeName string, namedPorts bool) ([]string, error)
- func GetOvnRunDir() string
- func GetOvsDBServerPID() (string, error)
- func GetOvsVSwitchdPID() (string, error)
- func GetPodCIDRsWithFullMask(pod *v1.Pod, nInfo NetInfo) ([]*net.IPNet, error)
- func GetPodIPsOfNetwork(pod *v1.Pod, nInfo NetInfo) ([]net.IP, error)
- func GetPodNADToNetworkMapping(pod *kapi.Pod, nInfo NetInfo) (bool, map[string]*nettypes.NetworkSelectionElement, error)
- func GetSecondaryHostNetworkContainingIP(node *v1.Node, ip net.IP) (string, error)
- func GetSecondaryNetworkIfaceId(podNamespace, podName, nadName string) string
- func GetSecondaryNetworkLogicalPortName(podNamespace, podName, nadName string) string
- func GetSecondaryNetworkPrefix(netName string) string
- func GetWorkerFromGatewayRouter(gr string) string
- func HWAddrToIPv6LLA(hwaddr net.HardwareAddr) net.IP
- func HasLocalHostNetworkEndpoints(localEndpointAddresses sets.Set[string], nodeAddresses []net.IP) bool
- func HasNodeMigratedZone(node *kapi.Node) bool
- func HashForOVN(s string) string
- func IPAddrToHWAddr(ip net.IP) net.HardwareAddr
- func IPFamilyName(isIPv6 bool) string
- func IPNetsIPToStringSlice(ips []*net.IPNet) []string
- func IPsToNetworkIPs(ips ...*net.IPNet) []*net.IPNet
- func IsAddressAddedByKeepAlived(addr netlink.Addr) bool
- func IsAddressReservedForInternalUse(addr net.IP) bool
- func IsAnnotationAlreadySetError(err error) bool
- func IsAnnotationNotSetError(err error) bool
- func IsAuxDeviceName(deviceID string) bool
- func IsClusterIP(svcVIP string) bool
- func IsClusterIPSet(service *kapi.Service) bool
- func IsContainedInAnyCIDR(ipnet *net.IPNet, ipnets ...*net.IPNet) bool
- func IsDNSNameResolverEnabled() bool
- func IsDeprecatedAddr(link netlink.Link, address *net.IPNet) (bool, error)
- func IsEndpointReady(endpoint discovery.Endpoint) bool
- func IsEndpointServing(endpoint discovery.Endpoint) bool
- func IsEndpointTerminating(endpoint discovery.Endpoint) bool
- func IsHostEndpoint(endpointIPstr string) bool
- func IsIPNetEqual(ipn1 *net.IPNet, ipn2 *net.IPNet) bool
- func IsMultiNetworkPoliciesSupportEnabled() bool
- func IsNilOrAnyNetwork(ipNet *net.IPNet) bool
- func IsNodeHybridOverlayIfAddr(ip net.IP, subnets []*net.IPNet) bool
- func IsNodeSecondaryHostEgressIPsAnnotationSet(node *kapi.Node) bool
- func IsOVNNetwork(eIPConfig *ParsedNodeEgressIPConfiguration, ip net.IP) bool
- func IsOvsHwOffloadEnabled() (bool, error)
- func IsPCIDeviceName(deviceID string) bool
- func IsSecondaryHostNetworkContainingIP(node *v1.Node, ip net.IP) (bool, error)
- func IsValidPodAnnotation(podAnnotation *PodAnnotation) bool
- func IsWildcard(dnsName string) bool
- func JoinHostPortInt32(host string, port int32) string
- func JoinIPNetIPs(ipnets []*net.IPNet, sep string) string
- func JoinIPNets(ipnets []*net.IPNet, sep string) string
- func JoinIPs(ips []net.IP, sep string) string
- func LinkAddrAdd(link netlink.Link, address *net.IPNet, ...) error
- func LinkAddrDel(link netlink.Link, address *net.IPNet) error
- func LinkAddrExist(link netlink.Link, address *net.IPNet) (bool, error)
- func LinkAddrFlush(link netlink.Link) error
- func LinkDelete(interfaceName string) error
- func LinkNeighAdd(link netlink.Link, neighIP net.IP, neighMAC net.HardwareAddr) error
- func LinkNeighDel(link netlink.Link, neighIP net.IP) error
- func LinkNeighExists(link netlink.Link, neighIP net.IP, neighMAC net.HardwareAddr) (bool, error)
- func LinkNeighIPExists(link netlink.Link, neighIP net.IP) (bool, error)
- func LinkRouteExists(link netlink.Link, gwIP net.IP, subnet *net.IPNet) (bool, error)
- func LinkRouteGetFilteredRoute(routeFilter *netlink.Route, filterMask uint64) (*netlink.Route, error)
- func LinkRoutesAdd(link netlink.Link, gwIP net.IP, subnets []*net.IPNet, mtu int, src net.IP) error
- func LinkRoutesDel(link netlink.Link, subnets []*net.IPNet) error
- func LinkSetUp(interfaceName string) (netlink.Link, error)
- func LoadBalancerServiceHasNodePortAllocation(service *kapi.Service) bool
- func LowerCaseFQDN(dnsName string) string
- func MarshalPodAnnotation(annotations map[string]string, podInfo *PodAnnotation, nadName string) (map[string]string, error)
- func MarshalPodDPUConnDetails(annotations map[string]string, dcd *DPUConnectionDetails, nadName string) (map[string]string, error)
- func MarshalPodDPUConnStatus(annotations map[string]string, scs *DPUConnectionStatus, nadName string) (map[string]string, error)
- func MatchAllIPNetFamily(isIPv6 bool, ipnets []*net.IPNet) []*net.IPNet
- func MatchAllIPStringFamily(isIPv6 bool, ipStrings []string) ([]string, error)
- func MatchFirstIPFamily(isIPv6 bool, ips []net.IP) (net.IP, error)
- func MatchFirstIPNetFamily(isIPv6 bool, ipnets []*net.IPNet) (*net.IPNet, error)
- func MatchIPFamily(isIPv6 bool, ips []net.IP) ([]net.IP, error)
- func MatchIPStringFamily(isIPv6 bool, ipStrings []string) (string, error)
- func NewKubernetesClientset(conf *config.KubernetesConfig) (*kubernetes.Clientset, error)
- func NewNamespace(namespace string) *v1.Namespace
- func NewObjectMeta(name, namespace string) metav1.ObjectMeta
- func NewObjectMetaWithLabels(name, namespace string, labels map[string]string) metav1.ObjectMeta
- func NicToBridge(iface string) (string, error)
- func NoHostSubnet(node *v1.Node) bool
- func NodeChassisIDAnnotationChanged(oldNode, newNode *kapi.Node) bool
- func NodeGatewayRouterLRPAddrAnnotationChanged(oldNode, newNode *corev1.Node) bool
- func NodeHostCIDRsAnnotationChanged(oldNode, newNode *v1.Node) bool
- func NodeIDAnnotationChanged(oldNode, newNode *corev1.Node) bool
- func NodeL3GatewayAnnotationChanged(oldNode, newNode *kapi.Node) bool
- func NodeMigratedZoneAnnotationChanged(oldNode, newNode *corev1.Node) bool
- func NodeNetworkIDAnnotationChanged(oldNode, newNode *corev1.Node, netName string) bool
- func NodeSubnetAnnotationChanged(oldNode, newNode *v1.Node) bool
- func NodeTransitSwitchPortAddrAnnotationChanged(oldNode, newNode *corev1.Node) bool
- func NodeZoneAnnotationChanged(oldNode, newNode *corev1.Node) bool
- func ParseIPNets(strs []string) ([]*net.IPNet, error)
- func ParseNetConf(netattachdef *nettypes.NetworkAttachmentDefinition) (*ovncnitypes.NetConf, error)
- func ParseNetworkIDAnnotation(node *kapi.Node, netName string) (int, error)
- func ParseNodeChassisIDAnnotation(node *kapi.Node) (string, error)
- func ParseNodeGatewayMTUSupport(node *kapi.Node) bool
- func ParseNodeGatewayRouterLRPAddr(node *kapi.Node) (net.IP, error)
- func ParseNodeGatewayRouterLRPAddrs(node *kapi.Node) ([]*net.IPNet, error)
- func ParseNodeHostCIDRs(node *kapi.Node) (sets.Set[string], error)
- func ParseNodeHostCIDRsDropNetMask(node *kapi.Node) (sets.Set[string], error)
- func ParseNodeHostCIDRsExcludeOVNNetworks(node *kapi.Node) ([]string, error)
- func ParseNodeHostCIDRsList(node *kapi.Node) ([]string, error)
- func ParseNodeHostSubnetAnnotation(node *kapi.Node, netName string) ([]*net.IPNet, error)
- func ParseNodeManagementPortAnnotation(node *kapi.Node) (int, int, error)
- func ParseNodeManagementPortMACAddress(node *kapi.Node) (net.HardwareAddr, error)
- func ParseNodeSecondaryHostEgressIPsAnnotation(node *kapi.Node) (sets.Set[string], error)
- func ParseNodeTransitSwitchPortAddrs(node *kapi.Node) ([]*net.IPNet, error)
- func ParseNodesHostSubnetAnnotation(nodes []*kapi.Node, netName string) ([]*net.IPNet, error)
- func ParseRoutingExternalGWAnnotation(annotation string) (sets.Set[string], error)
- func PlatformTypeIsEgressIPCloudProvider() bool
- func PodCompleted(pod *kapi.Pod) bool
- func PodNadNames(pod *v1.Pod, netinfo NetInfo) ([]string, error)
- func PodNeedsSNAT(pod *kapi.Pod) bool
- func PodRunning(pod *kapi.Pod) bool
- func PodScheduled(pod *kapi.Pod) bool
- func PodTerminating(pod *kapi.Pod) bool
- func PodWantsHostNetwork(pod *kapi.Pod) bool
- func PrepareTestConfig()
- func RemoveIndexFromSliceUnstable[T comparable](slice []T, i int) []T
- func RemoveItemFromSliceUnstable[T comparable](slice []T, candidate T) []T
- func ReplaceOFFlows(bridgeName string, flows []string) (string, string, error)
- func ResetNetLinkOpMockInst()
- func ResetRunner()
- func RunIP(args ...string) (string, string, error)
- func RunNetsh(args ...string) (string, string, error)
- func RunOVNAppctlWithTimeout(timeout int, args ...string) (string, string, error)
- func RunOVNControllerAppCtl(args ...string) (string, string, error)
- func RunOVNNBAppCtl(args ...string) (string, string, error)
- func RunOVNNBAppCtlWithTimeout(timeout int, args ...string) (string, string, error)
- func RunOVNNbctl(args ...string) (string, string, error)
- func RunOVNNbctlRawOutput(timeout int, args ...string) (string, string, error)
- func RunOVNNbctlWithTimeout(timeout int, args ...string) (string, string, error)
- func RunOVNNorthAppCtl(args ...string) (string, string, error)
- func RunOVNSBAppCtl(args ...string) (string, string, error)
- func RunOVNSBAppCtlWithTimeout(timeout int, args ...string) (string, string, error)
- func RunOVNSbctl(args ...string) (string, string, error)
- func RunOVNSbctlWithTimeout(timeout int, args ...string) (string, string, error)
- func RunOVSAppctl(args ...string) (string, string, error)
- func RunOVSAppctlWithTimeout(timeout int, args ...string) (string, string, error)
- func RunOVSDBClient(args ...string) (string, string, error)
- func RunOVSDBClientOVNNB(command string, args ...string) (string, string, error)
- func RunOVSDBTool(args ...string) (string, string, error)
- func RunOVSOfctl(args ...string) (string, string, error)
- func RunOVSVsctl(args ...string) (string, string, error)
- func RunOvsVswitchdAppCtl(args ...string) (string, string, error)
- func RunPowershell(args ...string) (string, string, error)
- func RunRoute(args ...string) (string, string, error)
- func RunSysctl(args ...string) (string, string, error)
- func SecondaryNetworkPodIPs(pod *v1.Pod, networkInfo NetInfo) ([]net.IP, error)
- func ServiceExternalTrafficPolicyLocal(service *kapi.Service) bool
- func ServiceInternalTrafficPolicyLocal(service *kapi.Service) bool
- func ServiceNamespacedNameFromEndpointSlice(endpointSlice *discovery.EndpointSlice) (k8stypes.NamespacedName, error)
- func ServiceTypeHasClusterIP(service *kapi.Service) bool
- func ServiceTypeHasLoadBalancer(service *kapi.Service) bool
- func ServiceTypeHasNodePort(service *kapi.Service) bool
- func SetARPTimeout()
- func SetDNSLibOpsMockInst(mockInst DNSOps)
- func SetExec(exec kexec.Interface) error
- func SetExecWithoutOVS(exec kexec.Interface) error
- func SetFakeIPTablesHelpers() (IPTablesHelper, IPTablesHelper)
- func SetFileSystemOps(mockInst FileSystemOps)
- func SetGatewayMTUSupport(nodeAnnotator kube.Annotator, set bool) error
- func SetIPTablesHelper(proto iptables.Protocol, ipt IPTablesHelper)
- func SetL3GatewayConfig(nodeAnnotator kube.Annotator, cfg *L3GatewayConfig) error
- func SetNetLinkOpMockInst(mockInst NetLinkOps)
- func SetNodeHostCIDRs(nodeAnnotator kube.Annotator, cidrs sets.Set[string]) error
- func SetNodeHostSubnetAnnotation(nodeAnnotator kube.Annotator, defaultSubnets []*net.IPNet) error
- func SetNodeManagementPortAnnotation(nodeAnnotator kube.Annotator, PfId int, FuncId int) error
- func SetNodeManagementPortMACAddress(nodeAnnotator kube.Annotator, macAddress net.HardwareAddr) error
- func SetNodePrimaryIfAddrs(nodeAnnotator kube.Annotator, ifAddrs []*net.IPNet) (err error)
- func SetNodeZone(nodeAnnotator kube.Annotator, zoneName string) error
- func SetNodeZoneMigrated(nodeAnnotator kube.Annotator, zoneName string) error
- func SetSpecificExec(exec kexec.Interface, commands ...string) error
- func SetSriovnetOpsInst(mockInst SriovnetOps)
- func SetVdpaOpsInst(mockInst VdpaOps)
- func SliceHasStringItem(slice []string, item string) bool
- func SplitHostPortInt32(vip string) (string, int32, error)
- func StartNodeCertificateManager(ctx context.Context, wg *sync.WaitGroup, nodeName string, ...) error
- func StringArg(context *cli.Context, name string) (string, error)
- func StringSlice[T fmt.Stringer](items []T) []string
- func SyncConntrackForExternalGateways(gwIPsToKeep sets.Set[string], ...) error
- func UnmarshalPodAnnotationAllNetworks(annotations map[string]string) (map[string]podAnnotation, error)
- func UnmarshalPodDPUConnDetailsAllNetworks(annotations map[string]string) (map[string]DPUConnectionDetails, error)
- func UnmarshalPodDPUConnStatusAllNetworks(annotations map[string]string) (map[string]DPUConnectionStatus, error)
- func UpdateExternalGatewayPodIPsAnnotation(k kube.Interface, namespace string, exgwIPs []string) error
- func UpdateIPsSlice(s, oldIPs, newIPs []string) ([]string, bool)
- func UpdateNetworkIDAnnotation(annotations map[string]string, netName string, networkID int) (map[string]string, error)
- func UpdateNodeHostSubnetAnnotation(annotations map[string]string, hostSubnets []*net.IPNet, netName string) (map[string]string, error)
- func UpdateNodeIDAnnotation(annotations map[string]interface{}, nodeID int) map[string]interface{}
- func UpdatePodAnnotationWithRetry(podLister listers.PodLister, kube kube.Interface, pod *v1.Pod, ...) error
- func UpdatePodDPUConnDetailsWithRetry(podLister listers.PodLister, kube kube.Interface, pod *v1.Pod, ...) error
- func UpdatePodDPUConnStatusWithRetry(podLister listers.PodLister, kube kube.Interface, pod *v1.Pod, ...) error
- func UpdatePodWithRetryOrRollback(podLister listers.PodLister, kube kube.Interface, pod *v1.Pod, ...) error
- func UseEndpointSlices(kubeClient kubernetes.Interface) bool
- func ValidateAndGetEgressFirewallDestination(egressFirewallDestination egressfirewallapi.EgressFirewallDestination) (cidrSelector string, dnsName string, clusterSubnetIntersection bool, ...)
- func ValidatePort(proto kapi.Protocol, port int32) error
- func ValidateProtocol(proto kapi.Protocol) error
- func WaitForHandlerSyncWithTimeout(controllerName string, stopCh <-chan struct{}, timeout time.Duration, ...) bool
- func WaitForInformerCacheSyncWithTimeout(controllerName string, stopCh <-chan struct{}, ...) bool
- type AllocateToPodWithRollbackFunc
- type BasicNetInfo
- type CancelableContext
- type Capacity
- type DNS
- type DNSOps
- type DPUConnectionDetails
- type DPUConnectionStatus
- type DefaultNetInfo
- func (nInfo *DefaultNetInfo) AddNAD(nadName string)
- func (nInfo *DefaultNetInfo) AllowsPersistentIPs() bool
- func (nInfo *DefaultNetInfo) CompareNetInfo(netBasicInfo BasicNetInfo) bool
- func (nInfo *DefaultNetInfo) DeleteNAD(nadName string)
- func (nInfo *DefaultNetInfo) ExcludeSubnets() []*net.IPNet
- func (nInfo *DefaultNetInfo) GetNetworkName() string
- func (nInfo *DefaultNetInfo) GetNetworkScopedName(name string) string
- func (nInfo *DefaultNetInfo) HasNAD(nadName string) bool
- func (nInfo *DefaultNetInfo) IPMode() (bool, bool)
- func (nInfo *DefaultNetInfo) IsSecondary() bool
- func (nInfo *DefaultNetInfo) MTU() int
- func (nInfo *DefaultNetInfo) RemoveNetworkScopeFromName(name string) string
- func (nInfo *DefaultNetInfo) Subnets() []config.CIDRNetworkEntry
- func (nInfo *DefaultNetInfo) TopologyType() string
- func (nInfo *DefaultNetInfo) Vlan() uint
- type ExecRunner
- type FakeIPTables
- func (f *FakeIPTables) Append(tableName, chainName string, rulespec ...string) error
- func (f *FakeIPTables) ClearChain(tableName, chainName string) error
- func (f *FakeIPTables) Delete(tableName, chainName string, rulespec ...string) error
- func (f *FakeIPTables) DeleteChain(tableName, chainName string) error
- func (f *FakeIPTables) Exists(tableName, chainName string, rulespec ...string) (bool, error)
- func (f *FakeIPTables) Insert(tableName, chainName string, pos int, rulespec ...string) error
- func (f *FakeIPTables) List(tableName, chainName string) ([]string, error)
- func (f *FakeIPTables) ListChains(tableName string) ([]string, error)
- func (f *FakeIPTables) MatchState(tables map[string]FakeTable) error
- func (f *FakeIPTables) NewChain(tableName, chainName string) error
- func (f *FakeIPTables) Restore(tableName string, rulesMap map[string][][]string) error
- type FakeTable
- type FileSystemOps
- type IPTablesHelper
- type K8sObject
- type L3GatewayConfig
- type ManagementPortDetails
- type NetInfo
- type NetLinkOps
- type OVNClientset
- type OVNClusterManagerClientset
- type OVNDBServerStatus
- type OVNKubeControllerClientset
- type OVNMasterClientset
- type OVNNodeClientset
- type OvsDbProperties
- type ParsedIFAddr
- type ParsedNodeEgressIPConfiguration
- type PodAnnotation
- type PodRoute
- type SriovnetOps
- type VdpaDevice
- type VdpaOps
Constants ¶
const ( DPUConnectionDetailsAnnot = "k8s.ovn.org/dpu.connection-details" DPUConnectionStatusAnnot = "k8s.ovn.org/dpu.connection-status" DPUConnectionStatusReady = "Ready" DPUConnectionStatusError = "Error" )
const ( // Annotation used to enable/disable multicast in the namespace NsMulticastAnnotation = "k8s.ovn.org/multicast-enabled" // Annotations used by multiple external gateways feature RoutingExternalGWsAnnotation = "k8s.ovn.org/routing-external-gws" RoutingNamespaceAnnotation = "k8s.ovn.org/routing-namespaces" RoutingNetworkAnnotation = "k8s.ovn.org/routing-network" BfdAnnotation = "k8s.ovn.org/bfd-enabled" ExternalGatewayPodIPsAnnotation = "k8s.ovn.org/external-gw-pod-ips" // Annotation for enabling ACL logging to controller's log file AclLoggingAnnotation = "k8s.ovn.org/acl-logging" )
const ( // OvnNodeL3GatewayConfig is the constant string representing the l3 gateway annotation key OvnNodeL3GatewayConfig = "k8s.ovn.org/l3-gateway-config" // OvnNodeGatewayMtuSupport determines if option:gateway_mtu shall be set for GR router ports. OvnNodeGatewayMtuSupport = "k8s.ovn.org/gateway-mtu-support" // OvnNodeManagementPort is the constant string representing the annotation key OvnNodeManagementPort = "k8s.ovn.org/node-mgmt-port" // OvnNodeManagementPortMacAddress is the constant string representing the annotation key OvnNodeManagementPortMacAddress = "k8s.ovn.org/node-mgmt-port-mac-address" // OvnNodeChassisID is the systemID of the node needed for creating L3 gateway OvnNodeChassisID = "k8s.ovn.org/node-chassis-id" // OvnNodeIfAddr is the CIDR form representation of primary network interface's attached IP address (i.e: 192.168.126.31/24 or 0:0:0:0:0:feff:c0a8:8e0c/64) OvnNodeIfAddr = "k8s.ovn.org/node-primary-ifaddr" // OVNNodeHostCIDRs is used to track the different host IP addresses and subnet masks on the node OVNNodeHostCIDRs = "k8s.ovn.org/host-cidrs" // OVNNodeSecondaryHostEgressIPs contains EgressIP addresses that aren't managed by OVN. The EIP addresses are assigned to // standard linux interfaces and not interfaces of type OVS. OVNNodeSecondaryHostEgressIPs = "k8s.ovn.org/secondary-host-egress-ips" // OvnNodeZoneName is the zone to which the node belongs to. It is set by ovnkube-node. // ovnkube-node gets the node's zone from the OVN Southbound database. OvnNodeZoneName = "k8s.ovn.org/zone-name" /** HACK BEGIN **/ // TODO(tssurya): Remove this annotation a few months from now (when one or two release jump // upgrades are done). This has been added only to minimize disruption for upgrades when // moving to interconnect=true. // We want the legacy ovnkube-master to wait for remote ovnkube-node to // signal it using "k8s.ovn.org/remote-zone-migrated" annotation before // considering a node as remote when we upgrade from "global" (1 zone IC) // zone to multi-zone. This is so that network disruption for the existing workloads // is negligible and until the point where ovnkube-node flips the switch to connect // to the new SBDB, it would continue talking to the legacy RAFT ovnkube-sbdb to ensure // OVN/OVS flows are intact. // OvnNodeMigratedZoneName is the zone to which the node belongs to. It is set by ovnkube-node. // ovnkube-node gets the node's zone from the OVN Southbound database. OvnNodeMigratedZoneName = "k8s.ovn.org/remote-zone-migrated" // InvalidNodeID indicates an invalid node id InvalidNodeID = -1 // invalidNetworkID signifies its an invalid network id InvalidNetworkID = -1 )
const ( OvnNbdbLocation = "/etc/ovn/ovnnb_db.db" OvnSbdbLocation = "/etc/ovn/ovnsb_db.db" FloodAction = "FLOOD" NormalAction = "NORMAL" )
const ( // OvnPodAnnotationName is the constant string representing the POD annotation key OvnPodAnnotationName = "k8s.ovn.org/pod-networks" // DefNetworkAnnotation is the pod annotation for the cluster-wide default network DefNetworkAnnotation = "v1.multus-cni.io/default-network" )
const ( // OVNEgressIPOwnerRefLabel is the label annotation indicating the egress // IP object owner of a CloudPrivateIPConfig object OVNEgressIPOwnerRefLabel = "k8s.ovn.org/egressip-owner-ref" )
const UnlimitedNodeCapacity = math.MaxInt32
Variables ¶
var ( ErrorAttachDefNotOvnManaged = errors.New("net-attach-def not managed by OVN") UnsupportedIPAMKeyError = errors.New("IPAM key is not supported. Use OVN-K provided IPAM via the `subnets` attribute") )
var AppFs = afero.NewOsFs()
var ErrNoPodIPFound = errors.New("no pod IPs found")
var ErrOverridePodIPs = errors.New("requested pod IPs trying to override IPs exists in pod annotation")
var ErrorNoIP = errors.New("no IP available")
var OvnConflictBackoff = wait.Backoff{ Steps: 2, Duration: 10 * time.Millisecond, Factor: 5.0, Jitter: 0.1, }
OvnConflictBackoff is the backoff used for pod annotation update conflict
Functions ¶
func AddOFFlowWithSpecificAction ¶
AddOFFlowWithSpecificAction replaces flows in the bridge by a single flow with a specified action
func AddRoutesGatewayIP ¶
func AddRoutesGatewayIP( netinfo NetInfo, pod *v1.Pod, podAnnotation *PodAnnotation, network *nadapi.NetworkSelectionElement) error
addRoutesGatewayIP updates the provided pod annotation for the provided pod with the gateways derived from the allocated IPs
func BridgeToNic ¶
BridgeToNic moves the IP address and routes of internal port of the bridge to underlying NIC interface and deletes the OVS bridge.
func ContainsCIDR ¶
ContainsCIDR returns true if ipnet1 contains ipnet2
func CopyIPNets ¶
CopyIPNets copies the provided slice of IPNet
func CreateNodeGatewayRouterLRPAddrAnnotation ¶
func CreateNodeGatewayRouterLRPAddrAnnotation(nodeAnnotation map[string]interface{}, nodeIPNetv4, nodeIPNetv6 *net.IPNet) (map[string]interface{}, error)
CreateNodeGatewayRouterLRPAddrAnnotation sets the IPv4 / IPv6 values of the node's Gateway Router LRP to join switch.
func CreateNodeTransitSwitchPortAddrAnnotation ¶
func CreateNodeTransitSwitchPortAddrAnnotation(nodeAnnotation map[string]interface{}, nodeIPNetv4, nodeIPNetv6 *net.IPNet) (map[string]interface{}, error)
CreateNodeTransitSwitchPortAddrAnnotation creates the node annotation for the node's Transit switch port addresses.
func DeleteConntrack ¶
func DeleteConntrackServicePort ¶
func DeleteConntrackServicePort(ip string, port int32, protocol kapi.Protocol, ipFilterType netlink.ConntrackFilterType, labels [][]byte) error
DeleteConntrackServicePort is a wrapper around DeleteConntrack for the purpose of deleting conntrack entries that belong to ServicePorts. Before deleting any conntrack entry, it makes sure that the port is valid. If the port is invalid, it will log a level 5 info message and simply return.
func DeleteNodeHostSubnetAnnotation ¶
DeleteNodeHostSubnetAnnotation removes a "k8s.ovn.org/node-subnets" annotation using a kube.Annotator
func DetectCheckPktLengthSupport ¶
DetectCheckPktLengthSupport checks if OVN supports check packet length action in OVS kernel datapath
func DetectSCTPSupport ¶
DetectSCTPSupport checks if OVN supports SCTP for load balancer
func DoesEndpointSliceContainEligibleEndpoint ¶
func DoesEndpointSliceContainEligibleEndpoint(endpointSlice *discovery.EndpointSlice, epIP string, epPort int32, protocol kapi.Protocol, service *kapi.Service) bool
DoesEndpointSliceContainEndpoint returns true if the endpointslice contains an endpoint with the given IP, port and Protocol and if this endpoint is considered eligible.
func DoesNetworkRequireIPAM ¶
func EventRecorder ¶
func EventRecorder(kubeClient kubernetes.Interface) record.EventRecorder
EventRecorder returns an EventRecorder type that can be used to post Events to different object's lifecycles.
func ExternalIDsForObject ¶
func FilterIPsSlice ¶
FilterIPsSlice will filter a list of IPs by a list of CIDRs. By default, it will *remove* all IPs that match filter, unless keep is true.
It is dual-stack aware.
func GenerateId ¶
GenerateId returns a random id as a string with the requested length
func GenerateRandMAC ¶
func GenerateRandMAC() (net.HardwareAddr, error)
GenerateRandMAC generates a random unicast and locally administered MAC address. LOOTED FROM https://github.com/cilium/cilium/blob/v1.12.6/pkg/mac/mac.go#L106
func GetAllClusterSubnets ¶
GetAllClusterSubnets returns all (v4&v6) cluster subnets in a cluster
func GetBridgeName ¶
func GetClusterIPs ¶
GetClusterIPs return an array with the ClusterIPs present in the service for backward compatibility with versions < 1.20 we need to handle the case where only ClusterIP exist
func GetClusterSubnets ¶
GetClusterSubnets returns the v4&v6 cluster subnets in a cluster separately
func GetConntrackZone ¶
func GetConntrackZone() int
func GetDNSNames ¶
func GetDNSNames(ef *egressfirewall.EgressFirewall) []string
GetDNSNames iterates through the egress firewall rules and returns the DNS names present in them after validating the rules.
func GetDPUHostInterface ¶
GetDPUHostInterface returns the host representor interface attached to bridge
func GetDeviceIDFromNetdevice ¶
GetDeviceIDFromNetdevice retrieves device ID for passed netdevice which is PCI address for regular netdevice, eg. VF, or Auxiliary Device name for SF netdevice
func GetEgressIPNetwork ¶
func GetEgressIPNetwork(node *v1.Node, eIPConfig *ParsedNodeEgressIPConfiguration, eIP net.IP) (string, error)
GetEgressIPNetwork attempts to retrieve a network that contains EgressIP. Check the OVN network first as represented by parameter eIPConfig, and if no match is found, and if not in a cloud environment, check secondary host networks.
func GetEligibleEndpointAddressesFromSlices ¶
func GetEligibleEndpointAddressesFromSlices(endpointSlices []*discovery.EndpointSlice, service *kapi.Service) []string
GetEligibleEndpointAddressesFromSlices returns a list of IP addresses of all eligible endpoints from the given endpoint slices.
func GetExec ¶
GetExec returns the exec interface which can be used for running commands directly. Only use for passing an exec interface into pkg/config which cannot call this function directly because this module imports pkg/config already.
func GetExternalAndLBIPs ¶
GetExternalAndLBIPs returns an array with the ExternalIPs and LoadBalancer IPs present in the service
func GetExternalIDValByKey ¶
GetExternalIDValByKey returns the value of the specified key in a space separated string (each in the form of k=v)
func GetFilteredInterfaceAddrs ¶
GetFilteredInterfaceAddrs returns addresses attached to a link and filters out link local addresses, OVN reserved IPs, keepalived IPs and addresses marked as secondary or deprecated.
func GetFilteredInterfaceV4V6IPs ¶
GetFilteredInterfaceV4V6IPs returns the IP addresses for the network interface 'iface' for ipv4 and ipv6. Filter out addresses that are link local, reserved for internal use or added by keepalived.
func GetFunctionRepresentorName ¶
GetFunctionRepresentorName returns representor name for passed device ID. Supported devices are Virtual Function or Scalable Function
func GetGatewayRouterFromNode ¶
GetGatewayRouterFromNode determines a node's corresponding gateway router name
func GetHybridOverlayPortName ¶
GetHybridOverlayPortName returns the name of the hybrid overlay switch port for a given node
func GetIFNameAndMTUForAddress ¶
GetIFNameAndMTUForAddress returns the interfaceName and MTU for the given network address
func GetIPFamily ¶
func GetIPFullMask ¶
GetIPFullMask returns a full IPv4 IPMask if ip is IPV4 family or a full IPv6 IPMask otherwise
func GetIPFullMaskString ¶
GetIPFullMaskString returns /32 if ip is IPV4 family and /128 if ip is IPV6 family
func GetIPNetFullMask ¶
GetIPNetFullMask returns an IPNet object for IPV4 or IPV6 address with a full subnet mask
func GetIPv6OnSubnet ¶
GetIPv6OnSubnet when given an IPv6 address with a 128 prefix for an interface, looks for possible broadest subnet on-link routes and returns the same address with the found subnet prefix. Otherwise it returns the provided address unchanged.
func GetIfaceId ¶
func GetK8sPodAllNetworkSelections ¶
func GetK8sPodAllNetworkSelections(pod *v1.Pod) ([]*nadapi.NetworkSelectionElement, error)
GetK8sPodAllNetworkSelections get pod's all network NetworkSelectionElement from k8s.v1.cni.cncf.io/networks annotation
func GetK8sPodDefaultNetworkSelection ¶
func GetK8sPodDefaultNetworkSelection(pod *v1.Pod) (*nadapi.NetworkSelectionElement, error)
GetK8sPodDefaultNetworkSelection get pod default network from annotations
func GetLegacyK8sMgmtIntfName ¶
GetLegacyK8sMgmtIntfName returns legacy management ovs-port name
func GetLocalEligibleEndpointAddressesFromSlices ¶
func GetLocalEligibleEndpointAddressesFromSlices(endpointSlices []*discovery.EndpointSlice, service *kapi.Service, nodeName string) sets.Set[string]
GetLocalEligibleEndpointAddressesFromSlices returns a set of IP addresses of endpoints that are local to the specified node and are eligible.
func GetLogicalPortName ¶
func GetMACAddressFromARP ¶
func GetMACAddressFromARP(neighIP net.IP) (net.HardwareAddr, error)
func GetNADName ¶
GetNADName returns key of NetAttachDefInfo.NetAttachDefs map, also used as Pod annotation key
func GetNetdevNameFromDeviceId ¶
func GetNetdevNameFromDeviceId(deviceId string, deviceInfo nadapi.DeviceInfo) (string, error)
GetNetdevNameFromDeviceId returns the netdevice name from the passed device ID.
func GetNicName ¶
GetNicName returns the physical NIC name, given an OVS bridge name configured by NicToBridge()
func GetNodeAddresses ¶
func GetNodeAddresses(ipv4, ipv6 bool, nodes ...*v1.Node) (ipsv4 []net.IP, ipsv6 []net.IP, err error)
GetNodeAddresses returns all of the node's IPv4 and/or IPv6 annotated addresses as requested. Note that nodes not annotated will be ignored.
func GetNodeChassisID ¶
GetNodeChassisID returns the machine's OVN chassis ID
func GetNodeEgressLabel ¶
func GetNodeEgressLabel() string
GetNodeEgressLabel returns label annotation needed for marking nodes as egress assignable
func GetNodeGatewayIfAddr ¶
GetNodeGatewayIfAddr returns the node logical switch gateway address (the ".1" address), return nil if the subnet is invalid
func GetNodeHostAddrs ¶
GetNodeHostAddrs returns the parsed Host CIDR annotation of the given node as an array of strings. If the annotation is not set, then we return empty list.
func GetNodeHybridOverlayIfAddr ¶
GetNodeHybridOverlayIfAddr returns the node logical switch hybrid overlay port address (the ".3" address), return nil if the subnet is invalid
func GetNodeID ¶
GetNodeID returns the id of the node set in the 'ovnNodeID' node annotation. Returns InvalidNodeID (-1) if the 'ovnNodeID' node annotation is not set or if the value is not an integer value.
func GetNodeInternalAddrs ¶
GetNodeInternalAddrs returns the first IPv4 and/or IPv6 InternalIP defined for the node. On certain cloud providers (AWS) the egress IP will be added to the list of node IPs as an InternalIP address, we don't want to create the default allow logical router policies for that IP. Node IPs are ordered, meaning the egress IP will never be first in this list.
func GetNodeManagementIfAddr ¶
GetNodeManagementIfAddr returns the node logical switch management port address (the ".2" address), return nil if the subnet is invalid
func GetNodeNetworkIDsAnnotationNetworkIDs ¶
GetNodeNetworkIDsAnnotationNetworkIDs parses the "k8s.ovn.org/network-ids" annotation on a node and returns the map of network name and ids.
func GetNodePrimaryIP ¶
GetNodePrimaryIP extracts the primary IP address from the node status in the API
func GetNodeSubnetAnnotationNetworkNames ¶
GetNodeSubnetAnnotationNetworkNames parses the "k8s.ovn.org/node-subnets" annotation on a node and returns the list of network names set.
func GetNodeZone ¶
GetNodeZone returns the zone of the node set in the 'ovnNodeZoneName' node annotation. If the annotation is not set, it returns the 'default' zone name.
func GetOFFlows ¶
GetOFFlows gets all the flows from a bridge
func GetOVSOfPort ¶
GetOVSOfPort runs get ofport via ovs-vsctl and handle special return strings.
func GetOVSPortMACAddress ¶
func GetOVSPortMACAddress(portName string) (net.HardwareAddr, error)
GetOVSPortMACAddress returns the MAC address of a given OVS port
func GetOVSPortPodInfo ¶
GetOVSPortPodInfo gets OVS interface associated pod information (sandbox/NAD), returns false if the OVS interface does not exists
func GetOpenFlowPorts ¶
GetOpenFlowPorts names or numbers for a given bridge
func GetOvsDBServerPID ¶
GetOvsDBServerPID retrieves the Process IDentifier for ovs-vswitchd daemon.
func GetOvsVSwitchdPID ¶
GetOvsVSwitchdPID retrieves the Process IDentifier for ovs-vswitchd daemon.
func GetPodCIDRsWithFullMask ¶
GetPodCIDRsWithFullMask returns the pod's IP addresses in a CIDR with FullMask format Internally it calls GetPodIPsOfNetwork
func GetPodIPsOfNetwork ¶
GetPodIPsOfNetwork returns the pod's IP addresses, first from the OVN annotation and then falling back to the Pod Status IPs. This function is intended to also return IPs for HostNetwork and other non-OVN-IPAM-ed pods.
func GetPodNADToNetworkMapping ¶
func GetPodNADToNetworkMapping(pod *kapi.Pod, nInfo NetInfo) (bool, map[string]*nettypes.NetworkSelectionElement, error)
GetPodNADToNetworkMapping sees if the given pod needs to plumb over this given network specified by netconf, and return the matching NetworkSelectionElement if any exists.
Return value:
bool: if this Pod is on this Network; true or false map[string]*nettypes.NetworkSelectionElement: all NetworkSelectionElement that pod is requested for the specified network, key is NADName. Note multiple NADs of the same network are allowed on one pod, as long as they are of different NADName. error: error in case of failure
func GetSecondaryHostNetworkContainingIP ¶
GetSecondaryHostNetworkContainingIP attempts to find a secondary host network to host the argument IP and includes only global unicast addresses.
func GetSecondaryNetworkPrefix ¶
GetSecondaryNetworkPrefix gets the string used as prefix of the logical entities of the secondary network of the given network name, in the form of <netName>_.
Note that for port_group and address_set, it does not allow the '-' character, which will be replaced with ".". Also replace "/" in the nadName with "."
func GetWorkerFromGatewayRouter ¶
GetWorkerFromGatewayRouter determines a node's corresponding worker switch name from a gateway router name
func HWAddrToIPv6LLA ¶
func HWAddrToIPv6LLA(hwaddr net.HardwareAddr) net.IP
HWAddrToIPv6LLA generates the IPv6 link local address from the given hwaddr, with prefix 'fe80:/64'.
func HasLocalHostNetworkEndpoints ¶
func HasLocalHostNetworkEndpoints(localEndpointAddresses sets.Set[string], nodeAddresses []net.IP) bool
HasLocalHostNetworkEndpoints returns true if any of the nodeAddresses appear in given the set of localEndpointAddresses. This is useful to check whether any of the provided local endpoints are host-networked.
func HasNodeMigratedZone ¶
HasNodeMigratedZone returns true if node has its ovnNodeMigratedZoneName set already
func HashForOVN ¶
HashforOVN hashes the provided input to make it a valid addressSet or portGroup name.
func IPAddrToHWAddr ¶
func IPAddrToHWAddr(ip net.IP) net.HardwareAddr
IPAddrToHWAddr takes the four octets of IPv4 address (aa.bb.cc.dd, for example) and uses them in creating a MAC address (0A:58:AA:BB:CC:DD). For IPv6, create a hash from the IPv6 string and use that for MAC Address. Assumption: the caller will ensure that an empty net.IP{} will NOT be passed.
func IPFamilyName ¶
IPFamilyName returns IP Family string based on input flag.
func IPNetsIPToStringSlice ¶
func IPsToNetworkIPs ¶
IPsToNetworkIPs returns the network CIDRs of the provided IP CIDRs
func IsAddressAddedByKeepAlived ¶
IsAddressAddedByKeepAlived returns true if the input interface address obtained through netlink has a "vip" label which is how keepalived marks the IP addresses it adds (https://github.com/openshift/machine-config-operator/pull/4040) A previous implementation made the label end with ":vip", so for backwards compatibility "HasSuffix" is used.
func IsAnnotationAlreadySetError ¶
IsAnnotationAlreadySetError returns true if the error indicates that an annotation is already set
func IsAnnotationNotSetError ¶
IsAnnotationNotSetError returns true if the error indicates that an annotation is not set
func IsAuxDeviceName ¶
IsAuxDeviceName check if passed device id is a Auxiliary device name
func IsClusterIP ¶
IsClusterIP checks if the provided IP is a clusterIP
func IsClusterIPSet ¶
IsClusterIPSet checks if the service is an headless service or not
func IsContainedInAnyCIDR ¶
IsContainedInAnyCIDR returns true if ipnet is contained in any of ipnets
func IsDNSNameResolverEnabled ¶
func IsDNSNameResolverEnabled() bool
IsDNSNameResolverEnabled retuns true if both EgressFirewall and DNSNameResolver are enabled.
func IsDeprecatedAddr ¶
IsDeprecatedAddr returns true if the address is deprecated. An address is deprecated when preferred lifetime is zero.
func IsEndpointReady ¶
IsEndpointReady takes as input an endpoint from an endpoint slice and returns true if the endpoint is to be considered ready. Considering as ready an endpoint with Conditions.Ready==nil as per doc: "In most cases consumers should interpret this unknown state as ready" https://github.com/kubernetes/api/blob/0478a3e95231398d8b380dc2a1905972be8ae1d5/discovery/v1/types.go#L129-L131
func IsEndpointServing ¶
IsEndpointServing takes as input an endpoint from an endpoint slice and returns true if the endpoint is to be considered serving. Falling back to IsEndpointReady when Serving field is nil, as per doc: "If nil, consumers should defer to the ready condition. https://github.com/kubernetes/api/blob/0478a3e95231398d8b380dc2a1905972be8ae1d5/discovery/v1/types.go#L138-L139
func IsEndpointTerminating ¶
func IsHostEndpoint ¶
isHostEndpoint determines if the given endpoint ip belongs to a host networked pod
func IsIPNetEqual ¶
IsIPNetEqual returns true if both IPNet are equal
func IsMultiNetworkPoliciesSupportEnabled ¶
func IsMultiNetworkPoliciesSupportEnabled() bool
func IsNilOrAnyNetwork ¶
IsNilOrAnyNetwork checks if the argument network is nil or an any network for ipv4 or ipv6.
func IsNodeHybridOverlayIfAddr ¶
IsNodeHybridOverlayIfAddr returns whether the provided IP is a node hybrid overlay address on any of the provided subnets
func IsNodeSecondaryHostEgressIPsAnnotationSet ¶
IsNodeSecondaryHostEgressIPsAnnotationSet returns true if an annotation that tracks assigned of egress IPs to interfaces OVN doesn't manage is set
func IsOVNNetwork ¶
func IsOVNNetwork(eIPConfig *ParsedNodeEgressIPConfiguration, ip net.IP) bool
IsOVNNetwork attempts to detect if the argument IP can be hosted by a network managed by OVN. Currently, this is only the primary OVN network
func IsOvsHwOffloadEnabled ¶
IsOvsHwOffloadEnabled checks if OvS Hardware Offload is enabled.
func IsPCIDeviceName ¶
IsPCIDeviceName check if passed device id is a PCI device name
func IsSecondaryHostNetworkContainingIP ¶
IsSecondaryHostNetworkContainingIP attempts to find a secondary host network that will host the argument IP. If no network is found, false is returned
func IsValidPodAnnotation ¶
func IsValidPodAnnotation(podAnnotation *PodAnnotation) bool
IsValidPodAnnotation tests whether the PodAnnotation is valid, currently true for any PodAnnotation with a MAC which is the only thing required to attach a pod.
func IsWildcard ¶
IsWildcard checks if the domain name is wildcard.
func JoinHostPortInt32 ¶
JoinHostPortInt32 is like net.JoinHostPort(), but with an int32 for the port
func JoinIPNetIPs ¶
JoinIPNetIPs joins the string forms of an array of *net.IPNet, as with strings.Join, but does not include the IP mask.
func JoinIPNets ¶
JoinIPNets joins the string forms of an array of *net.IPNet, as with strings.Join
func LinkAddrAdd ¶
func LinkAddrAdd(link netlink.Link, address *net.IPNet, flags, preferredLifetime, validLifetime int) error
LinkAddrAdd adds a new address. If both preferredLifetime & validLifetime, are zero, then they are not applied, but if either parameters are not zero, both are applied.
func LinkAddrDel ¶
LinkAddrDel removes an existing address from a link. Expects address is present otherwise, an error is returned.
func LinkAddrExist ¶
LinkAddrExist returns true if the given address is present on the link
func LinkAddrFlush ¶
LinkAddrFlush flushes all the addresses on the given link, except IPv6 link-local addresses
func LinkNeighAdd ¶
LinkNeighAdd adds MAC/IP bindings for the given link
func LinkNeighDel ¶
LinkNeighDel deletes an ip binding for a given link
func LinkNeighExists ¶
LinkNeighExists checks to see if the given MAC/IP bindings exists
func LinkNeighIPExists ¶
LinkNeighIPExists checks to see if the IP exists in IP neighbour cache
func LinkRouteExists ¶
LinkRouteExists checks for existence of routes for the given subnet through gwIPStr
func LinkRouteGetFilteredRoute ¶
func LinkRouteGetFilteredRoute(routeFilter *netlink.Route, filterMask uint64) (*netlink.Route, error)
LinkRouteGetFilteredRoute gets a route for the given route filter. returns nil if route is not found
func LinkRoutesAdd ¶
LinkRoutesAdd adds a new route for given subnets through the gwIPstr
func LinkRoutesDel ¶
LinkRoutesDel deletes all the routes for the given subnets via the link if subnets is empty, then all routes will be removed for a link if any item in subnets is nil the default route will be removed
func LowerCaseFQDN ¶
LowerCaseFQDN convert the DNS name to lower case fully qualified domain name.
func MarshalPodAnnotation ¶
func MarshalPodAnnotation(annotations map[string]string, podInfo *PodAnnotation, nadName string) (map[string]string, error)
MarshalPodAnnotation adds the pod's network details of the specified network to the corresponding pod annotation.
func MarshalPodDPUConnDetails ¶
func MarshalPodDPUConnDetails(annotations map[string]string, dcd *DPUConnectionDetails, nadName string) (map[string]string, error)
MarshalPodDPUConnDetails adds the pod's connection details of the specified NAD to the corresponding pod annotation; if dcd is nil, delete the pod's connection details of the specified NAD
func MarshalPodDPUConnStatus ¶
func MarshalPodDPUConnStatus(annotations map[string]string, scs *DPUConnectionStatus, nadName string) (map[string]string, error)
MarshalPodDPUConnStatus adds the pod's connection status of the specified NAD to the corresponding pod annotation. if scs is nil, delete the pod's connection status of the specified NAD
func MatchAllIPNetFamily ¶
MatchAllIPNetFamily loops through the array of *net.IPNet and returns a slice of ipnets with the same IP Family, based on input flag isIPv6.
func MatchAllIPStringFamily ¶
MatchAllIPStringFamily loops through the array of string and returns a slice of addresses in the same IP Family, based on input flag isIPv6.
func MatchFirstIPFamily ¶
MatchFirstIPFamily loops through the array of net.IP and returns the first entry in the list in the same IP Family, based on input flag isIPv6.
func MatchFirstIPNetFamily ¶
MatchFirstIPNetFamily loops through the array of ipnets and returns the first entry in the list in the same IP Family, based on input flag isIPv6.
func MatchIPFamily ¶
MatchIPFamily loops through the array of net.IP and returns a slice of addresses in the same IP Family, based on input flag isIPv6.
func MatchIPStringFamily ¶
MatchIPStringFamily loops through the array of string and returns the first entry in the list in the same IP Family, based on input flag isIPv6.
func NewKubernetesClientset ¶
func NewKubernetesClientset(conf *config.KubernetesConfig) (*kubernetes.Clientset, error)
NewKubernetesClientset creates a Kubernetes clientset from a KubernetesConfig
func NewNamespace ¶
func NewObjectMeta ¶
func NewObjectMeta(name, namespace string) metav1.ObjectMeta
func NewObjectMetaWithLabels ¶
func NewObjectMetaWithLabels(name, namespace string, labels map[string]string) metav1.ObjectMeta
func NicToBridge ¶
NicToBridge creates a OVS bridge for the 'iface' and also moves the IP address and routes of 'iface' to OVS bridge.
func NoHostSubnet ¶
NoHostSubnet() compares the no-hostsubnet-nodes flag with node labels to see if the node is managing its own network.
func NodeIDAnnotationChanged ¶
NodeIDAnnotationChanged returns true if the ovnNodeID in the corev1.Nodes doesn't match
func NodeMigratedZoneAnnotationChanged ¶
NodeMigratedZoneAnnotationChanged returns true if the ovnNodeMigratedZoneName annotation changed for the node
func NodeNetworkIDAnnotationChanged ¶
NodeNetworkIDAnnotationChanged returns true if the ovnNetworkIDs annotation in the corev1.Nodes doesn't match
func NodeZoneAnnotationChanged ¶
NodeZoneAnnotationChanged returns true if the ovnNodeZoneName in the corev1.Nodes doesn't match
func ParseIPNets ¶
ParseIPNets parses the provided string formatted CIDRs
func ParseNetConf ¶
func ParseNetConf(netattachdef *nettypes.NetworkAttachmentDefinition) (*ovncnitypes.NetConf, error)
ParseNetConf parses config in NAD spec for secondary networks
func ParseNetworkIDAnnotation ¶
ParseNetworkIDAnnotation parses the 'ovnNetworkIDs' annotation for the specified network in 'netName' and returns the network id.
func ParseNodeChassisIDAnnotation ¶
ParseNodeChassisIDAnnotation returns the node's ovnNodeChassisID annotation
func ParseNodeGatewayMTUSupport ¶
ParseNodeGatewayMTUSupport parses annotation "k8s.ovn.org/gateway-mtu-support". The default behavior should be true, therefore only an explicit string of "false" will make this function return false.
func ParseNodeGatewayRouterLRPAddr ¶
ParseNodeGatewayRouterLRPAddr returns the IPv4 / IPv6 values for the node's gateway router
func ParseNodeGatewayRouterLRPAddrs ¶
ParseNodeGatewayRouterLRPAddrs returns the IPv4 and/or IPv6 addresses for the node's gateway router port stored in the 'ovnNodeGRLRPAddr' annotation
func ParseNodeHostCIDRs ¶
ParseNodeHostCIDRs returns the parsed host CIDRS living on a node
func ParseNodeHostCIDRsDropNetMask ¶
ParseNodeHostCIDRsDropNetMask returns the parsed host IP addresses found on a node's host CIDR annotation. Removes the mask.
func ParseNodeHostSubnetAnnotation ¶
ParseNodeHostSubnetAnnotation parses the "k8s.ovn.org/node-subnets" annotation on a node and returns the host subnet for the given network.
func ParseNodeManagementPortAnnotation ¶
ParseNodeManagementPortAnnotation returns the parsed host addresses living on a node
func ParseNodeManagementPortMACAddress ¶
func ParseNodeManagementPortMACAddress(node *kapi.Node) (net.HardwareAddr, error)
func ParseNodeSecondaryHostEgressIPsAnnotation ¶
ParseNodeSecondaryHostEgressIPsAnnotation returns secondary host egress IPs addresses for a node
func ParseNodeTransitSwitchPortAddrs ¶
ParseNodeTransitSwitchPortAddrs returns the IPv4 and/or IPv6 addresses for the node's transit switch port stored in the 'ovnTransitSwitchPortAddr' annotation
func ParseNodesHostSubnetAnnotation ¶
ParseNodesHostSubnetAnnotation parses parses the "k8s.ovn.org/node-subnets" annotation for all the provided nodes
func PlatformTypeIsEgressIPCloudProvider ¶
func PlatformTypeIsEgressIPCloudProvider() bool
func PodCompleted ¶
PodCompleted checks if the pod is marked as completed (in a terminal state)
func PodNeedsSNAT ¶
PodNeedsSNAT returns true if the given pod is eligible to setup snat entry in ovn for its egress traffic outside cluster, otherwise returns false.
func PodRunning ¶
PodRunning checks if the pod is in running state or not
func PodScheduled ¶
PodScheduled returns if the given pod is scheduled
func PodTerminating ¶
PodTerminating checks if the pod has been deleted via API but still in the process of terminating
func PodWantsHostNetwork ¶
PodWantsHostNetwork returns if the given pod is hostNetworked or not to determine if networking needs to be setup
func PrepareTestConfig ¶
func PrepareTestConfig()
PrepareTestConfig restores default config values. Used by testcases to provide a pristine environment between tests.
func RemoveIndexFromSliceUnstable ¶
func RemoveIndexFromSliceUnstable[T comparable](slice []T, i int) []T
RemoveIndexFromSliceUnstable attempts to remove slice index specified by parameter i. Slice order is not preserved.
func RemoveItemFromSliceUnstable ¶
func RemoveItemFromSliceUnstable[T comparable](slice []T, candidate T) []T
RemoveItemFromSliceUnstable attempts to remove an item from a slice specified by parameter candidate. Slice order is not preserved.
func ReplaceOFFlows ¶
ReplaceOFFlows replaces flows in the bridge with a slice of flows
func ResetNetLinkOpMockInst ¶
func ResetNetLinkOpMockInst()
ResetNetLinkOpMockInst resets the mock instance for netlink to the defaultNetLinkOps
func ResetRunner ¶
func ResetRunner()
ResetRunner used by unit-tests to reset runner to its initial (un-initialized) value
func RunOVNAppctlWithTimeout ¶
RunOVNAppctlWithTimeout runs a command via ovn-appctl. If ovn-appctl is not present, then it falls back to using ovs-appctl.
func RunOVNControllerAppCtl ¶
RunOVNControllerAppCtl runs an 'ovs-appctl -t ovn-controller.pid.ctl command'.
func RunOVNNBAppCtl ¶
RunOVNNBAppCtl runs an 'ovn-appctl -t nbdbCtlFileName command'.
func RunOVNNBAppCtlWithTimeout ¶
RunOVNNBAppCtlWithTimeout runs an ovn-appctl command with a timeout to nbdb
func RunOVNNbctl ¶
RunOVNNbctl runs a command via ovn-nbctl. FIXME: Remove when https://github.com/ovn-org/libovsdb/issues/235 is fixed
func RunOVNNbctlRawOutput ¶
RunOVNNbctlRawOutput returns the output with no trimming or other string manipulation FIXME: Remove when https://github.com/ovn-org/libovsdb/issues/235 is fixed
func RunOVNNbctlWithTimeout ¶
RunOVNNbctlWithTimeout runs command via ovn-nbctl with a specific timeout FIXME: Remove when https://github.com/ovn-org/libovsdb/issues/235 is fixed
func RunOVNNorthAppCtl ¶
RunOVNNorthAppCtl runs an 'ovs-appctl -t ovn-northd command'. TODO: Currently no module is invoking this function, will need to consider adding an unit test when actively used
func RunOVNSBAppCtl ¶
RunOVNSBAppCtl runs an 'ovn-appctl -t sbdbCtlFileName command'.
func RunOVNSBAppCtlWithTimeout ¶
RunOVNSBAppCtlWithTimeout runs an ovn-appctl command with a timeout to sbdb
func RunOVNSbctl ¶
RunOVNSbctl runs a command via ovn-sbctl. FIXME: Remove when https://github.com/ovn-org/libovsdb/issues/235 is fixed
func RunOVNSbctlWithTimeout ¶
RunOVNSbctlWithTimeout runs command via ovn-sbctl with a specific timeout FIXME: Remove when https://github.com/ovn-org/libovsdb/issues/235 is fixed
func RunOVSAppctl ¶
RunOVSAppctl runs a command via ovs-appctl.
func RunOVSAppctlWithTimeout ¶
RunOVSAppctlWithTimeout runs a command via ovs-appctl.
func RunOVSDBClient ¶
RunOVSDBClient runs an 'ovsdb-client [OPTIONS] COMMAND [ARG...] command'.
func RunOVSDBClientOVNNB ¶
RunOVSDBClientOVN runs an 'ovsdb-client [OPTIONS] COMMAND [SERVER] [ARG...] command' against OVN NB database.
func RunOVSDBTool ¶
RunOVSDBTool runs an 'ovsdb-tool [OPTIONS] COMMAND [ARG...] command'.
func RunOVSOfctl ¶
RunOVSOfctl runs a command via ovs-ofctl.
func RunOVSVsctl ¶
RunOVSVsctl runs a command via ovs-vsctl.
func RunOvsVswitchdAppCtl ¶
RunOvsVswitchdAppCtl runs an 'ovs-appctl -t /var/run/openvsiwthc/ovs-vswitchd.pid.ctl command'
func RunPowershell ¶
RunPowershell runs a command via the Windows powershell utility
func SecondaryNetworkPodIPs ¶
func ServiceNamespacedNameFromEndpointSlice ¶
func ServiceNamespacedNameFromEndpointSlice(endpointSlice *discovery.EndpointSlice) (k8stypes.NamespacedName, error)
ServiceNamespacedNameFromEndpointSlice returns the namespaced name of the service that corresponds to the given endpointSlice
func ServiceTypeHasClusterIP ¶
ServiceTypeHasClusterIP checks if the service has an associated ClusterIP or not
func ServiceTypeHasLoadBalancer ¶
ServiceTypeHasLoadBalancer checks if the service has an associated LoadBalancer or not
func ServiceTypeHasNodePort ¶
ServiceTypeHasNodePort checks if the service has an associated NodePort or not
func SetARPTimeout ¶
func SetARPTimeout()
func SetDNSLibOpsMockInst ¶
func SetDNSLibOpsMockInst(mockInst DNSOps)
func SetExec ¶
SetExec validates executable paths and saves the given exec interface to be used for running various OVS and OVN utilites
func SetExecWithoutOVS ¶
SetExecWithoutOVS validates executable paths excluding OVS/OVN binaries and saves the given exec interface to be used for running various utilites
func SetFakeIPTablesHelpers ¶
func SetFakeIPTablesHelpers() (IPTablesHelper, IPTablesHelper)
SetFakeIPTablesHelpers populates `helpers` with FakeIPTablesHelper that can be used in unit tests
func SetFileSystemOps ¶
func SetFileSystemOps(mockInst FileSystemOps)
func SetGatewayMTUSupport ¶
SetGatewayMTUSupport sets annotation "k8s.ovn.org/gateway-mtu-support" to "false" or removes the annotation from this node.
func SetIPTablesHelper ¶
func SetIPTablesHelper(proto iptables.Protocol, ipt IPTablesHelper)
SetIPTablesHelper sets the IPTablesHelper to be used
func SetL3GatewayConfig ¶
func SetL3GatewayConfig(nodeAnnotator kube.Annotator, cfg *L3GatewayConfig) error
func SetNetLinkOpMockInst ¶
func SetNetLinkOpMockInst(mockInst NetLinkOps)
SetNetLinkOpMockInst method would be used by unit tests in other packages
func SetNodeHostCIDRs ¶
func SetNodeHostSubnetAnnotation ¶
SetNodeHostSubnetAnnotation sets a "k8s.ovn.org/node-subnets" annotation using a kube.Annotator
func SetNodeManagementPortMACAddress ¶
func SetNodeManagementPortMACAddress(nodeAnnotator kube.Annotator, macAddress net.HardwareAddr) error
func SetNodePrimaryIfAddrs ¶
SetNodePrimaryIfAddr sets the IPv4 / IPv6 values of the node's primary network interface
func SetNodeZone ¶
SetNodeZone sets the node's zone in the 'ovnNodeZoneName' node annotation.
func SetNodeZoneMigrated ¶
* HACK BEGIN * TODO(tssurya): Remove this a few months from now SetNodeZoneMigrated sets the node's zone in the 'ovnNodeMigratedZoneName' node annotation.
func SetSpecificExec ¶
SetSpecificExec validates executable paths for selected commands. It also saves the given exec interface to be used for running selected commands
func SetSriovnetOpsInst ¶
func SetSriovnetOpsInst(mockInst SriovnetOps)
SetSriovnetOpsInst method would be used by unit tests in other packages
func SetVdpaOpsInst ¶
func SetVdpaOpsInst(mockInst VdpaOps)
SetVdpaOpsInst method should be used by unit tests in
func SliceHasStringItem ¶
func SplitHostPortInt32 ¶
SplitHostPortInt32 splits a vip into its host and port counterparts
func StartNodeCertificateManager ¶
func StartNodeCertificateManager(ctx context.Context, wg *sync.WaitGroup, nodeName string, conf *config.KubernetesConfig) error
StartNodeCertificateManager manages the creation and rotation of the node-specific client certificate. When there is no existing certificate, it will use the BootstrapKubeconfig kubeconfig to create a CSR and it will wait for the certificate before returning.
func StringSlice ¶
StringSlice converts to a slice of the string representation of the input items
func SyncConntrackForExternalGateways ¶
func SyncConntrackForExternalGateways(gwIPsToKeep sets.Set[string], isPodInLocalZone func(pod *kapi.Pod) (bool, error), podsGetter func() ([]*kapi.Pod, error)) error
SyncConntrackForExternalGateways removes stale conntrack entries for pods returned by podsGetter. To do so, it resolves all given gwIPsToKeep MAC addresses that are used as labels by ecmp conntrack flows. Conntrack flows with MAC labels that do not belong to any of gwIPsToKeep are removed.
func UnmarshalPodDPUConnDetailsAllNetworks ¶
func UnmarshalPodDPUConnDetailsAllNetworks(annotations map[string]string) (map[string]DPUConnectionDetails, error)
UnmarshalPodDPUConnDetailsAllNetworks returns the DPUConnectionDetails map of all networks from the given Pod annotation
func UnmarshalPodDPUConnStatusAllNetworks ¶
func UnmarshalPodDPUConnStatusAllNetworks(annotations map[string]string) (map[string]DPUConnectionStatus, error)
UnmarshalPodDPUConnStatusAllNetworks returns the DPUConnectionStatus map of all networks from the given Pod annotation
func UpdateIPsSlice ¶
UpdateIPsSlice will search for values of oldIPs in the slice "s" and update it with newIPs values of same IP family
func UpdateNetworkIDAnnotation ¶
func UpdateNetworkIDAnnotation(annotations map[string]string, netName string, networkID int) (map[string]string, error)
UpdateNetworkIDAnnotation updates the ovnNetworkIDs annotation for the network name 'netName' with the network id 'networkID'. If 'networkID' is invalid network ID (-1), then it deletes that network from the network ids annotation.
func UpdateNodeHostSubnetAnnotation ¶
func UpdateNodeHostSubnetAnnotation(annotations map[string]string, hostSubnets []*net.IPNet, netName string) (map[string]string, error)
UpdateNodeHostSubnetAnnotation updates a "k8s.ovn.org/node-subnets" annotation for network "netName", with the specified network, suitable for passing to kube.SetAnnotationsOnNode. If hostSubnets is empty, it deleted the "k8s.ovn.org/node-subnets" annotation for network "netName"
func UpdateNodeIDAnnotation ¶
UpdateNodeIDAnnotation updates the ovnNodeID annotation with the node id in the annotations map and returns it.
func UpdatePodAnnotationWithRetry ¶
func UpdatePodAnnotationWithRetry(podLister listers.PodLister, kube kube.Interface, pod *v1.Pod, podAnnotation *PodAnnotation, nadName string) error
UpdatePodAnnotationWithRetry updates the pod annotation on the pod retrying on conflict
func UpdatePodDPUConnDetailsWithRetry ¶
func UpdatePodDPUConnDetailsWithRetry(podLister listers.PodLister, kube kube.Interface, pod *v1.Pod, dpuConnDetails *DPUConnectionDetails, nadName string) error
UpdatePodDPUConnDetailsWithRetry updates the DPU connection details annotation on the pod retrying on conflict
func UpdatePodDPUConnStatusWithRetry ¶
func UpdatePodDPUConnStatusWithRetry(podLister listers.PodLister, kube kube.Interface, pod *v1.Pod, dpuConnStatus *DPUConnectionStatus, nadName string) error
UpdatePodDPUConnStatusWithRetry updates the DPU connection status annotation on the pod retrying on conflict
func UpdatePodWithRetryOrRollback ¶
func UpdatePodWithRetryOrRollback(podLister listers.PodLister, kube kube.Interface, pod *v1.Pod, allocate AllocateToPodWithRollbackFunc) error
UpdatePodWithRetryOrRollback updates the pod with the result of the allocate function. If the pod update fails, it applies the rollback provided by the allocate function.
func UseEndpointSlices ¶
func UseEndpointSlices(kubeClient kubernetes.Interface) bool
UseEndpointSlices detect if Endpoints Slices are enabled in the cluster
func ValidateAndGetEgressFirewallDestination ¶
func ValidateAndGetEgressFirewallDestination(egressFirewallDestination egressfirewallapi.EgressFirewallDestination) ( cidrSelector string, dnsName string, clusterSubnetIntersection bool, nodeSelector *metav1.LabelSelector, err error)
ValidateAndGetEgressFirewallDestination validates an egress firewall rule destination and returns the parsed contents of the destination.
func ValidatePort ¶
ValidatePort checks if the port is non-zero and port protocol is valid
func ValidateProtocol ¶
ValidateProtocol checks if the protocol is a valid kapi.Protocol type (TCP, UDP, or SCTP) or returns an error
func WaitForHandlerSyncWithTimeout ¶
func WaitForHandlerSyncWithTimeout(controllerName string, stopCh <-chan struct{}, timeout time.Duration, handlerSyncs ...cache.InformerSynced) bool
WaitForHandlerSyncWithTimeout waits for the provided handlers to do a sync on all existing objects for the resource types they're watching. This corresponds to adding all existing objects. If that doesn't happen before the provided timeout, WaitForInformerCacheSyncWithTimeout times out and returns false.
func WaitForInformerCacheSyncWithTimeout ¶
func WaitForInformerCacheSyncWithTimeout(controllerName string, stopCh <-chan struct{}, cacheSyncs ...cache.InformerSynced) bool
WaitForInformerCacheSyncWithTimeout waits for the provided informer caches to be populated with all existing objects by their respective informer. This corresponds to a LIST operation on the corresponding resource types. WaitForInformerCacheSyncWithTimeout times out and returns false if the provided caches haven't all synchronized within types.InformerSyncTimeout
Types ¶
type AllocateToPodWithRollbackFunc ¶
AllocateToPodWithRollbackFunc is a function used to allocate a resource to a pod that depends on the current state of the pod, and possibly updating it. To be used with UpdatePodWithAllocationOrRollback. Implementations can return a nil pod if no update is warranted. Implementations can also return a rollback function that will be invoked if the pod update fails.
type BasicNetInfo ¶
type BasicNetInfo interface { // basic network information GetNetworkName() string IsSecondary() bool TopologyType() string MTU() int IPMode() (bool, bool) Subnets() []config.CIDRNetworkEntry ExcludeSubnets() []*net.IPNet Vlan() uint AllowsPersistentIPs() bool // utility methods CompareNetInfo(BasicNetInfo) bool GetNetworkScopedName(name string) string RemoveNetworkScopeFromName(name string) string }
BasicNetInfo is interface which holds basic network information
type CancelableContext ¶
type CancelableContext struct {
// contains filtered or unexported fields
}
CancelableContext utility wraps a context that can be canceled
func NewCancelableContext ¶
func NewCancelableContext() CancelableContext
func NewCancelableContextChild ¶
func NewCancelableContextChild(ctx CancelableContext) CancelableContext
func (*CancelableContext) Done ¶
func (ctx *CancelableContext) Done() <-chan struct{}
Done returns a channel that is closed when this or any parent context is canceled
type DNSOps ¶
type DNSOps interface { ClientConfigFromFile(resolvconf string) (*dns.ClientConfig, error) Fqdn(s string) string Exchange(c *dns.Client, m *dns.Msg, a string) (r *dns.Msg, rtt time.Duration, err error) SetQuestion(msg *dns.Msg, z string, t uint16) *dns.Msg }
func GetDNSLibOps ¶
func GetDNSLibOps() DNSOps
type DPUConnectionDetails ¶
type DPUConnectionDetails struct { PfId string `json:"pfId"` VfId string `json:"vfId"` SandboxId string `json:"sandboxId"` VfNetdevName string `json:"vfNetdevName,omitempty"` }
func UnmarshalPodDPUConnDetails ¶
func UnmarshalPodDPUConnDetails(annotations map[string]string, nadName string) (*DPUConnectionDetails, error)
UnmarshalPodDPUConnDetails returns dpu connection details for the specified NAD
type DPUConnectionStatus ¶
type DPUConnectionStatus struct { Status string `json:"Status"` Reason string `json:"Reason,omitempty"` }
func UnmarshalPodDPUConnStatus ¶
func UnmarshalPodDPUConnStatus(annotations map[string]string, nadName string) (*DPUConnectionStatus, error)
UnmarshalPodDPUConnStatus returns DPU connection status for the specified NAD
type DefaultNetInfo ¶
type DefaultNetInfo struct{}
func (*DefaultNetInfo) AddNAD ¶
func (nInfo *DefaultNetInfo) AddNAD(nadName string)
AddNAD adds the specified NAD, no op for default network
func (*DefaultNetInfo) AllowsPersistentIPs ¶
func (nInfo *DefaultNetInfo) AllowsPersistentIPs() bool
AllowsPersistentIPs returns the defaultNetConfInfo's AllowPersistentIPs value
func (*DefaultNetInfo) CompareNetInfo ¶
func (nInfo *DefaultNetInfo) CompareNetInfo(netBasicInfo BasicNetInfo) bool
func (*DefaultNetInfo) DeleteNAD ¶
func (nInfo *DefaultNetInfo) DeleteNAD(nadName string)
DeleteNAD deletes the specified NAD, no op for default network
func (*DefaultNetInfo) ExcludeSubnets ¶
func (nInfo *DefaultNetInfo) ExcludeSubnets() []*net.IPNet
ExcludeSubnets returns the defaultNetConfInfo's ExcludeSubnets value
func (*DefaultNetInfo) GetNetworkName ¶
func (nInfo *DefaultNetInfo) GetNetworkName() string
GetNetworkName returns the network name
func (*DefaultNetInfo) GetNetworkScopedName ¶
func (nInfo *DefaultNetInfo) GetNetworkScopedName(name string) string
GetNetworkScopedName returns a network scoped name form the provided one appropriate to use globally.
func (*DefaultNetInfo) HasNAD ¶
func (nInfo *DefaultNetInfo) HasNAD(nadName string) bool
HasNAD returns true if the given NAD exists, already return true for default network
func (*DefaultNetInfo) IPMode ¶
func (nInfo *DefaultNetInfo) IPMode() (bool, bool)
IPMode returns the defaultNetConfInfo's ipv4/ipv6 mode
func (*DefaultNetInfo) IsSecondary ¶
func (nInfo *DefaultNetInfo) IsSecondary() bool
IsSecondary returns if this network is secondary
func (*DefaultNetInfo) MTU ¶
func (nInfo *DefaultNetInfo) MTU() int
MTU returns the defaultNetConfInfo's MTU value
func (*DefaultNetInfo) RemoveNetworkScopeFromName ¶
func (nInfo *DefaultNetInfo) RemoveNetworkScopeFromName(name string) string
func (*DefaultNetInfo) Subnets ¶
func (nInfo *DefaultNetInfo) Subnets() []config.CIDRNetworkEntry
Subnets returns the defaultNetConfInfo's Subnets value
func (*DefaultNetInfo) TopologyType ¶
func (nInfo *DefaultNetInfo) TopologyType() string
TopologyType returns the defaultNetConfInfo's topology type which is empty
func (*DefaultNetInfo) Vlan ¶
func (nInfo *DefaultNetInfo) Vlan() uint
Vlan returns the defaultNetConfInfo's Vlan value
type ExecRunner ¶
type FakeIPTables ¶
FakeIPTables is a mock implementation of go-iptables
func (*FakeIPTables) Append ¶
func (f *FakeIPTables) Append(tableName, chainName string, rulespec ...string) error
Append appends rulespec to specified table/chain
func (*FakeIPTables) ClearChain ¶
func (f *FakeIPTables) ClearChain(tableName, chainName string) error
ClearChain removes all rules in the specified table/chain. If the chain does not exist, a new one will be created
func (*FakeIPTables) Delete ¶
func (f *FakeIPTables) Delete(tableName, chainName string, rulespec ...string) error
Delete removes a rule from the specified table/chain
func (*FakeIPTables) DeleteChain ¶
func (f *FakeIPTables) DeleteChain(tableName, chainName string) error
DeleteChain deletes the chain in the specified table. The chain must be empty
func (*FakeIPTables) Exists ¶
func (f *FakeIPTables) Exists(tableName, chainName string, rulespec ...string) (bool, error)
Exists checks if given rulespec in specified table/chain exists
func (*FakeIPTables) Insert ¶
func (f *FakeIPTables) Insert(tableName, chainName string, pos int, rulespec ...string) error
Insert inserts a rule into the specified table/chain
func (*FakeIPTables) List ¶
func (f *FakeIPTables) List(tableName, chainName string) ([]string, error)
List rules in specified table/chain
func (*FakeIPTables) ListChains ¶
func (f *FakeIPTables) ListChains(tableName string) ([]string, error)
ListChains returns the names of all chains in the table
func (*FakeIPTables) MatchState ¶
func (f *FakeIPTables) MatchState(tables map[string]FakeTable) error
MatchState matches the expected state against the actual rules code under test added to iptables
func (*FakeIPTables) NewChain ¶
func (f *FakeIPTables) NewChain(tableName, chainName string) error
NewChain creates a new chain in the specified table
type FakeTable ¶
FakeTable represents a mock iptables table and can be used for unit tests to verify that the code creates the expected rules
type FileSystemOps ¶
func GetFileSystemOps ¶
func GetFileSystemOps() FileSystemOps
type IPTablesHelper ¶
type IPTablesHelper interface { // List rules in specified table/chain List(table, chain string) ([]string, error) // ListChains returns the names of all chains in the table ListChains(string) ([]string, error) // ClearChain removes all rules in the specified table/chain. // If the chain does not exist, a new one will be created ClearChain(string, string) error // DeleteChain deletes the chain in the specified table. DeleteChain(string, string) error // NewChain creates a new chain in the specified table. // If the chain already exists, it will result in an error. NewChain(string, string) error // Exists checks if given rulespec in specified table/chain exists Exists(string, string, ...string) (bool, error) // Insert inserts a rule into the specified table/chain Insert(string, string, int, ...string) error // Append appends rulespec to specified table/chain Append(string, string, ...string) error // Delete removes rulespec in specified table/chain Delete(string, string, ...string) error // Restore uses iptables-restore to restore rules for multiple chains in a table at once Restore(table string, rulesMap map[string][][]string) error }
IPTablesHelper is an interface that wraps go-iptables to allow mock implementations for unit testing
func GetIPTablesHelper ¶
func GetIPTablesHelper(proto iptables.Protocol) (IPTablesHelper, error)
GetIPTablesHelper returns an IPTablesHelper. If SetIPTablesHelper has not yet been called, it will create a new IPTablesHelper wrapping "live" go-iptables
type L3GatewayConfig ¶
type L3GatewayConfig struct { Mode config.GatewayMode ChassisID string InterfaceID string MACAddress net.HardwareAddr IPAddresses []*net.IPNet EgressGWInterfaceID string EgressGWMACAddress net.HardwareAddr EgressGWIPAddresses []*net.IPNet NextHops []net.IP NodePortEnable bool VLANID *uint }
func ParseNodeL3GatewayAnnotation ¶
func ParseNodeL3GatewayAnnotation(node *kapi.Node) (*L3GatewayConfig, error)
ParseNodeL3GatewayAnnotation returns the parsed l3-gateway-config annotation
func (*L3GatewayConfig) MarshalJSON ¶
func (cfg *L3GatewayConfig) MarshalJSON() ([]byte, error)
func (*L3GatewayConfig) UnmarshalJSON ¶
func (cfg *L3GatewayConfig) UnmarshalJSON(bytes []byte) error
type ManagementPortDetails ¶
type NetInfo ¶
type NetInfo interface { BasicNetInfo AddNAD(nadName string) DeleteNAD(nadName string) HasNAD(nadName string) bool }
NetInfo correlates which NADs refer to a network in addition to the basic network information
func NewNetInfo ¶
func NewNetInfo(netconf *ovncnitypes.NetConf) (NetInfo, error)
func ParseNADInfo ¶
func ParseNADInfo(netattachdef *nettypes.NetworkAttachmentDefinition) (NetInfo, error)
ParseNADInfo parses config in NAD spec and return a NetAttachDefInfo object for secondary networks
type NetLinkOps ¶
type NetLinkOps interface { LinkList() ([]netlink.Link, error) LinkByName(ifaceName string) (netlink.Link, error) LinkByIndex(index int) (netlink.Link, error) LinkSetDown(link netlink.Link) error LinkDelete(link netlink.Link) error LinkSetName(link netlink.Link, newName string) error LinkSetUp(link netlink.Link) error LinkSetNsFd(link netlink.Link, fd int) error LinkSetHardwareAddr(link netlink.Link, hwaddr net.HardwareAddr) error LinkSetMTU(link netlink.Link, mtu int) error LinkSetTxQLen(link netlink.Link, qlen int) error IsLinkNotFoundError(err error) bool AddrList(link netlink.Link, family int) ([]netlink.Addr, error) AddrDel(link netlink.Link, addr *netlink.Addr) error AddrAdd(link netlink.Link, addr *netlink.Addr) error RouteList(link netlink.Link, family int) ([]netlink.Route, error) RouteDel(route *netlink.Route) error RouteAdd(route *netlink.Route) error RouteReplace(route *netlink.Route) error RouteListFiltered(family int, filter *netlink.Route, filterMask uint64) ([]netlink.Route, error) RuleListFiltered(family int, filter *netlink.Rule, filterMask uint64) ([]netlink.Rule, error) NeighAdd(neigh *netlink.Neigh) error NeighDel(neigh *netlink.Neigh) error NeighList(linkIndex, family int) ([]netlink.Neigh, error) ConntrackDeleteFilter(table netlink.ConntrackTableType, family netlink.InetFamily, filter netlink.CustomConntrackFilter) (uint, error) }
func GetNetLinkOps ¶
func GetNetLinkOps() NetLinkOps
GetNetLinkOps will be invoked by functions in other packages that would need access to the netlink library methods.
type OVNClientset ¶
type OVNClientset struct { KubeClient kubernetes.Interface ANPClient anpclientset.Interface EgressIPClient egressipclientset.Interface EgressFirewallClient egressfirewallclientset.Interface OCPNetworkClient ocpnetworkclientset.Interface CloudNetworkClient ocpcloudnetworkclientset.Interface EgressQoSClient egressqosclientset.Interface NetworkAttchDefClient networkattchmentdefclientset.Interface MultiNetworkPolicyClient multinetworkpolicyclientset.Interface EgressServiceClient egressserviceclientset.Interface AdminPolicyRouteClient adminpolicybasedrouteclientset.Interface IPAMClaimsClient ipamclaimssclientset.Interface }
OVNClientset is a wrapper around all clientsets used by OVN-Kubernetes
func GetOVNClientset ¶
func GetOVNClientset(objects ...runtime.Object) *OVNClientset
func NewOVNClientset ¶
func NewOVNClientset(conf *config.KubernetesConfig) (*OVNClientset, error)
NewOVNClientset creates a OVNClientset from a KubernetesConfig
func (*OVNClientset) GetClusterManagerClientset ¶
func (cs *OVNClientset) GetClusterManagerClientset() *OVNClusterManagerClientset
func (*OVNClientset) GetMasterClientset ¶
func (cs *OVNClientset) GetMasterClientset() *OVNMasterClientset
func (*OVNClientset) GetNodeClientset ¶
func (cs *OVNClientset) GetNodeClientset() *OVNNodeClientset
func (*OVNClientset) GetOVNKubeControllerClientset ¶
func (cs *OVNClientset) GetOVNKubeControllerClientset() *OVNKubeControllerClientset
type OVNClusterManagerClientset ¶
type OVNClusterManagerClientset struct { KubeClient kubernetes.Interface ANPClient anpclientset.Interface EgressIPClient egressipclientset.Interface CloudNetworkClient ocpcloudnetworkclientset.Interface NetworkAttchDefClient networkattchmentdefclientset.Interface EgressServiceClient egressserviceclientset.Interface AdminPolicyRouteClient adminpolicybasedrouteclientset.Interface EgressFirewallClient egressfirewallclientset.Interface EgressQoSClient egressqosclientset.Interface IPAMClaimsClient ipamclaimssclientset.Interface OCPNetworkClient ocpnetworkclientset.Interface }
type OVNDBServerStatus ¶
ovsdb-server(5) says a clustered database is connected if the server is in contact with a majority of its cluster.
func GetOVNDBServerInfo ¶
func GetOVNDBServerInfo(timeout int, direction, database string) (*OVNDBServerStatus, error)
type OVNKubeControllerClientset ¶
type OVNKubeControllerClientset struct { KubeClient kubernetes.Interface ANPClient anpclientset.Interface EgressIPClient egressipclientset.Interface EgressFirewallClient egressfirewallclientset.Interface OCPNetworkClient ocpnetworkclientset.Interface EgressQoSClient egressqosclientset.Interface MultiNetworkPolicyClient multinetworkpolicyclientset.Interface EgressServiceClient egressserviceclientset.Interface AdminPolicyRouteClient adminpolicybasedrouteclientset.Interface IPAMClaimsClient ipamclaimssclientset.Interface }
OVNNetworkControllerManagerClientset
type OVNMasterClientset ¶
type OVNMasterClientset struct { KubeClient kubernetes.Interface ANPClient anpclientset.Interface EgressIPClient egressipclientset.Interface CloudNetworkClient ocpcloudnetworkclientset.Interface EgressFirewallClient egressfirewallclientset.Interface OCPNetworkClient ocpnetworkclientset.Interface EgressQoSClient egressqosclientset.Interface MultiNetworkPolicyClient multinetworkpolicyclientset.Interface EgressServiceClient egressserviceclientset.Interface AdminPolicyRouteClient adminpolicybasedrouteclientset.Interface IPAMClaimsClient ipamclaimssclientset.Interface }
OVNMasterClientset
func (*OVNMasterClientset) GetNodeClientset ¶
func (cs *OVNMasterClientset) GetNodeClientset() *OVNNodeClientset
func (*OVNMasterClientset) GetOVNKubeControllerClientset ¶
func (cs *OVNMasterClientset) GetOVNKubeControllerClientset() *OVNKubeControllerClientset
type OVNNodeClientset ¶
type OVNNodeClientset struct { KubeClient kubernetes.Interface EgressServiceClient egressserviceclientset.Interface EgressIPClient egressipclientset.Interface AdminPolicyRouteClient adminpolicybasedrouteclientset.Interface }
type OvsDbProperties ¶
type OvsDbProperties struct { AppCtl func(timeout int, args ...string) (string, string, error) DbAlias string DbName string ElectionTimer int }
func GetOvsDbProperties ¶
func GetOvsDbProperties(db string) (*OvsDbProperties, error)
GetOvsDbProperties inits OvsDbProperties based on db file path given to it. Now it only works with ovn dbs (nbdb and sbdb)
type ParsedNodeEgressIPConfiguration ¶
type ParsedNodeEgressIPConfiguration struct { V4 ParsedIFAddr V6 ParsedIFAddr Capacity Capacity }
func GetNodeEIPConfig ¶
func GetNodeEIPConfig(node *kapi.Node) (*ParsedNodeEgressIPConfiguration, error)
GetNodeEIPConfig attempts to generate EIP configuration from a nodes annotations. If the platform is running in the cloud, retrieve config info from node obj annotation added by Cloud Network Config Controller (CNCC). If not on a cloud platform (i.e. baremetal), retrieve from the node obj primary interface annotation.
func ParseCloudEgressIPConfig ¶
func ParseCloudEgressIPConfig(node *kapi.Node) (*ParsedNodeEgressIPConfiguration, error)
ParseCloudEgressIPConfig returns the cloud's information concerning the node's primary network interface
func ParseNodePrimaryIfAddr ¶
func ParseNodePrimaryIfAddr(node *kapi.Node) (*ParsedNodeEgressIPConfiguration, error)
ParseNodePrimaryIfAddr returns the IPv4 / IPv6 values for the node's primary network interface
type PodAnnotation ¶
type PodAnnotation struct { // IPs are the pod's assigned IP addresses/prefixes IPs []*net.IPNet // MAC is the pod's assigned MAC address MAC net.HardwareAddr // Gateways are the pod's gateway IP addresses; note that there may be // fewer Gateways than IPs. Gateways []net.IP // Routes are additional routes to add to the pod's network namespace Routes []PodRoute // TunnelID assigned to each pod for layer2 secondary networks TunnelID int }
PodAnnotation describes the assigned network details for a single pod network. (The actual annotation may include the equivalent of multiple PodAnnotations.)
func UnmarshalPodAnnotation ¶
func UnmarshalPodAnnotation(annotations map[string]string, nadName string) (*PodAnnotation, error)
UnmarshalPodAnnotation returns the Pod's network info of the given network from pod.Annotations
type PodRoute ¶
type PodRoute struct { // Dest is the route destination Dest *net.IPNet // NextHop is the IP address of the next hop for traffic destined for Dest NextHop net.IP }
PodRoute describes any routes to be added to the pod's network namespace
type SriovnetOps ¶
type SriovnetOps interface { GetNetDevicesFromPci(pciAddress string) ([]string, error) GetNetDevicesFromAux(auxDev string) ([]string, error) GetUplinkRepresentor(vfPciAddress string) (string, error) GetUplinkRepresentorFromAux(auxDev string) (string, error) GetVfIndexByPciAddress(vfPciAddress string) (int, error) GetPfIndexByVfPciAddress(vfPciAddress string) (int, error) GetSfIndexByAuxDev(auxDev string) (int, error) GetVfRepresentor(uplink string, vfIndex int) (string, error) GetSfRepresentor(uplink string, sfIndex int) (string, error) GetPfPciFromVfPci(vfPciAddress string) (string, error) GetPfPciFromAux(auxDev string) (string, error) GetVfRepresentorDPU(pfID, vfIndex string) (string, error) GetRepresentorPeerMacAddress(netdev string) (net.HardwareAddr, error) GetRepresentorPortFlavour(netdev string) (sriovnet.PortFlavour, error) }
func GetSriovnetOps ¶
func GetSriovnetOps() SriovnetOps
GetSriovnetOps will be invoked by functions in other packages that would need access to the sriovnet library methods.
type VdpaDevice ¶
type VdpaDevice interface { kvdpa.VdpaDevice }
type VdpaOps ¶
type VdpaOps interface {
GetVdpaDeviceByPci(pciAddress string) (kvdpa.VdpaDevice, error)
}
func GetVdpaOps ¶
func GetVdpaOps() VdpaOps
GetVdpaOps will be invoked by functions in other packages that would need access to the govdpa library methods.
Source Files ¶
- cloudprivateipconfig_annotations.go
- context.go
- dns.go
- dnslibops.go
- dpu_annotations.go
- egressfirewall.go
- external_gw_conntrack.go
- fake_client.go
- filesystem_linux.go
- iptables.go
- kube.go
- multi_network.go
- namespace_annotation.go
- net.go
- net_linux.go
- nicstobridge.go
- node_annotations.go
- ovn.go
- ovs.go
- pod.go
- pod_annotation.go
- slice.go
- sriovnet_linux.go
- subnet_annotations.go
- sync.go
- util.go
- vdpa_linux.go