Documentation ¶
Overview ¶
Package common contains the OpenShift SDN code that is shared between master, node, and proxy
Index ¶
- Constants
- func ClusterNetworkListContains(clusterNetworks []ParsedClusterNetworkEntry, ipaddr net.IP) (*net.IPNet, bool)
- func ClusterNetworkToString(n *osdnv1.ClusterNetwork) string
- func GenerateDefaultGateway(sna *net.IPNet) net.IP
- func GetHostIPNetworks(skipInterfaces []string) ([]*net.IPNet, []net.IP, error)
- func GetNodeInternalIP(node *corev1.Node) string
- func HSEgressIPsToStrings(ips []osdnv1.HostSubnetEgressIP) []string
- func HostSubnetToString(subnet *osdnv1.HostSubnet) string
- func InformerFuncs(objType runtime.Object, addOrUpdateFunc InformerAddOrUpdateFunc, ...) kcache.ResourceEventHandlerFuncs
- func ListAllEgressNetworkPolicies(ctx context.Context, client osdnclient.Interface) ([]*osdnv1.EgressNetworkPolicy, error)
- func ListAllHostSubnets(ctx context.Context, client osdnclient.Interface) ([]*osdnv1.HostSubnet, error)
- func ListAllNamespaces(ctx context.Context, client kubernetes.Interface) ([]*corev1.Namespace, error)
- func ListAllNetNamespaces(ctx context.Context, client osdnclient.Interface) ([]*osdnv1.NetNamespace, error)
- func ListAllNetworkPolicies(ctx context.Context, client kubernetes.Interface) ([]*networkingv1.NetworkPolicy, error)
- func ListAllPods(ctx context.Context, client kubernetes.Interface) ([]*corev1.Pod, error)
- func ListAllServices(ctx context.Context, client kubernetes.Interface) ([]*corev1.Service, error)
- func ListPodsInNodeAndNamespace(ctx context.Context, client kubernetes.Interface, node, namespace string) ([]*corev1.Pod, error)
- func ListServicesInNamespace(ctx context.Context, client kubernetes.Interface, namespace string) ([]*corev1.Service, error)
- func NetnsIsMulticastEnabled(netns *osdnv1.NetNamespace) bool
- func PlatformUsesCloudEgressIP(platformType string) bool
- func StringsToHSEgressIPs(ips []string) []osdnv1.HostSubnetEgressIP
- func ValidateClusterNetwork(clusterNet *osdnv1.ClusterNetwork) error
- func ValidateHostSubnet(hs *osdnv1.HostSubnet) error
- func ValidateHostSubnetEgress(hs *osdnv1.HostSubnet) error
- type DNS
- type DNSInterface
- type DNSResponseNotification
- type EgressDNS
- type EgressDNSUpdate
- type EgressDNSUpdates
- type EgressIPAssignment
- type EgressIPTracker
- func (eit *EgressIPTracker) DeleteNetNamespaceEgress(vnid uint32)
- func (eit *EgressIPTracker) GetNodeCloudEgressIPConfig(nodeName string) (*nodeCloudEgressIPConfiguration, error)
- func (eit *EgressIPTracker) GetNodeNameByNodeIP(nodeIP string) string
- func (eit *EgressIPTracker) Ping(sdnIP string, timeout time.Duration) bool
- func (eit *EgressIPTracker) ReallocateEgressIPs() map[string][]string
- func (eit *EgressIPTracker) SetNodeOffline(nodeIP string, offline bool)
- func (eit *EgressIPTracker) Start(kubeClient kubernetes.Interface, ...)
- func (eit *EgressIPTracker) UpdateHostSubnetEgress(hs *osdnv1.HostSubnet)
- func (eit *EgressIPTracker) UpdateNetNamespaceEgress(netns *osdnv1.NetNamespace)
- type EgressIPWatcher
- type FakeDNS
- func (f *FakeDNS) Add(dns string) error
- func (f *FakeDNS) Delete(dns string)
- func (f *FakeDNS) Get(dns string) dnsValue
- func (f *FakeDNS) GetNextQueryTime() (time.Time, string, bool)
- func (f *FakeDNS) SetUpdating(dns string) error
- func (f *FakeDNS) Size() int
- func (f *FakeDNS) Update(dns string) (bool, error)
- type InformerAddOrUpdateFunc
- type InformerDeleteFunc
- type ParsedClusterNetwork
- func (pcn *ParsedClusterNetwork) CheckClusterObjects(subnets []*osdnv1.HostSubnet, pods []*corev1.Pod, services []*corev1.Service) error
- func (pcn *ParsedClusterNetwork) CheckHostNetworks(hostIPNets []*net.IPNet) error
- func (pcn *ParsedClusterNetwork) PodNetworkContains(ip net.IP) bool
- func (pcn *ParsedClusterNetwork) ServiceNetworkContains(ip net.IP) bool
- func (pcn *ParsedClusterNetwork) ValidateNodeIP(nodeIP string) error
- type ParsedClusterNetworkEntry
Constants ¶
const ( // DefaultPollInterval default poll interval used for egress node reachability check DefaultPollInterval = 5 * time.Second // RepollInterval poll interval used for egress node reachability check retries RepollInterval = time.Second )
const ( // Maximum VXLAN Virtual Network Identifier(VNID) as per RFC#7348 MaxVNID = uint32((1 << 24) - 1) // VNID: 2 to 9 are internally reserved for any special cases in the future MinVNID = uint32(10) // VNID: 0 reserved for default namespace and can reach any network in the cluster GlobalVNID = uint32(0) )
Variables ¶
This section is empty.
Functions ¶
func ClusterNetworkToString ¶
func ClusterNetworkToString(n *osdnv1.ClusterNetwork) string
func GenerateDefaultGateway ¶
Generate the default gateway IP Address for a subnet
func GetHostIPNetworks ¶
Return Host IP Networks Ignores provided interfaces and filters loopback and non IPv4 addrs.
func GetNodeInternalIP ¶
func HSEgressIPsToStrings ¶
func HSEgressIPsToStrings(ips []osdnv1.HostSubnetEgressIP) []string
func HostSubnetToString ¶
func HostSubnetToString(subnet *osdnv1.HostSubnet) string
func InformerFuncs ¶
func InformerFuncs(objType runtime.Object, addOrUpdateFunc InformerAddOrUpdateFunc, deleteFunc InformerDeleteFunc) kcache.ResourceEventHandlerFuncs
func ListAllEgressNetworkPolicies ¶
func ListAllEgressNetworkPolicies(ctx context.Context, client osdnclient.Interface) ([]*osdnv1.EgressNetworkPolicy, error)
func ListAllHostSubnets ¶
func ListAllHostSubnets(ctx context.Context, client osdnclient.Interface) ([]*osdnv1.HostSubnet, error)
func ListAllNamespaces ¶
func ListAllNetNamespaces ¶
func ListAllNetNamespaces(ctx context.Context, client osdnclient.Interface) ([]*osdnv1.NetNamespace, error)
func ListAllNetworkPolicies ¶
func ListAllNetworkPolicies(ctx context.Context, client kubernetes.Interface) ([]*networkingv1.NetworkPolicy, error)
func ListAllPods ¶
func ListAllServices ¶
func ListServicesInNamespace ¶
func NetnsIsMulticastEnabled ¶
func NetnsIsMulticastEnabled(netns *osdnv1.NetNamespace) bool
func StringsToHSEgressIPs ¶
func StringsToHSEgressIPs(ips []string) []osdnv1.HostSubnetEgressIP
func ValidateClusterNetwork ¶
func ValidateClusterNetwork(clusterNet *osdnv1.ClusterNetwork) error
ValidateClusterNetwork tests if required fields in the ClusterNetwork are set, and ensures that the "default" ClusterNetwork can only be set to the correct values
func ValidateHostSubnet ¶
func ValidateHostSubnet(hs *osdnv1.HostSubnet) error
ValidateHostSubnet checks if the system-maintained fields of hostsubnet are valid.
func ValidateHostSubnetEgress ¶
func ValidateHostSubnetEgress(hs *osdnv1.HostSubnet) error
ValidateHostSubnetEgress checks if the user-maintained fields of hostsubnet are valid.
Types ¶
type DNSInterface ¶
type DNSResponseNotification ¶
type EgressDNS ¶
type EgressDNS struct { // Report changes when there are dns updates Updates chan EgressDNSUpdates // contains filtered or unexported fields }
func NewEgressDNS ¶
func (*EgressDNS) Add ¶
func (e *EgressDNS) Add(policy osdnv1.EgressNetworkPolicy)
func (*EgressDNS) Delete ¶
func (e *EgressDNS) Delete(policy osdnv1.EgressNetworkPolicy)
type EgressDNSUpdate ¶
type EgressDNSUpdates ¶
type EgressDNSUpdates []EgressDNSUpdate
type EgressIPAssignment ¶
type EgressIPTracker ¶
type EgressIPTracker struct { sync.Mutex CloudEgressIP bool // contains filtered or unexported fields }
func NewEgressIPTracker ¶
func NewEgressIPTracker(watcher EgressIPWatcher, cloudEgressIP bool, localIP string) *EgressIPTracker
func (*EgressIPTracker) DeleteNetNamespaceEgress ¶
func (eit *EgressIPTracker) DeleteNetNamespaceEgress(vnid uint32)
func (*EgressIPTracker) GetNodeCloudEgressIPConfig ¶
func (eit *EgressIPTracker) GetNodeCloudEgressIPConfig(nodeName string) (*nodeCloudEgressIPConfiguration, error)
GetNodeCloudEgressIPConfig returns cloud egress IP config for the specified node
func (*EgressIPTracker) GetNodeNameByNodeIP ¶
func (eit *EgressIPTracker) GetNodeNameByNodeIP(nodeIP string) string
func (*EgressIPTracker) Ping ¶
func (eit *EgressIPTracker) Ping(sdnIP string, timeout time.Duration) bool
Ping a node on its SDN IP and return whether we think it is online. We do this by trying to open a TCP connection to the "discard" service (port 9); if the node is offline, the attempt will either time out with no response, or else return "no route to host" (and we will return false). If the node is online then we presumably will get a "connection refused" error; but the code below assumes that anything other than timeout or "no route" indicates that the node is online. It is required that the IP provided is from SDN, nodes primary IP might drop traffic destined to port 9
func (*EgressIPTracker) ReallocateEgressIPs ¶
func (eit *EgressIPTracker) ReallocateEgressIPs() map[string][]string
ReallocateEgressIPs returns a map from Node name to array-of-Egress-IP for all auto-allocated egress IPs
func (*EgressIPTracker) SetNodeOffline ¶
func (eit *EgressIPTracker) SetNodeOffline(nodeIP string, offline bool)
func (*EgressIPTracker) Start ¶
func (eit *EgressIPTracker) Start(kubeClient kubernetes.Interface, hostSubnetInformer osdninformers.HostSubnetInformer, netNamespaceInformer osdninformers.NetNamespaceInformer, nodeInformer kcoreinformers.NodeInformer)
func (*EgressIPTracker) UpdateHostSubnetEgress ¶
func (eit *EgressIPTracker) UpdateHostSubnetEgress(hs *osdnv1.HostSubnet)
func (*EgressIPTracker) UpdateNetNamespaceEgress ¶
func (eit *EgressIPTracker) UpdateNetNamespaceEgress(netns *osdnv1.NetNamespace)
type EgressIPWatcher ¶
type EgressIPWatcher interface { Synced() ClaimEgressIP(vnid uint32, egressIP, nodeIP, sdnIP string, nodeOffline bool) ReleaseEgressIP(egressIP, nodeIP string) SetNamespaceEgressNormal(vnid uint32) SetNamespaceEgressDropped(vnid uint32) SetNamespaceEgressViaEgressIPs(vnid uint32, activeEgressIPs []EgressIPAssignment) UpdateEgressCIDRs() }
type FakeDNS ¶
type FakeDNS struct {
// contains filtered or unexported fields
}
func NewFakeDNS ¶
func NewFakeDNS(dnsReplies []fakeDNSReply) *FakeDNS
func (*FakeDNS) SetUpdating ¶
type InformerAddOrUpdateFunc ¶
type InformerDeleteFunc ¶
type InformerDeleteFunc func(interface{})
type ParsedClusterNetwork ¶
type ParsedClusterNetwork struct { PluginName string ClusterNetworks []ParsedClusterNetworkEntry ServiceNetwork *net.IPNet VXLANPort uint32 OverlayMTU uint32 }
func GetParsedClusterNetwork ¶
func GetParsedClusterNetwork(osdnClient osdnclient.Interface) (*ParsedClusterNetwork, error)
func ParseClusterNetwork ¶
func ParseClusterNetwork(cn *osdnv1.ClusterNetwork) (*ParsedClusterNetwork, error)
func (*ParsedClusterNetwork) CheckClusterObjects ¶
func (pcn *ParsedClusterNetwork) CheckClusterObjects(subnets []*osdnv1.HostSubnet, pods []*corev1.Pod, services []*corev1.Service) error
func (*ParsedClusterNetwork) CheckHostNetworks ¶
func (pcn *ParsedClusterNetwork) CheckHostNetworks(hostIPNets []*net.IPNet) error
func (*ParsedClusterNetwork) PodNetworkContains ¶
func (pcn *ParsedClusterNetwork) PodNetworkContains(ip net.IP) bool
PodNetworkContains determines whether pcn's pod network contains ip
func (*ParsedClusterNetwork) ServiceNetworkContains ¶
func (pcn *ParsedClusterNetwork) ServiceNetworkContains(ip net.IP) bool
ServiceNetworkContains determines whether pcn's service network contains ip
func (*ParsedClusterNetwork) ValidateNodeIP ¶
func (pcn *ParsedClusterNetwork) ValidateNodeIP(nodeIP string) error