common

package
v3.7.0-0.164.0+incompa... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2017 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package common contains the OpenShift SDN code that is shared between master, node, and proxy

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDNSResolver

func CheckDNSResolver() error

func ClusterNetworkListContains

func ClusterNetworkListContains(clusterNetworks []ClusterNetwork, ipaddr net.IP) (*net.IPNet, bool)

func ClusterNetworkToString

func ClusterNetworkToString(n *networkapi.ClusterNetwork) string

func DeletionHandlingMetaNamespaceKeyFunc

func DeletionHandlingMetaNamespaceKeyFunc(obj interface{}) (string, error)

func HostSubnetToString

func HostSubnetToString(subnet *networkapi.HostSubnet) string

func RegisterSharedInformerEventHandlers

func RegisterSharedInformerEventHandlers(kubeInformers kinternalinformers.SharedInformerFactory,
	addOrUpdateFunc func(interface{}, interface{}, watch.EventType),
	delFunc func(interface{}), resourceName ResourceName)

RegisterSharedInformerEventHandlers registers addOrUpdateFunc and delFunc event handlers with kubernetes shared informers for the given resource name.

func RunEventQueue

func RunEventQueue(client kcache.Getter, resourceName ResourceName, process ProcessEventFunc)

Run event queue for the given resource. The 'process' function is called repeatedly with each available cache.Delta that describes state changes to an object. If the process function returns an error queued changes for that object are dropped but processing continues with the next available object's cache.Deltas. The error is logged with call stack information.

NOTE: this function will handle DeletedFinalStateUnknown delta objects automatically, which may not always be what you want since the now-deleted object may be stale.

Types

type ClusterNetwork

type ClusterNetwork struct {
	ClusterCIDR      *net.IPNet
	HostSubnetLength uint32
}

type DNS

type DNS struct {
	// contains filtered or unexported fields
}

func NewDNS

func NewDNS(execer kexec.Interface) *DNS

func (*DNS) Add

func (d *DNS) Add(dns string) error

func (*DNS) Get

func (d *DNS) Get(dns string) dnsValue

func (*DNS) GetMinQueryTime

func (d *DNS) GetMinQueryTime() (time.Time, bool)

func (*DNS) Size

func (d *DNS) Size() int

func (*DNS) Update

func (d *DNS) Update() (error, bool)

type EgressDNS

type EgressDNS struct {

	// Report changes when there are dns updates
	Updates chan EgressDNSUpdate
	// contains filtered or unexported fields
}

func NewEgressDNS

func NewEgressDNS() *EgressDNS

func (*EgressDNS) Add

func (e *EgressDNS) Add(policy networkapi.EgressNetworkPolicy)

func (*EgressDNS) Delete

func (e *EgressDNS) Delete(policy networkapi.EgressNetworkPolicy)

func (*EgressDNS) GetIPs

func (e *EgressDNS) GetIPs(policy networkapi.EgressNetworkPolicy, dnsName string) []net.IP

func (*EgressDNS) GetMinQueryTime

func (e *EgressDNS) GetMinQueryTime() (time.Time, ktypes.UID, string, bool)

func (*EgressDNS) GetNetCIDRs

func (e *EgressDNS) GetNetCIDRs(policy networkapi.EgressNetworkPolicy, dnsName string) []net.IPNet

func (*EgressDNS) Sync

func (e *EgressDNS) Sync()

func (*EgressDNS) Update

func (e *EgressDNS) Update(policyUID ktypes.UID) (error, bool)

type EgressDNSUpdate

type EgressDNSUpdate struct {
	UID       ktypes.UID
	Namespace string
}

type EventQueue

type EventQueue struct {
	*cache.DeltaFIFO
	// contains filtered or unexported fields
}

EventQueue is an enhanced DeltaFIFO that provides reliable Deleted deltas even if no knownObjects store is given, and compresses multiple deltas to reduce duplicate events.

Without a store, DeltaFIFO will drop Deleted deltas when its queue is empty because the deleted object is not present in the queue and DeltaFIFO tries to protect against duplicate Deleted deltas resulting from Replace().

To get reliable deletion, a store must be provided, and EventQueue provides one if the caller does not.

func NewEventQueue

func NewEventQueue(keyFunc cache.KeyFunc) *EventQueue

func NewEventQueueForStore

func NewEventQueueForStore(keyFunc cache.KeyFunc, knownObjects cache.KeyListerGetter) *EventQueue

func (*EventQueue) Pop

func (queue *EventQueue) Pop(process ProcessEventFunc, expectedType interface{}) (interface{}, error)

Process queued changes for an object. The 'process' function is called repeatedly with each available cache.Delta that describes state changes for that object. If the process function returns an error queued changes for that object are dropped but processing continues with the next available object's cache.Deltas. The error is logged with call stack information.

type NetworkInfo

type NetworkInfo struct {
	ClusterNetworks []ClusterNetwork
	ServiceNetwork  *net.IPNet
}

func GetNetworkInfo

func GetNetworkInfo(networkClient networkclient.Interface) (*NetworkInfo, error)

func ParseNetworkInfo

func ParseNetworkInfo(clusterNetwork []networkapi.ClusterNetworkEntry, serviceNetwork string) (*NetworkInfo, error)

func (*NetworkInfo) CheckClusterObjects

func (ni *NetworkInfo) CheckClusterObjects(subnets []networkapi.HostSubnet, pods []kapi.Pod, services []kapi.Service) error

func (*NetworkInfo) CheckHostNetworks

func (ni *NetworkInfo) CheckHostNetworks(hostIPNets []*net.IPNet) error

func (*NetworkInfo) ValidateNodeIP

func (ni *NetworkInfo) ValidateNodeIP(nodeIP string) error

type ProcessEventFunc

type ProcessEventFunc func(delta cache.Delta) error

Function should process one object delta, which represents a change notification for a single object. Function is passed the delta, which contains the changed object or the deleted final object state. The deleted final object state is extracted from the DeletedFinalStateUnknown passed by DeltaFIFO.

type ResourceName

type ResourceName string
const (
	Nodes                 ResourceName = "Nodes"
	Namespaces            ResourceName = "Namespaces"
	NetNamespaces         ResourceName = "NetNamespaces"
	Services              ResourceName = "Services"
	HostSubnets           ResourceName = "HostSubnets"
	Pods                  ResourceName = "Pods"
	EgressNetworkPolicies ResourceName = "EgressNetworkPolicies"
	NetworkPolicies       ResourceName = "NetworkPolicies"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL