Documentation
¶
Index ¶
- Constants
- type Config
- type HostInterface
- func (hi *HostInterface) AddContainerLink(namespace, ifname string, addr *net.IPNet) (int, error)
- func (hi *HostInterface) Delete() error
- func (hi *HostInterface) DeleteContainerLink(namespace, name string) error
- func (hi *HostInterface) GetGateway() *net.IPNet
- func (hi *HostInterface) GetOption(opt string) (string, bool)
- type Lock
- type Vxlan
Constants ¶
const ( //DefaultIPAMTimeout is how long to wait for the IPAM plugin DefaultIPAMTimeout = 10 //DefaultLockPath is the default path to store vxlan locks DefaultLockPath = "/tmp" //DefaultLockExt is the default extension of the lock file DefaultLockExt = ".lock" //DefaultVxlanRouteTable is the route table number used to store routes that override the /32 routes DefaultVxlanRouteTable = 192 //NetworkAnnotation is the string key where we search for the name of the vxlan to join NetworkAnnotation = "vxlan-cni.phdata.io/NetworkName" //AddressAnnotation is the string key where we search for the IP address requested AddressAnnotation = "vxlan-cni.phdata.io/RequestedAddress" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
*cni.Config
DefaultNetwork string `json:"defaultNetwork"`
K8sNetworkFromNamespace bool `json:"k8sNetworkFromNamespace"`
K8sReadAnnotations bool `json:"k8sReadAnnotations"`
K8sConfigPath string `json:"k8sConfigPath"`
Vxlans []*Vxlan `json:"vxlans"`
}
Config is the cni config extended with our required attributes
type HostInterface ¶
type HostInterface struct {
VxlanParams *Vxlan
// 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 GetOrCreateHostInterface ¶
func GetOrCreateHostInterface(vxlan *Vxlan) (*HostInterface, error)
GetOrCreateHostInterface creates required host interfaces if they don't exist, or gets them if they already do
func (*HostInterface) AddContainerLink ¶
AddContainerLink adds a new macvlan link to the vxlan link, adds an IP, and puts it in the requested namespace.
func (*HostInterface) Delete ¶
func (hi *HostInterface) Delete() error
Delete removes the components of the host interface from the host
func (*HostInterface) DeleteContainerLink ¶
func (hi *HostInterface) DeleteContainerLink(namespace, name string) error
DeleteContainerLink deletes the containers interface
func (*HostInterface) GetGateway ¶
func (hi *HostInterface) GetGateway() *net.IPNet
GetGateway gets the gateway address and subnet from the vxlan config
type Lock ¶
type Lock struct {
Name string
// contains filtered or unexported fields
}
Lock represents a filesystem based mutex on a whole vxlan this allows us to effectively serialize any accesses to an individual network's interfaces
type Vxlan ¶
type Vxlan struct {
ID int `json:"id"`
Name string `json:"name"`
Cidr string `json:"cidr"`
ExcludeFirst int `json:"excludeFirst"`
ExcludeLast int `json:"excludeLast"`
Options map[string]string `json:"options"`
MTU int `json:"mtu"`
}
Vxlan represents the configuration for an overlay broadcast domain