Documentation ¶
Index ¶
- Constants
- func AddressCount(network *net.IPNet) float64
- func AppendGwByCidr(gateway, cidrStr string) (string, error)
- func BigInt2Ip(ipInt *big.Int) string
- func CIDRConflict(a, b string) bool
- func CIDRContainIP(cidrStr, ipStr string) bool
- func CheckCidrs(cidr string) error
- func CheckProtocol(address string) string
- func ContainsIPs(excludeIP string, ip string) bool
- func ContainsString(slice []string, s string) bool
- func CountIpNums(excludeIPs []string) float64
- func DiffStringSlice(slice1, slice2 []string) []string
- func EnableAdapter(adapter string) error
- func ExecuteCommandInContainer(client kubernetes.Interface, cfg *rest.Config, namespace string, ...) (string, string, error)
- func ExecuteWithOptions(client kubernetes.Interface, cfg *rest.Config, options ExecOptions) (string, string, error)
- func ExpandExcludeIPs(excludeIPs []string, cidr string) []string
- func ExternalBridgeName(provider string) string
- func FirstIP(subnet string) (string, error)
- func GatewayContains(gatewayNodeStr, gateway string) bool
- func GenerateMac() string
- func GenerateRandomV4IP(cidr string) string
- func GenerateStrategicMergePatchPayload(original, modified runtime.Object) ([]byte, error)
- func GetGwByCidr(cidrStr string) (string, error)
- func GetIpAddrWithMask(ip, cidr string) string
- func GetIpWithoutMask(ipStr string) string
- func GetNodeInternalIP(node v1.Node) (ipv4, ipv6 string)
- func GetStringIP(v4IP, v6IP string) string
- func IPToString(ip string) string
- func InitKlogMetrics()
- func Ip2BigInt(ipStr string) *big.Int
- func IsDefaultNet(defaultNetAnnotation string, attach *types.NetworkSelectionElement) bool
- func IsOvnNetwork(netCfg *types.DelegateNetConf) bool
- func IsStringIn(str string, slice []string) bool
- func IsStringsOverlap(a, b []string) bool
- func IsValidIP(ip string) bool
- func JoinHostPort(host string, port int32) string
- func LastIP(subnet string) (string, error)
- func NewNetIPAddress(ifIndex uint32, ipAddr string) error
- func NewNetNat(name, addressPrefix string, mayExist bool) error
- func NewNetRoute(ifIndex uint32, destinationPrefix, nextHop string) error
- func ParsePodNetworkAnnotation(podNetworks, defaultNamespace string) ([]*types.NetworkSelectionElement, error)
- func Powershell(cmd string) (string, error)
- func RemoveNetIPAddress(ifIndex uint32, ipAddr string) error
- func RemoveNetRoute(ifIndex uint32, destinationPrefix string) error
- func RemoveString(slice []string, s string) (result []string)
- func SetAdapterMac(adapter, mac string) error
- func SetLinkUp(name string) error
- func SetNetIPInterface(ifIndex uint32, addressFamily *uint16, mtu *uint32, dhcp, forwarding *bool) error
- func SplitIpsByProtocol(excludeIps []string) ([]string, []string)
- func SplitStringIP(ipStr string) (string, string)
- func SubnetBroadcast(subnet string) string
- func SubnetNumber(subnet string) string
- func UniqString(a []string) []string
- func ValidateCidrConflict(subnet kubeovnv1.Subnet, subnetList []kubeovnv1.Subnet) error
- func ValidatePodCidr(cidr, ip string) error
- func ValidatePodNetwork(annotations map[string]string) error
- func ValidateSubnet(subnet kubeovnv1.Subnet) error
- type ExecOptions
- type LogicalRouter
- type LogicalSwitch
- type NetAdapter
- type NetIPAddress
- type NetIPInterface
- type NetRoute
- type Port
Constants ¶
View Source
const ( CniTypeName = "kube-ovn" ControllerName = "kube-ovn-controller" AllocatedAnnotation = "ovn.kubernetes.io/allocated" RoutedAnnotation = "ovn.kubernetes.io/routed" MacAddressAnnotation = "ovn.kubernetes.io/mac_address" IpAddressAnnotation = "ovn.kubernetes.io/ip_address" CidrAnnotation = "ovn.kubernetes.io/cidr" GatewayAnnotation = "ovn.kubernetes.io/gateway" IpPoolAnnotation = "ovn.kubernetes.io/ip_pool" BgpAnnotation = "ovn.kubernetes.io/bgp" SnatAnnotation = "ovn.kubernetes.io/snat" EipAnnotation = "ovn.kubernetes.io/eip" ChassisAnnotation = "ovn.kubernetes.io/chassis" VpcNatGatewayAnnotation = "ovn.kubernetes.io/vpc_nat_gw" VpcNatGatewayInitAnnotation = "ovn.kubernetes.io/vpc_nat_gw_init" VpcEipsAnnotation = "ovn.kubernetes.io/vpc_eips" VpcFloatingIpMd5Annotation = "ovn.kubernetes.io/vpc_floating_ips" VpcDnatMd5Annotation = "ovn.kubernetes.io/vpc_dnat_md5" VpcSnatMd5Annotation = "ovn.kubernetes.io/vpc_snat_md5" VpcCIDRsAnnotation = "ovn.kubernetes.io/vpc_cidrs" VpcLbAnnotation = "ovn.kubernetes.io/vpc_lb" VpcExternalLabel = "ovn.kubernetes.io/vpc_external" VpcEipLabel = "ovn.kubernetes.io/vpc_eip" VpcDnatEPortLabel = "ovn.kubernetes.io/vpc_dnat_eport" VpcNatLabel = "ovn.kubernetes.io/vpc_nat" LogicalRouterAnnotation = "ovn.kubernetes.io/logical_router" VpcAnnotation = "ovn.kubernetes.io/vpc" Layer2ForwardAnnotationTemplate = "%s.kubernetes.io/layer2_forward" PortSecurityAnnotationTemplate = "%s.kubernetes.io/port_security" PortVipAnnotationTemplate = "%s.kubernetes.io/port_vips" PortSecurityAnnotation = "ovn.kubernetes.io/port_security" NorthGatewayAnnotation = "ovn.kubernetes.io/north_gateway" AllocatedAnnotationSuffix = ".kubernetes.io/allocated" AllocatedAnnotationTemplate = "%s.kubernetes.io/allocated" RoutedAnnotationTemplate = "%s.kubernetes.io/routed" MacAddressAnnotationTemplate = "%s.kubernetes.io/mac_address" IpAddressAnnotationTemplate = "%s.kubernetes.io/ip_address" CidrAnnotationTemplate = "%s.kubernetes.io/cidr" GatewayAnnotationTemplate = "%s.kubernetes.io/gateway" IpPoolAnnotationTemplate = "%s.kubernetes.io/ip_pool" LogicalSwitchAnnotationTemplate = "%s.kubernetes.io/logical_switch" LogicalRouterAnnotationTemplate = "%s.kubernetes.io/logical_router" VlanIdAnnotationTemplate = "%s.kubernetes.io/vlan_id" IngressRateAnnotationTemplate = "%s.kubernetes.io/ingress_rate" EgressRateAnnotationTemplate = "%s.kubernetes.io/egress_rate" SecurityGroupAnnotationTemplate = "%s.kubernetes.io/security_groups" LiveMigrationAnnotationTemplate = "%s.kubernetes.io/allow_live_migration" DefaultRouteAnnotationTemplate = "%s.kubernetes.io/default_route" ProviderNetworkTemplate = "%s.kubernetes.io/provider_network" ProviderNetworkReadyTemplate = "%s.provider-network.kubernetes.io/ready" ProviderNetworkExcludeTemplate = "%s.provider-network.kubernetes.io/exclude" ProviderNetworkInterfaceTemplate = "%s.provider-network.kubernetes.io/interface" ProviderNetworkMtuTemplate = "%s.provider-network.kubernetes.io/mtu" MirrorControlAnnotationTemplate = "%s.kubernetes.io/mirror" PodNicAnnotationTemplate = "%s.kubernetes.io/pod_nic_type" VmTemplate = "%s.kubernetes.io/virtualmachine" ExcludeIpsAnnotation = "ovn.kubernetes.io/exclude_ips" IngressRateAnnotation = "ovn.kubernetes.io/ingress_rate" EgressRateAnnotation = "ovn.kubernetes.io/egress_rate" PortNameAnnotation = "ovn.kubernetes.io/port_name" LogicalSwitchAnnotation = "ovn.kubernetes.io/logical_switch" TunnelInterfaceAnnotation = "ovn.kubernetes.io/tunnel_interface" OvsDpTypeLabel = "ovn.kubernetes.io/ovs_dp_type" SubnetNameLabel = "ovn.kubernetes.io/subnet" ICGatewayLabel = "ovn.kubernetes.io/ic-gw" ExGatewayLabel = "ovn.kubernetes.io/external-gw" VpcNatGatewayLabel = "ovn.kubernetes.io/vpc-nat-gw" VpcNatGatewayNameLabel = "ovn.kubernetes.io/vpc-nat-gw-name" VpcLbLabel = "ovn.kubernetes.io/vpc_lb" ProtocolTCP = "tcp" ProtocolUDP = "udp" NetworkTypeVlan = "vlan" NetworkTypeGeneve = "geneve" NodeNic = "ovn0" NodeAllowPriority = "3000" SecurityGroupHighestPriority = "2300" SecurityGroupAllowPriority = "2004" SecurityGroupDropPriority = "2003" IngressAllowPriority = "2001" IngressDefaultDrop = "2000" EgressAllowPriority = "2001" EgressDefaultDrop = "2000" SubnetAllowPriority = "1001" DefaultDropPriority = "1000" GeneveHeaderLength = 100 TcpIpHeaderLength = 40 OvnProvider = "ovn" AttachmentNetworkAnnotation = "k8s.v1.cni.cncf.io/networks" DefaultNetworkAnnotation = "v1.multus-cni.io/default-network" SRIOVResourceName = "mellanox.com/cx5_sriov_switchdev" InterconnectionConfig = "ovn-ic-config" ExternalGatewayConfig = "ovn-external-gw-config" InterconnectionSwitch = "ts" ExternalGatewaySwitch = "ovn-external" VpcNatGatewayConfig = "ovn-vpc-nat-gw-config" VpcExternalNet = "ovn-vpc-external-network" VpcLbNetworkAttachment = "ovn-vpc-lb" DefaultVpc = "ovn-cluster" DefaultSubnet = "ovn-default" EcmpRouteType = "ecmp" NormalRouteType = "normal" GatewayRouterPolicyPriority = 29000 NodeRouterPolicyPriority = 30000 SubnetRouterPolicyPriority = 31000 OffloadType = "offload-port" InternalType = "internal-port" DpdkType = "dpdk-port" HostnameEnv = "KUBE_NODE_NAME" ChasRetryTime = 5 ChasRetryIntev = 1 VmInstance = "VirtualMachineInstance" MirrorControlAnnotation = "ovn.kubernetes.io/mirror" MirrorDefaultName = "m0" DenyAllSecurityGroup = "kubeovn_deny_all" HtbQosHigh = "htbqos-high" HtbQosMedium = "htbqos-medium" HtbQosLow = "htbqos-low" PriorityAnnotation = "ovn.kubernetes.io/priority" NetemQosLatencyAnnotation = "ovn.kubernetes.io/latency" NetemQosLimitAnnotation = "ovn.kubernetes.io/limit" NetemQosLossAnnotation = "ovn.kubernetes.io/loss" PriorityAnnotationTemplate = "%s.kubernetes.io/priority" NetemQosLatencyAnnotationTemplate = "%s.kubernetes.io/latency" NetemQosLimitAnnotationTemplate = "%s.kubernetes.io/limit" NetemQosLossAnnotationTemplate = "%s.kubernetes.io/loss" POD_IP = "POD_IP" ContentType = "application/vnd.kubernetes.protobuf" AcceptContentTypes = "application/vnd.kubernetes.protobuf,application/json" )
View Source
const ( WindowsListenPipe = `\\.\pipe\kube-ovn-daemon` ChassisLoc = `/ovn/etc/system-id.conf` HnsNetwork = "kube-ovn" NetNat = "kube-ovn" )
View Source
const ( WindowsAddressFamilyV4 = 2 WindowsAddressFamilyV6 = 23 )
View Source
const ( V6Multicast = "ff00::/8" V4Multicast = "224.0.0.0/4" V4Loopback = "127.0.0.1/8" V6Loopback = "::1/128" )
Variables ¶
This section is empty.
Functions ¶
func AddressCount ¶ added in v1.7.0
func AppendGwByCidr ¶ added in v1.7.0
func CIDRConflict ¶ added in v1.7.0
func CIDRContainIP ¶ added in v1.7.0
func CheckCidrs ¶ added in v1.7.0
func CheckProtocol ¶ added in v1.7.0
func ContainsIPs ¶ added in v1.7.0
func ContainsString ¶ added in v1.7.0
Helper functions to check and remove string from a slice of strings.
func CountIpNums ¶ added in v1.7.0
func DiffStringSlice ¶ added in v0.5.0
func EnableAdapter ¶ added in v1.10.0
func ExecuteCommandInContainer ¶ added in v1.7.0
func ExecuteWithOptions ¶ added in v1.7.0
func ExecuteWithOptions(client kubernetes.Interface, cfg *rest.Config, options ExecOptions) (string, string, error)
func ExpandExcludeIPs ¶ added in v1.7.0
ExpandExcludeIPs used to get exclude ips in range of subnet cidr, excludes cidr addr and broadcast addr
func ExternalBridgeName ¶ added in v1.7.1
ExternalBridgeName returns external bridge name of the provider network
func GatewayContains ¶ added in v1.7.0
func GenerateRandomV4IP ¶ added in v1.7.0
func GenerateStrategicMergePatchPayload ¶ added in v1.9.17
func GetGwByCidr ¶ added in v1.7.0
func GetIpAddrWithMask ¶ added in v1.7.0
func GetIpWithoutMask ¶ added in v1.7.0
func GetNodeInternalIP ¶ added in v1.7.0
func GetStringIP ¶ added in v1.7.0
func IPToString ¶ added in v1.7.0
func InitKlogMetrics ¶ added in v1.8.3
func InitKlogMetrics()
func IsDefaultNet ¶ added in v1.7.0
func IsDefaultNet(defaultNetAnnotation string, attach *types.NetworkSelectionElement) bool
func IsOvnNetwork ¶ added in v1.7.0
func IsOvnNetwork(netCfg *types.DelegateNetConf) bool
func IsStringIn ¶ added in v1.7.0
func IsStringsOverlap ¶ added in v1.7.0
IsStringsOverlap check if two string slices are overlapped
func JoinHostPort ¶ added in v1.8.2
func NewNetIPAddress ¶ added in v1.10.0
func NewNetRoute ¶ added in v1.10.0
func ParsePodNetworkAnnotation ¶ added in v1.7.0
func ParsePodNetworkAnnotation(podNetworks, defaultNamespace string) ([]*types.NetworkSelectionElement, error)
func Powershell ¶ added in v1.10.0
func RemoveNetIPAddress ¶ added in v1.10.0
func RemoveNetRoute ¶ added in v1.10.0
func RemoveString ¶ added in v1.7.0
func SetAdapterMac ¶ added in v1.10.0
func SetNetIPInterface ¶ added in v1.10.0
func SplitIpsByProtocol ¶ added in v1.7.0
func SplitStringIP ¶ added in v1.7.0
func SubnetBroadcast ¶ added in v1.7.1
func SubnetNumber ¶ added in v1.7.0
func UniqString ¶ added in v1.7.0
UniqString creates an array of string with unique values.
func ValidateCidrConflict ¶ added in v1.9.0
func ValidatePodCidr ¶ added in v1.7.0
func ValidatePodNetwork ¶ added in v0.4.0
func ValidateSubnet ¶ added in v1.7.0
Types ¶
type ExecOptions ¶ added in v1.7.0
type LogicalRouter ¶ added in v1.8.0
type LogicalRouter struct { Name string Ports []Port LogicalSwitches []LogicalSwitch }
type LogicalSwitch ¶ added in v1.8.0
type NetAdapter ¶ added in v1.10.0
type NetAdapter struct { Name string ElementName string MacAddress string InterfaceIndex uint32 InterfaceAdminStatus uint32 InterfaceOperationalStatus uint32 }
NetAdapter represents a network adapter on windows
func GetNetAdapter ¶ added in v1.10.0
func GetNetAdapter(name string, ignoreError bool) (*NetAdapter, error)
type NetIPAddress ¶ added in v1.10.0
type NetIPAddress struct { InterfaceIndex uint32 InterfaceAlias string AddressFamily uint16 IPAddress string PrefixLength uint8 }
NetIPAddress represents a net IP address on windows
func GetNetIPAddress ¶ added in v1.10.0
func GetNetIPAddress(ifIndex uint32) ([]NetIPAddress, error)
type NetIPInterface ¶ added in v1.10.0
type NetIPInterface struct { InterfaceIndex uint32 InterfaceAlias string AddressFamily uint16 NlMtu uint32 Forwarding uint8 Dhcp uint8 }
NetIPInterface represents a net IP interface on windows
func GetInterfaceByIP ¶ added in v1.10.0
func GetInterfaceByIP(ip string) (*NetIPInterface, error)
func GetNetIPInterface ¶ added in v1.10.0
func GetNetIPInterface(ifIndex uint32) ([]NetIPInterface, error)
Click to show internal directories.
Click to hide internal directories.