Documentation
¶
Index ¶
- Constants
- func NewHairpinController(nsc *NetworkServicesController, endpointCh <-chan string) *hairpinController
- func NewNodePortHealthCheck() *nodePortHealthCheckController
- type LinuxNetworking
- type LinuxNetworkingMock
- type NetworkServicesController
- func (nsc *NetworkServicesController) Cleanup()
- func (nsc *NetworkServicesController) OnEndpointsUpdate(es *discovery.EndpointSlice)
- func (nsc *NetworkServicesController) OnServiceUpdate(svc *v1.Service)
- func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.ControllerHeartbeat, stopCh <-chan struct{}, ...)
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 ¶
func NewHairpinController ¶ added in v2.1.0
func NewHairpinController(nsc *NetworkServicesController, endpointCh <-chan string) *hairpinController
func NewNodePortHealthCheck ¶ added in v2.1.0
func NewNodePortHealthCheck() *nodePortHealthCheckController
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")
},
findIfaceLinkForPidFunc: func(pid int) (int, error) {
panic("mock out the findIfaceLinkForPid method")
},
getContainerPidWithCRIFunc: func(runtimeEndpoint string, containerID string) (int, error) {
panic("mock out the getContainerPidWithCRI method")
},
getContainerPidWithDockerFunc: func(containerID string) (int, error) {
panic("mock out the getContainerPidWithDocker 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")
},
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
Click to show internal directories.
Click to hide internal directories.