Documentation ¶
Index ¶
- Constants
- Variables
- type LinuxNetworking
- type LinuxNetworkingMock
- type NetworkServicesController
- func (nsc *NetworkServicesController) Cleanup()
- func (nsc *NetworkServicesController) OnEndpointsUpdate(obj interface{})
- func (nsc *NetworkServicesController) OnServiceUpdate(obj interface{})
- func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.ControllerHeartbeat, stopCh <-chan struct{}, ...) error
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("TODO: mock out the cleanupMangleTableRule method") }, getKubeDummyInterfaceFunc: func() (netlink.Link, error) { panic("TODO: mock out the getKubeDummyInterface method") }, ipAddrAddFunc: func(iface netlink.Link, ip string, addRoute bool) error { panic("TODO: mock out the ipAddrAdd method") }, ipAddrDelFunc: func(iface netlink.Link, ip string) error { panic("TODO: mock out the ipAddrDel method") }, ipvsAddFWMarkServiceFunc: func(vip net.IP, protocol uint16, port uint16, persistent bool, scheduler string, flags schedFlags) (*ipvs.Service, error) { panic("TODO: mock out the ipvsAddFWMarkService method") }, ipvsAddServerFunc: func(ipvsSvc *ipvs.Service, ipvsDst *ipvs.Destination) error { panic("TODO: 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("TODO: mock out the ipvsAddService method") }, ipvsDelDestinationFunc: func(ipvsSvc *ipvs.Service, ipvsDst *ipvs.Destination) error { panic("TODO: mock out the ipvsDelDestination method") }, ipvsDelServiceFunc: func(ipvsSvc *ipvs.Service) error { panic("TODO: mock out the ipvsDelService method") }, ipvsGetDestinationsFunc: func(ipvsSvc *ipvs.Service) ([]*ipvs.Destination, error) { panic("TODO: mock out the ipvsGetDestinations method") }, ipvsGetServicesFunc: func() ([]*ipvs.Service, error) { panic("TODO: mock out the ipvsGetServices method") }, ipvsNewDestinationFunc: func(ipvsSvc *ipvs.Service, ipvsDst *ipvs.Destination) error { panic("TODO: mock out the ipvsNewDestination method") }, ipvsNewServiceFunc: func(ipvsSvc *ipvs.Service) error { panic("TODO: mock out the ipvsNewService method") }, ipvsUpdateDestinationFunc: func(ipvsSvc *ipvs.Service, ipvsDst *ipvs.Destination) error { panic("TODO: mock out the ipvsUpdateDestination method") }, ipvsUpdateServiceFunc: func(ipvsSvc *ipvs.Service) error { panic("TODO: mock out the ipvsUpdateService method") }, prepareEndpointForDsrFunc: func(containerId string, endpointIP string, vip string) error { panic("TODO: mock out the prepareEndpointForDsr method") }, setupPolicyRoutingForDSRFunc: func() error { panic("TODO: mock out the setupPolicyRoutingForDSR method") }, setupRoutesForExternalIPForDSRFunc: func(in1 serviceInfoMap) error { panic("TODO: mock out the setupRoutesForExternalIPForDSR method") }, } // TODO: 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) error
Run periodically sync ipvs configuration to reflect desired state of services and endpoints
Click to show internal directories.
Click to hide internal directories.