proxy

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2020 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KUBE_DUMMY_IF       = "kube-dummy-if"
	KUBE_TUNNEL_IF      = "kube-tunnel-if"
	IFACE_NOT_FOUND     = "Link not found"
	IFACE_HAS_ADDR      = "file exists"
	IFACE_HAS_NO_ADDR   = "cannot assign requested address"
	IPVS_SERVER_EXISTS  = "file exists"
	IPVS_MAGLEV_HASHING = "mh"
	IPVS_SVC_F_SCHED1   = "flag-1"
	IPVS_SVC_F_SCHED2   = "flag-2"
	IPVS_SVC_F_SCHED3   = "flag-3"

	LeaderElectionRecordAnnotationKey = "control-plane.alpha.kubernetes.io/leader"
)

Variables

View Source
var (
	NodeIP net.IP
)

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{
            cleanupMangleTableRuleFunc: func(ip string, protocol string, port string, fwmark string) error {
	               panic("mock out the cleanupMangleTableRule method")
            },
            getKubeDummyInterfaceFunc: func() (netlink.Link, error) {
	               panic("mock out the getKubeDummyInterface method")
            },
            ipAddrAddFunc: func(iface netlink.Link, ip string, addRoute bool) error {
	               panic("mock out the ipAddrAdd method")
            },
            ipAddrDelFunc: func(iface netlink.Link, ip string) error {
	               panic("mock out the ipAddrDel method")
            },
            ipvsAddFWMarkServiceFunc: func(vip net.IP, protocol uint16, port uint16, persistent bool, 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, scheduler string, flags schedFlags) (*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")
            },
            prepareEndpointForDsrFunc: func(containerId string, endpointIP string, vip string) error {
	               panic("mock out the prepareEndpointForDsr method")
            },
            setupPolicyRoutingForDSRFunc: func() error {
	               panic("mock out the setupPolicyRoutingForDSR method")
            },
            setupRoutesForExternalIPForDSRFunc: func(in1 serviceInfoMap) 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

	ServiceEventHandler   cache.ResourceEventHandler
	EndpointsEventHandler 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,
	epInformer cache.SharedIndexInformer, podInformer cache.SharedIndexInformer) (*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(obj interface{})

OnEndpointsUpdate handle change in endpoints update from the API server

func (*NetworkServicesController) OnServiceUpdate

func (nsc *NetworkServicesController) OnServiceUpdate(obj interface{})

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