manager

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BGP_TYPE_GOBGP string = "gobgp"
	BGP_TYPE_NONE  string = "none"
)
View Source
const (
	SET_INTERNAL string = "k8s_internal_net"
	SET_EIP      string = "kube-eip-eip"
	SET_VMI      string = "kube-eip-vmi"
)
View Source
const (
	MDDir              string = "/var/run/eip_agent"
	MD_STATUS_FINISHED string = "Finished"
	MD_STATUS_FAILED   string = "Failed"
)
View Source
const (
	CHAIN_PREROUTING  string = "KUBE-EIP-PREROUTING"
	CHAIN_POSTROUTING string = "KUBE-EIP-POSTROUTING"
)
View Source
const (
	RouteTableIdx  int    = 1001
	RouteTableName string = "eip_route"
	RouteTableFile string = "/etc/iproute2/rt_tables"
	CNIDevName     string = "cni0"
)

Variables

This section is empty.

Functions

func RegisterAndRunArpManager

func RegisterAndRunArpManager(dev string) error

func RegisterBgpManager

func RegisterBgpManager(bgpType string) error

func RegisterIPSetMgr

func RegisterIPSetMgr() error

func RegisterIptablesMgr

func RegisterIptablesMgr() error

func RegisterManagers

func RegisterManagers(gwIP net.IP, gwDev, bgpType, eipCidr string, arpPoisoning bool, internal_net ...string) error

func RegisterRouteMgr

func RegisterRouteMgr(gwIP net.IP, gwDev string, eipCidr string, internalAddrs []string) error

Types

type ArpManager

type ArpManager interface {
	AddTarget(string)
	DeleteTarget(string)
	Poisoning()
}
var ArpMgr ArpManager

type BgpManager

type BgpManager interface {
}

BgpManager use to sync ipv4 route to eip router There are two type of bgp manager, gobgp or nobgp Add a eip arp proxy or add eip to gateway device directly.

var BgpMgr BgpManager

type CmdIpsetMgr

type CmdIpsetMgr struct {
	// contains filtered or unexported fields
}

func (*CmdIpsetMgr) AddIPToSet

func (ipset *CmdIpsetMgr) AddIPToSet(name string, ip net.IP) error

func (*CmdIpsetMgr) AddSetAndEntries

func (ipset *CmdIpsetMgr) AddSetAndEntries(name, setType string, entries ...string) error

func (*CmdIpsetMgr) DeleteFromSet

func (ipset *CmdIpsetMgr) DeleteFromSet(name string, ip net.IP) error

func (*CmdIpsetMgr) SetupIpset

func (ipset *CmdIpsetMgr) SetupIpset(name, setType string, entries ...string) error

type EipManager

type EipManager interface {
	BindEip() (int, error)
	UnbindEip() (int, error)
}

type EipMetadata

type EipMetadata struct {
	Status     string `json:"status"`
	ExternalIP string `json:"exip"`
	InternalIP string `json:"inip"`
	Phase      int    `json:"phase"`
}

type EipMgr

type EipMgr struct {
	IPSetMgr IpsetManager
	NatMgr   NatManager
	RouteMgr RouteManager
	BgpMgr   BgpManager
	ArpMgr   ArpManager

	ExternalIP net.IP
	InternalIP net.IP
}

func (*EipMgr) BindEip

func (mgr *EipMgr) BindEip() (int, error)

func (*EipMgr) UnbindEip

func (mgr *EipMgr) UnbindEip() (int, error)

type GobgpMgr

type GobgpMgr struct {
}

func (*GobgpMgr) AsignEipToIface

func (mgr *GobgpMgr) AsignEipToIface(ifaceName string, addr net.IP) error

type IpsetManager

type IpsetManager interface {
	AddSetAndEntries(string, string, ...string) error
	SetupIpset(string, string, ...string) error
	AddIPToSet(string, net.IP) error
	DeleteFromSet(string, net.IP) error
}
var IpsetMgr IpsetManager

type IptablesMgr

type IptablesMgr struct {
	// contains filtered or unexported fields
}

func (*IptablesMgr) AddPostroutingRule

func (iptables *IptablesMgr) AddPostroutingRule(eip, vmiIp net.IP, internalSet string) error

func (*IptablesMgr) AddPreroutingRule

func (iptables *IptablesMgr) AddPreroutingRule(eip, vmiIp net.IP) error

func (*IptablesMgr) DeletePostroutingRule

func (iptables *IptablesMgr) DeletePostroutingRule(eip, vmiIp net.IP, internalSet string) error

func (*IptablesMgr) DeletePreroutingRule

func (iptables *IptablesMgr) DeletePreroutingRule(eip, vmiIp net.IP) error

func (*IptablesMgr) SetupChains

func (iptables *IptablesMgr) SetupChains(eipset, vmiSet string) error

type NatManager

type NatManager interface {
	SetupChains(string, string) error
	AddPreroutingRule(net.IP, net.IP) error
	AddPostroutingRule(net.IP, net.IP, string) error
	DeletePreroutingRule(net.IP, net.IP) error
	DeletePostroutingRule(net.IP, net.IP, string) error
}
var IptablesNatMgr NatManager

type NoBgpMgr

type NoBgpMgr struct {
}

func (*NoBgpMgr) AsignEipToIface

func (mgr *NoBgpMgr) AsignEipToIface(ifaceName string, addr net.IP) error

type PolicyRouteMgr

type PolicyRouteMgr struct {
	InternalAddrs []string
	ExternalGWIP  net.IP
	ExternalGWDev string
	// contains filtered or unexported fields
}

func (*PolicyRouteMgr) AddEipRule

func (mgr *PolicyRouteMgr) AddEipRule(vmiIp net.IP) error

func (*PolicyRouteMgr) AddEipToIface

func (mgr *PolicyRouteMgr) AddEipToIface(eip net.IP) error

func (*PolicyRouteMgr) DeleteEipRule

func (mgr *PolicyRouteMgr) DeleteEipRule(vmiIp net.IP) error

func (*PolicyRouteMgr) RemoveEipFromIface

func (mgr *PolicyRouteMgr) RemoveEipFromIface(eip net.IP) error

func (*PolicyRouteMgr) SetupRoute

func (mgr *PolicyRouteMgr) SetupRoute() error

type RouteManager

type RouteManager interface {
	SetupRoute() error
	AddEipRule(net.IP) error
	DeleteEipRule(net.IP) error
	AddEipToIface(net.IP) error
	RemoveEipFromIface(net.IP) error
}
var RouteMgr RouteManager

Jump to

Keyboard shortcuts

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