hostint

package
v0.0.0-...-de3c925 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//DefaultVxlanRouteTable is the table index to store routes for directly connected networks
	//this is necessary because the host prefixes are more specific and otherwise cause packets
	//to be routed for directly connected networks
	DefaultVxlanRouteTable = 192
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HostInterface

type HostInterface struct {
	VxlanParams *vxlan.Vxlan
	Gateway     *net.IPNet
	Prefix      *net.IPNet
	// contains filtered or unexported fields
}

HostInterface represents the host's connection to the vxlan It must be made up of both a "vxlan" interface which participates in the cluster's vxlan and a "macvlan" slave of the vxlan interface which acts as the hosts connection to that vxlan the hosts address gets isntalled on the macvlan

func Get

func Get(vxlan *vxlan.Vxlan, ipm *ipam.Ipam) (*HostInterface, error)

Get returns an existing valid host interface if the links exist, or an error if the host interface is not valid or otherwise paritially configured it will delete the remnants to allow a create to be called.

func GetOrCreate

func GetOrCreate(vxlan *vxlan.Vxlan, ipm *ipam.Ipam) (*HostInterface, error)

GetOrCreate creates required host interfaces if they don't exist, or gets them if they already do

func (hi *HostInterface) AddContainerLink(namespace, ifname string, addr *net.IPNet) (int, error)

AddContainerLink adds a new macvlan link to the vxlan link, adds an IP, and puts it in the requested namespace.

func (hi *HostInterface) DeleteContainerLink(namespace, name string) error

DeleteContainerLink deletes the containers interface

func (hi *HostInterface) DeleteLinks()

DeleteLinks removes the components of the host interface from the host

func (*HostInterface) GetMVLinkIndex

func (hi *HostInterface) GetMVLinkIndex() (int, error)

GetMVLinkIndex gets the link index for the host's macvlan

func (*HostInterface) GetOption

func (hi *HostInterface) GetOption(opt string) (string, bool)

GetOption gets the names vxlan option from the options map

func (*HostInterface) GetVXLinkIndex

func (hi *HostInterface) GetVXLinkIndex() (int, error)

GetVXLinkIndex gets the link index for the host's vxlan

func (*HostInterface) NumContainers

func (hi *HostInterface) NumContainers() (int, error)

NumContainers returns the number of network namespaces with child interfaces of the host's vxlan

Jump to

Keyboard shortcuts

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