Documentation
¶
Index ¶
- Constants
- func EnsureSysctl(sysctl sysInterface, name string, newVal int) error
- func GetRequiredIPVSModules(kernelVersion *version.Version) []string
- func NewSysInterface() sysInterface
- type Destination
- type KernelHandler
- type LinuxKernelHandler
- type Manager
- func (m *Manager) AddDestination(destination *Destination, virtualServer *VirtualServer)
- func (m *Manager) Apply()
- func (m *Manager) ApplyServer(virtualServer *VirtualServer)
- func (m *Manager) BindServerToInterface(server *VirtualServer)
- func (m *Manager) Done()
- func (m *Manager) Reset()
- func (m *Manager) Setup() error
- type VirtualServer
Constants ¶
const ( // KernelModuleIPVS is the kernel module "ip_vs" KernelModuleIPVS string = "ip_vs" // KernelModuleIPVSRR is the kernel module "ip_vs_rr" KernelModuleIPVSRR string = "ip_vs_rr" // KernelModuleIPVSWRR is the kernel module "ip_vs_wrr" KernelModuleIPVSWRR string = "ip_vs_wrr" // KernelModuleIPVSSH is the kernel module "ip_vs_sh" KernelModuleIPVSSH string = "ip_vs_sh" // KernelModuleNfConntrackIPV4 is the module "nf_conntrack_ipv4" KernelModuleNfConntrackIPV4 string = "nf_conntrack_ipv4" // KernelModuleNfConntrack is the kernel module "nf_conntrack" KernelModuleNfConntrack string = "nf_conntrack" )
IPVS required kernel modules.
Variables ¶
This section is empty.
Functions ¶
func EnsureSysctl ¶
EnsureSysctl sets a kernel sysctl to a given numeric value.
func GetRequiredIPVSModules ¶
GetRequiredIPVSModules returns the required ipvs modules for the given linux kernel version.
func NewSysInterface ¶
func NewSysInterface() sysInterface
New returns a new Interface for accessing sysctl
Types ¶
type Destination ¶
Destination represents a virtual server's destination. This structure should not hold any static information (e.g. weight) to save memory. The data types of this structure should match the data types given by the KPNG server to avoid type casting and parsing, saving cpu.
func (*Destination) Equal ¶
func (d *Destination) Equal(o *Destination) bool
Equal compares two destinations and their virtual servers, is used for diffstore equality assertion.
func (*Destination) IPPort ¶
func (d *Destination) IPPort() string
IPPort return combination of IP and Port for the destination.
func (*Destination) Key ¶
func (d *Destination) Key() string
Key returns a combination of ip, port and protocol of the virtual server.
type KernelHandler ¶
KernelHandler can handle the current installed kernel modules.
type LinuxKernelHandler ¶
type LinuxKernelHandler struct {
// contains filtered or unexported fields
}
LinuxKernelHandler implements KernelHandler interface.
func NewLinuxKernelHandler ¶
func NewLinuxKernelHandler() *LinuxKernelHandler
NewLinuxKernelHandler initializes LinuxKernelHandler with exec.
func (*LinuxKernelHandler) GetKernelVersion ¶
func (handle *LinuxKernelHandler) GetKernelVersion() (string, error)
GetKernelVersion returns currently running kernel version.
func (*LinuxKernelHandler) GetModules ¶
func (handle *LinuxKernelHandler) GetModules() ([]string, error)
GetModules returns all installed kernel modules.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager acts as a proxy between backend and IPVS operations, leverages diffstore to maintain state, executes only the changes when triggered by backend.
func NewManager ¶
func (*Manager) AddDestination ¶
func (m *Manager) AddDestination(destination *Destination, virtualServer *VirtualServer)
AddDestination instead of directly adding destination to virtual server, adds destination to destination diffstore, actions will be taken only in case of create, update and delete.
func (*Manager) Apply ¶
func (m *Manager) Apply()
Apply has side effects. Apply should be called after processing fullstate callback, done will iterate over changes from all the diffstores and create, update and delete required objects accordingly.
func (*Manager) ApplyServer ¶
func (m *Manager) ApplyServer(virtualServer *VirtualServer)
ApplyServer instead of directly creating the server, adds the server config to the service diffstore, actions will be taken only in case of create, update and delete.
func (*Manager) BindServerToInterface ¶
func (m *Manager) BindServerToInterface(server *VirtualServer)
BindServerToInterface instead of directly binding ip to interface, adds it to the ip store. actions will be taken only in case of create and delete.
func (*Manager) Done ¶
func (m *Manager) Done()
Done calls Done on all diffstores for computing diffs.
type VirtualServer ¶
VirtualServer represents a virtual server. This structure should not hold any static information (eg. scheduling method) to save memory. The data types of this structure should match the data types given by the KPNG server to avoid type casting and parsing, saving cpu.
func (VirtualServer) Equal ¶
func (vs VirtualServer) Equal(o *VirtualServer) bool
Equal compares two virtual servers, is used for diffstore equality assertion.
func (VirtualServer) IPPort ¶
func (vs VirtualServer) IPPort() string
IPPort return combination of IP and port for the server
func (VirtualServer) Key ¶
func (vs VirtualServer) Key() string
Key returns a combination of IP, Port and Protocol of the virtual server.