proxy

package
v2.0.0-rc7 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KubeDummyIf       = "kube-dummy-if"
	KubeTunnelIfv4    = "kube-tunnel-if"
	KubeTunnelIfv6    = "kube-tunnel-v6"
	IfaceNotFound     = "Link not found"
	IfaceHasAddr      = "file exists"
	IfaceHasNoAddr    = "cannot assign requested address"
	IpvsServerExists  = "file exists"
	IpvsMaglevHashing = "mh"
	IpvsSvcFSched1    = "flag-1"
	IpvsSvcFSched2    = "flag-2"
	IpvsSvcFSched3    = "flag-3"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LinuxNetworking

type LinuxNetworking interface {
	// contains filtered or unexported methods
}

LinuxNetworking interface contains all linux networking subsystem calls

type LinuxNetworkingMock

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

LinuxNetworkingMock is a mock implementation of LinuxNetworking.

func TestSomethingThatUsesLinuxNetworking(t *testing.T) {

	// make and configure a mocked LinuxNetworking
	mockedLinuxNetworking := &LinuxNetworkingMock{
		configureContainerForDSRFunc: func(vip string, endpointIP string, containerID string, pid int, hostNetworkNamespaceHandle netns.NsHandle) error {
			panic("mock out the configureContainerForDSR method")
		},
		getKubeDummyInterfaceFunc: func() (netlink.Link, error) {
			panic("mock out the getKubeDummyInterface method")
		},
		ipAddrAddFunc: func(iface netlink.Link, ip string, nodeIP string, addRoute bool) error {
			panic("mock out the ipAddrAdd method")
		},
		ipAddrDelFunc: func(iface netlink.Link, ip string, nodeIP string) error {
			panic("mock out the ipAddrDel method")
		},
		ipvsAddFWMarkServiceFunc: func(svcs []*ipvs.Service, fwMark uint32, family uint16, protocol uint16, port uint16, persistent bool, persistentTimeout int32, scheduler string, flags schedFlags) (*ipvs.Service, error) {
			panic("mock out the ipvsAddFWMarkService method")
		},
		ipvsAddServerFunc: func(ipvsSvc *ipvs.Service, ipvsDst *ipvs.Destination) error {
			panic("mock out the ipvsAddServer method")
		},
		ipvsAddServiceFunc: func(svcs []*ipvs.Service, vip net.IP, protocol uint16, port uint16, persistent bool, persistentTimeout int32, scheduler string, flags schedFlags) ([]*ipvs.Service, *ipvs.Service, error) {
			panic("mock out the ipvsAddService method")
		},
		ipvsDelDestinationFunc: func(ipvsSvc *ipvs.Service, ipvsDst *ipvs.Destination) error {
			panic("mock out the ipvsDelDestination method")
		},
		ipvsDelServiceFunc: func(ipvsSvc *ipvs.Service) error {
			panic("mock out the ipvsDelService method")
		},
		ipvsGetDestinationsFunc: func(ipvsSvc *ipvs.Service) ([]*ipvs.Destination, error) {
			panic("mock out the ipvsGetDestinations method")
		},
		ipvsGetServicesFunc: func() ([]*ipvs.Service, error) {
			panic("mock out the ipvsGetServices method")
		},
		ipvsNewDestinationFunc: func(ipvsSvc *ipvs.Service, ipvsDst *ipvs.Destination) error {
			panic("mock out the ipvsNewDestination method")
		},
		ipvsNewServiceFunc: func(ipvsSvc *ipvs.Service) error {
			panic("mock out the ipvsNewService method")
		},
		ipvsUpdateDestinationFunc: func(ipvsSvc *ipvs.Service, ipvsDst *ipvs.Destination) error {
			panic("mock out the ipvsUpdateDestination method")
		},
		ipvsUpdateServiceFunc: func(ipvsSvc *ipvs.Service) error {
			panic("mock out the ipvsUpdateService method")
		},
		prepareEndpointForDsrWithCRIFunc: func(runtimeEndpoint string, containerID string, endpointIP string, vip string) error {
			panic("mock out the prepareEndpointForDsrWithCRI method")
		},
		prepareEndpointForDsrWithDockerFunc: func(containerID string, endpointIP string, vip string) error {
			panic("mock out the prepareEndpointForDsrWithDocker method")
		},
		setupPolicyRoutingForDSRFunc: func(setupIPv4 bool, setupIPv6 bool) error {
			panic("mock out the setupPolicyRoutingForDSR method")
		},
		setupRoutesForExternalIPForDSRFunc: func(serviceInfo serviceInfoMap, setupIPv4 bool, setupIPv6 bool) error {
			panic("mock out the setupRoutesForExternalIPForDSR method")
		},
	}

	// use mockedLinuxNetworking in code that requires LinuxNetworking
	// and then make assertions.

}

type NetworkServicesController

type NetworkServicesController struct {
	MetricsEnabled bool

	ProxyFirewallSetup *sync.Cond

	EndpointSliceEventHandler cache.ResourceEventHandler
	ServiceEventHandler       cache.ResourceEventHandler
	// contains filtered or unexported fields
}

NetworkServicesController struct stores information needed by the controller

func NewNetworkServicesController

func NewNetworkServicesController(clientset kubernetes.Interface,
	config *options.KubeRouterConfig, svcInformer cache.SharedIndexInformer,
	epSliceInformer cache.SharedIndexInformer, podInformer cache.SharedIndexInformer,
	ipsetMutex *sync.Mutex) (*NetworkServicesController, error)

NewNetworkServicesController returns NetworkServicesController object

func (*NetworkServicesController) Cleanup

func (nsc *NetworkServicesController) Cleanup()

Cleanup cleans all the configurations (IPVS, iptables, links) done

func (*NetworkServicesController) OnEndpointsUpdate

func (nsc *NetworkServicesController) OnEndpointsUpdate(es *discovery.EndpointSlice)

OnEndpointsUpdate handle change in endpoints update from the API server

func (*NetworkServicesController) OnServiceUpdate

func (nsc *NetworkServicesController) OnServiceUpdate(svc *v1.Service)

OnServiceUpdate handle change in service update from the API server

func (*NetworkServicesController) Run

func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.ControllerHeartbeat,
	stopCh <-chan struct{}, wg *sync.WaitGroup)

Run periodically sync ipvs configuration to reflect desired state of services and endpoints

Jump to

Keyboard shortcuts

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