ipvs

package
v1.14.4-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FlagPersistent specify IPVS service session affinity
	FlagPersistent = 0x1
	// FlagHashed specify IPVS service hash flag
	FlagHashed = 0x2
	// IPVSProxyMode is match set up cluster with ipvs proxy model
	IPVSProxyMode = "ipvs"
)
View Source
const (
	// ModIPVS is the kernel module "ip_vs"
	ModIPVS string = "ip_vs"
	// ModIPVSRR is the kernel module "ip_vs_rr"
	ModIPVSRR string = "ip_vs_rr"
	// ModIPVSWRR is the kernel module "ip_vs_wrr"
	ModIPVSWRR string = "ip_vs_wrr"
	// ModIPVSSH is the kernel module "ip_vs_sh"
	ModIPVSSH string = "ip_vs_sh"
	// ModNfConntrackIPV4 is the module "nf_conntrack_ipv4"
	ModNfConntrackIPV4 string = "nf_conntrack_ipv4"
	// ModNfConntrack is the kernel module "nf_conntrack"
	ModNfConntrack string = "nf_conntrack"
)

IPVS required kernel modules.

Variables

This section is empty.

Functions

func GetKernelVersionAndIPVSMods added in v1.13.0

func GetKernelVersionAndIPVSMods(Executor exec.Interface) (kernelVersion string, ipvsModules []string, err error)

GetKernelVersionAndIPVSMods returns the linux kernel version and the required ipvs modules

Types

type Interface

type Interface interface {
	// Flush clears all virtual servers in system. return occurred error immediately.
	Flush() error
	// AddVirtualServer creates the specified virtual server.
	AddVirtualServer(*VirtualServer) error
	// UpdateVirtualServer updates an already existing virtual server.  If the virtual server does not exist, return error.
	UpdateVirtualServer(*VirtualServer) error
	// DeleteVirtualServer deletes the specified virtual server.  If the virtual server does not exist, return error.
	DeleteVirtualServer(*VirtualServer) error
	// Given a partial virtual server, GetVirtualServer will return the specified virtual server information in the system.
	GetVirtualServer(*VirtualServer) (*VirtualServer, error)
	// GetVirtualServers lists all virtual servers in the system.
	GetVirtualServers() ([]*VirtualServer, error)
	// AddRealServer creates the specified real server for the specified virtual server.
	AddRealServer(*VirtualServer, *RealServer) error
	// GetRealServers returns all real servers for the specified virtual server.
	GetRealServers(*VirtualServer) ([]*RealServer, error)
	// DeleteRealServer deletes the specified real server from the specified virtual server.
	DeleteRealServer(*VirtualServer, *RealServer) error
	// UpdateRealServer updates the specified real server from the specified virtual server.
	UpdateRealServer(*VirtualServer, *RealServer) error
}

Interface is an injectable interface for running ipvs commands. Implementations must be goroutine-safe.

func New

func New(exec utilexec.Interface) Interface

New returns a new Interface which will call ipvs APIs.

type Protocol added in v1.10.0

type Protocol uint16

Protocol is the IPVS service protocol type

type RealServer

type RealServer struct {
	Address      net.IP
	Port         uint16
	Weight       int
	ActiveConn   int
	InactiveConn int
}

RealServer is an user-oriented definition of an IPVS real server in its entirety.

func (*RealServer) Equal added in v1.9.0

func (rs *RealServer) Equal(other *RealServer) bool

Equal check the equality of real server. We don't use struct == since it doesn't work because of slice.

func (*RealServer) String

func (rs *RealServer) String() string

type RequiredIPVSKernelModulesAvailableCheck added in v1.11.0

type RequiredIPVSKernelModulesAvailableCheck struct {
	Executor utilsexec.Interface
}

RequiredIPVSKernelModulesAvailableCheck tests IPVS required kernel modules.

func (RequiredIPVSKernelModulesAvailableCheck) Check added in v1.11.0

func (r RequiredIPVSKernelModulesAvailableCheck) Check() (warnings, errors []error)

Check try to validates IPVS required kernel modules exists or not. The name of function can not be changed.

func (RequiredIPVSKernelModulesAvailableCheck) Name added in v1.11.0

Name returns label for RequiredIPVSKernelModulesAvailableCheck

type ServiceFlags

type ServiceFlags uint32

ServiceFlags is used to specify session affinity, ip hash etc.

type VirtualServer

type VirtualServer struct {
	Address   net.IP
	Protocol  string
	Port      uint16
	Scheduler string
	Flags     ServiceFlags
	Timeout   uint32
}

VirtualServer is an user-oriented definition of an IPVS virtual server in its entirety.

func (*VirtualServer) Equal

func (svc *VirtualServer) Equal(other *VirtualServer) bool

Equal check the equality of virtual server. We don't use struct == since it doesn't work because of slice.

func (*VirtualServer) String

func (svc *VirtualServer) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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