Documentation
¶
Index ¶
- Constants
- func CheckBridgeExists(ctx context.Context, n Node) error
- func CheckEndpointDoesNotExistYet(ctx context.Context, e Endpoint) error
- func CheckEndpointExists(ctx context.Context, e Endpoint) error
- func CheckEndpointUniqueness(e Endpoint) error
- func IsValidInterfaceName(ifaceName string) bool
- func SanitizeInterfaceName(ifaceName string) string
- func SetMgmtNetUnderlyingBridge(bridge string) error
- func SetNameMACAndUpInterface(l netlink.Link, endpt Endpoint) func(ns.NetNS) error
- type Bridge
- type Endpoint
- type EndpointBridge
- type EndpointDummy
- type EndpointGeneric
- func (e *EndpointGeneric) GetIPv4Addr() netip.Prefix
- func (e *EndpointGeneric) GetIPv6Addr() netip.Prefix
- func (e *EndpointGeneric) GetIfaceAlias() string
- func (e *EndpointGeneric) GetIfaceDisplayName() string
- func (e *EndpointGeneric) GetIfaceName() string
- func (e *EndpointGeneric) GetLink() Link
- func (e *EndpointGeneric) GetMac() net.HardwareAddr
- func (e *EndpointGeneric) GetNode() Node
- func (e *EndpointGeneric) GetRandIfaceName() string
- func (e *EndpointGeneric) GetVars() map[string]any
- func (e *EndpointGeneric) HasSameNodeAndInterface(ept Endpoint) bool
- func (e *EndpointGeneric) Remove(ctx context.Context) error
- func (e *EndpointGeneric) SetIfaceAlias(ifaceAlias string)
- func (e *EndpointGeneric) SetIfaceName(ifaceName string)
- func (e *EndpointGeneric) String() string
- type EndpointHost
- type EndpointMacVlan
- type EndpointRaw
- type EndpointVeth
- type EndpointVxlan
- type GenericLinkNode
- func (g *GenericLinkNode) AddEndpoint(e Endpoint) error
- func (g *GenericLinkNode) AddLinkToContainer(_ context.Context, link netlink.Link, f func(ns.NetNS) error) error
- func (g *GenericLinkNode) Delete(ctx context.Context) error
- func (g *GenericLinkNode) ExecFunction(_ context.Context, f func(ns.NetNS) error) error
- func (g *GenericLinkNode) GetEndpoints() []Endpoint
- func (g *GenericLinkNode) GetShortName() string
- func (*GenericLinkNode) GetState() clabnodesstate.NodeState
- type Link
- type LinkBriefRaw
- type LinkCommonParams
- type LinkDefinition
- type LinkDeploymentState
- type LinkDummy
- type LinkDummyRaw
- type LinkEndpointType
- type LinkHostRaw
- type LinkMacVlan
- type LinkMacVlanRaw
- type LinkMgmtNetRaw
- type LinkType
- type LinkVEth
- type LinkVEthRaw
- type LinkVxlan
- type LinkVxlanRaw
- type MacVlanMode
- type Node
- type RawLink
- type ResolveParams
- type VerifyLinkParams
- type VxlanStitched
- func (l *VxlanStitched) Deploy(ctx context.Context, ep Endpoint) error
- func (l *VxlanStitched) DeployWithExistingVeth(ctx context.Context) error
- func (l *VxlanStitched) GetEndpoints() []Endpoint
- func (*VxlanStitched) GetType() LinkType
- func (l *VxlanStitched) Remove(ctx context.Context) error
- func (l *VxlanStitched) Stitch() error
Constants ¶
const ( LinkDeploymentStateNotDeployed = iota // LinkDeploymentStateHalfDeployed is a state in which one of the endpoints // of the links finished deploying and the other one is not yet deployed. LinkDeploymentStateHalfDeployed LinkDeploymentStateFullDeployed LinkDeploymentStateRemoved )
const ( LinkEndpointTypeVeth = "veth" LinkEndpointTypeBridge = "bridge" LinkEndpointTypeBridgeNS = "bridge-ns" LinkEndpointTypeHost = "host" )
const ( MacVlanModeBridge = "bridge" MacVlanModeVepa = "vepa" MacVlanModePassthru = "passthru" MacVlanModePrivate = "private" MacVlanModeSource = "source" )
const ( // vxlan port is different from the default port number 4789 // since 4789 may be filtered by the firewalls or clash with other overlay services. VxLANDefaultPort = 14789 )
Variables ¶
This section is empty.
Functions ¶
func CheckBridgeExists ¶
CheckBridgeExists verifies that the given bridge is present in the network namespace referenced via the provided nspath handle.
func CheckEndpointDoesNotExistYet ¶
CheckEndpointDoesNotExistYet verifies that the interface referenced in the provided endpoint does not yet exist in the referenced node.
func CheckEndpointExists ¶
CheckEndpointExists checks that a certain interface exists in the network namespace of the given node.
func CheckEndpointUniqueness ¶
CheckEndpointUniqueness checks that the given endpoint appears only once for the node it is assigned to.
func IsValidInterfaceName ¶ added in v0.56.0
IsValidInterfaceName checks if the interface name is valid by checking its length and the presence of spaces or slashes.
func SanitizeInterfaceName ¶ added in v0.70.0
SanitizeInterfaceName sanitizes the interface name by replacing '/' and ' ' with '-'. Making it suitable to write as AltName for the interface.
func SetMgmtNetUnderlyingBridge ¶ added in v0.61.0
Types ¶
type Bridge ¶ added in v0.69.0
type Bridge struct {
LinkCommonParams
// contains filtered or unexported fields
}
func (*Bridge) Deploy ¶ added in v0.69.0
Deploy deploys the link. Endpoint is the endpoint that triggers the creation of the link.
func (*Bridge) GetEndpoints ¶ added in v0.69.0
GetEndpoints returns the endpoints of the link.
func (*Bridge) SetEndpoint ¶ added in v0.69.0
type Endpoint ¶
type Endpoint interface {
GetNode() Node
GetIfaceName() string
GetIfaceAlias() string
GetIfaceDisplayName() string
GetRandIfaceName() string
GetMac() net.HardwareAddr
GetIPv4Addr() netip.Prefix
GetIPv6Addr() netip.Prefix
String() string
// GetLink retrieves the link that the endpoint is assigned to
GetLink() Link
// Verify verifies that the endpoint is valid and can be deployed
Verify(context.Context, *VerifyLinkParams) error
// HasSameNodeAndInterface returns true if an endpoint that implements this interface
// has the same node and interface name as the given endpoint.
HasSameNodeAndInterface(ept Endpoint) bool
Remove(context.Context) error
// Deploy deploys the endpoint by calling the Deploy method of the link it is assigned to
// and passing the endpoint as an argument so that the link that consists of A and B endpoints
// can deploy them independently.
Deploy(context.Context) error
// IsNodeless returns true for the endpoints that has no explicit node defined in the topology.
// E.g. host endpoints, mgmt bridge endpoints.
// Because there is no node that would deploy this side of the link they should be deployed
// along
// with the A side of the veth link.
IsNodeless() bool
// Setters for ifaceName and Alias
SetIfaceName(string)
SetIfaceAlias(string)
// GetVars returns the endpoint-level vars.
GetVars() map[string]any
}
Endpoint is the interface that all endpoint types implement. Endpoints like bridge, host, veth and macvlan are the types implementing this interface.
type EndpointBridge ¶
type EndpointBridge struct {
EndpointGeneric
// contains filtered or unexported fields
}
func NewEndpointBridge ¶ added in v0.46.0
func NewEndpointBridge(eg *EndpointGeneric, isMgmtBridgeEndpoint bool) *EndpointBridge
func (*EndpointBridge) Deploy ¶ added in v0.52.0
func (e *EndpointBridge) Deploy(ctx context.Context) error
func (*EndpointBridge) IsNodeless ¶ added in v0.52.0
func (e *EndpointBridge) IsNodeless() bool
func (*EndpointBridge) Verify ¶
func (e *EndpointBridge) Verify(ctx context.Context, p *VerifyLinkParams) error
type EndpointDummy ¶ added in v0.55.0
type EndpointDummy struct {
EndpointGeneric
}
func NewEndpointDummy ¶ added in v0.55.0
func NewEndpointDummy(eg *EndpointGeneric) *EndpointDummy
func (*EndpointDummy) Deploy ¶ added in v0.55.0
func (e *EndpointDummy) Deploy(ctx context.Context) error
func (*EndpointDummy) IsNodeless ¶ added in v0.55.0
func (*EndpointDummy) IsNodeless() bool
func (*EndpointDummy) Verify ¶ added in v0.55.0
func (e *EndpointDummy) Verify(_ context.Context, _ *VerifyLinkParams) error
Verify verifies the veth based deployment pre-conditions.
type EndpointGeneric ¶
type EndpointGeneric struct {
Node Node
IfaceName string
IfaceAlias string
// Link is the link this endpoint belongs to.
Link Link
MAC net.HardwareAddr
IPv4 netip.Prefix
IPv6 netip.Prefix
Vars map[string]any
// contains filtered or unexported fields
}
EndpointGeneric is the generic endpoint struct that is used by all endpoint types.
func NewEndpointGeneric ¶
func NewEndpointGeneric(node Node, iface string, link Link) *EndpointGeneric
func (*EndpointGeneric) GetIPv4Addr ¶ added in v0.70.0
func (e *EndpointGeneric) GetIPv4Addr() netip.Prefix
func (*EndpointGeneric) GetIPv6Addr ¶ added in v0.70.0
func (e *EndpointGeneric) GetIPv6Addr() netip.Prefix
func (*EndpointGeneric) GetIfaceAlias ¶ added in v0.56.0
func (e *EndpointGeneric) GetIfaceAlias() string
func (*EndpointGeneric) GetIfaceDisplayName ¶ added in v0.56.0
func (e *EndpointGeneric) GetIfaceDisplayName() string
func (*EndpointGeneric) GetIfaceName ¶
func (e *EndpointGeneric) GetIfaceName() string
func (*EndpointGeneric) GetLink ¶
func (e *EndpointGeneric) GetLink() Link
func (*EndpointGeneric) GetMac ¶
func (e *EndpointGeneric) GetMac() net.HardwareAddr
func (*EndpointGeneric) GetNode ¶
func (e *EndpointGeneric) GetNode() Node
func (*EndpointGeneric) GetRandIfaceName ¶
func (e *EndpointGeneric) GetRandIfaceName() string
func (*EndpointGeneric) GetVars ¶ added in v0.71.0
func (e *EndpointGeneric) GetVars() map[string]any
func (*EndpointGeneric) HasSameNodeAndInterface ¶
func (e *EndpointGeneric) HasSameNodeAndInterface(ept Endpoint) bool
HasSameNodeAndInterface returns true if the given endpoint has the same node and interface name as the `ept` endpoint.
func (*EndpointGeneric) SetIfaceAlias ¶ added in v0.56.0
func (e *EndpointGeneric) SetIfaceAlias(ifaceAlias string)
func (*EndpointGeneric) SetIfaceName ¶ added in v0.56.0
func (e *EndpointGeneric) SetIfaceName(ifaceName string)
func (*EndpointGeneric) String ¶
func (e *EndpointGeneric) String() string
type EndpointHost ¶
type EndpointHost struct {
EndpointGeneric
}
func NewEndpointHost ¶ added in v0.46.0
func NewEndpointHost(eg *EndpointGeneric) *EndpointHost
func (*EndpointHost) Deploy ¶ added in v0.52.0
func (e *EndpointHost) Deploy(ctx context.Context) error
func (*EndpointHost) IsNodeless ¶ added in v0.52.0
func (e *EndpointHost) IsNodeless() bool
func (*EndpointHost) Verify ¶
func (e *EndpointHost) Verify(ctx context.Context, _ *VerifyLinkParams) error
type EndpointMacVlan ¶
type EndpointMacVlan struct {
EndpointGeneric
}
func NewEndpointMacVlan ¶ added in v0.46.0
func NewEndpointMacVlan(eg *EndpointGeneric) *EndpointMacVlan
func (*EndpointMacVlan) Deploy ¶ added in v0.52.0
func (e *EndpointMacVlan) Deploy(ctx context.Context) error
func (*EndpointMacVlan) IsNodeless ¶ added in v0.52.0
func (e *EndpointMacVlan) IsNodeless() bool
func (*EndpointMacVlan) Verify ¶
func (e *EndpointMacVlan) Verify(ctx context.Context, _ *VerifyLinkParams) error
Verify runs verification to check if the endpoint can be deployed.
type EndpointRaw ¶
type EndpointRaw struct {
Node string `yaml:"node"`
Iface string `yaml:"interface"`
MAC string `yaml:"mac,omitempty"`
IPv4 string `yaml:"ipv4,omitempty"`
IPv6 string `yaml:"ipv6,omitempty"`
Vars map[string]any `yaml:"vars,omitempty"`
}
EndpointRaw is the raw (string) representation of an endpoint as defined in the topology file for a given link definition.
func NewEndpointRaw ¶
func NewEndpointRaw(node, nodeIf, mac string) *EndpointRaw
NewEndpointRaw creates a new EndpointRaw struct.
func (*EndpointRaw) Resolve ¶
func (er *EndpointRaw) Resolve(params *ResolveParams, l Link) (Endpoint, error)
Resolve resolves the EndpointRaw into an Endpoint interface that is implemented by a concrete endpoint struct such as EndpointBridge, EndpointHost, EndpointVeth. The type of an endpoint is determined by the node it belongs to. Resolving a raw endpoint adds an associated Link and Node to the endpoint. It also adds the endpoint to the node.
type EndpointVeth ¶
type EndpointVeth struct {
EndpointGeneric
}
func NewEndpointVeth ¶ added in v0.46.0
func NewEndpointVeth(eg *EndpointGeneric) *EndpointVeth
func (*EndpointVeth) Deploy ¶ added in v0.52.0
func (e *EndpointVeth) Deploy(ctx context.Context) error
func (*EndpointVeth) IsNodeless ¶ added in v0.52.0
func (e *EndpointVeth) IsNodeless() bool
func (*EndpointVeth) Verify ¶
func (e *EndpointVeth) Verify(_ context.Context, _ *VerifyLinkParams) error
Verify verifies the veth based deployment pre-conditions.
type EndpointVxlan ¶ added in v0.46.0
type EndpointVxlan struct {
EndpointGeneric
// contains filtered or unexported fields
}
func NewEndpointVxlan ¶ added in v0.46.0
func NewEndpointVxlan(node Node, link Link) *EndpointVxlan
func (*EndpointVxlan) Deploy ¶ added in v0.52.0
func (e *EndpointVxlan) Deploy(ctx context.Context) error
func (*EndpointVxlan) IsNodeless ¶ added in v0.52.0
func (e *EndpointVxlan) IsNodeless() bool
func (*EndpointVxlan) String ¶ added in v0.46.0
func (e *EndpointVxlan) String() string
func (*EndpointVxlan) Verify ¶ added in v0.46.0
func (e *EndpointVxlan) Verify(_ context.Context, _ *VerifyLinkParams) error
Verify verifies that the endpoint is valid and can be deployed.
type GenericLinkNode ¶
type GenericLinkNode struct {
// contains filtered or unexported fields
}
func (*GenericLinkNode) AddEndpoint ¶
func (g *GenericLinkNode) AddEndpoint(e Endpoint) error
func (*GenericLinkNode) AddLinkToContainer ¶
func (*GenericLinkNode) Delete ¶ added in v0.46.0
func (g *GenericLinkNode) Delete(ctx context.Context) error
func (*GenericLinkNode) ExecFunction ¶
func (*GenericLinkNode) GetEndpoints ¶
func (g *GenericLinkNode) GetEndpoints() []Endpoint
func (*GenericLinkNode) GetShortName ¶
func (g *GenericLinkNode) GetShortName() string
func (*GenericLinkNode) GetState ¶
func (*GenericLinkNode) GetState() clabnodesstate.NodeState
type Link ¶
type Link interface {
// Deploy deploys the link. Endpoint is the endpoint that triggers the creation of the link.
Deploy(context.Context, Endpoint) error
// Remove removes the link.
Remove(context.Context) error
// GetType returns the type of the link.
GetType() LinkType
// GetEndpoints returns the endpoints of the link.
GetEndpoints() []Endpoint
// GetMTU returns the Link MTU.
GetMTU() int
// GetVars returns the link-level vars.
GetVars() map[string]any
}
Link is an interface that all concrete link types must implement. Concrete link types are resolved from raw links and become part of CLab.Links.
type LinkBriefRaw ¶
type LinkBriefRaw struct {
Endpoints []string `yaml:"endpoints"`
LinkCommonParams ` yaml:",inline,omitempty"`
}
LinkBriefRaw is the representation of any supported link in a brief format as defined in the topology file.
func (*LinkBriefRaw) GetType ¶
func (*LinkBriefRaw) GetType() LinkType
func (*LinkBriefRaw) Resolve ¶
func (*LinkBriefRaw) Resolve(_ *ResolveParams) (Link, error)
func (*LinkBriefRaw) ToTypeSpecificRawLink ¶
func (l *LinkBriefRaw) ToTypeSpecificRawLink() (RawLink, error)
ToTypeSpecificRawLink resolves the brief link into a concrete RawLink implementation. LinkBrief is only used to have a short version of a link definition in the topology file, with ToRawLink we convert it into one of the supported link types.
type LinkCommonParams ¶
type LinkCommonParams struct {
MTU int `yaml:"mtu,omitempty"`
Labels map[string]string `yaml:"labels,omitempty"`
IPv4 []string `yaml:"ipv4,omitempty"`
IPv6 []string `yaml:"ipv6,omitempty"`
Vars map[string]any `yaml:"vars,omitempty"`
DeploymentState LinkDeploymentState `yaml:",omitempty"`
}
LinkCommonParams represents the common parameters for all link types.
func (*LinkCommonParams) GetMTU ¶ added in v0.46.0
func (l *LinkCommonParams) GetMTU() int
GetMTU returns the MTU of the link.
func (*LinkCommonParams) GetVars ¶ added in v0.71.0
func (l *LinkCommonParams) GetVars() map[string]any
GetVars returns the link-level vars.
type LinkDefinition ¶
LinkDefinition represents a link definition in the topology file.
func (*LinkDefinition) MarshalYAML ¶
func (r *LinkDefinition) MarshalYAML() (any, error)
MarshalYAML serializes LinkDefinition (e.g when used with generate command). As of now it falls back to converting the LinkConfig into a RawVEthLink, such that the generated LinkConfigs adhere to the new LinkDefinition format instead of the brief one.
func (*LinkDefinition) UnmarshalYAML ¶
func (ld *LinkDefinition) UnmarshalYAML( unmarshal func(any) error, ) error
UnmarshalYAML deserializes links passed via topology file into LinkDefinition struct. It supports both the brief and specific link type notations.
type LinkDeploymentState ¶
type LinkDeploymentState uint8
type LinkDummy ¶ added in v0.55.0
type LinkDummy struct {
LinkCommonParams
Endpoints []Endpoint
}
func NewLinkDummy ¶ added in v0.55.0
func NewLinkDummy() *LinkDummy
func (*LinkDummy) GetEndpoints ¶ added in v0.55.0
type LinkDummyRaw ¶ added in v0.55.0
type LinkDummyRaw struct {
LinkCommonParams `yaml:",inline"`
Endpoint *EndpointRaw `yaml:"endpoint"`
}
LinkDummyRaw is the raw (string) representation of a dummy link as defined in the topology file.
func (*LinkDummyRaw) GetType ¶ added in v0.55.0
func (*LinkDummyRaw) GetType() LinkType
func (*LinkDummyRaw) Resolve ¶ added in v0.55.0
func (r *LinkDummyRaw) Resolve(params *ResolveParams) (Link, error)
Resolve resolves the raw veth link definition into a Link interface that is implemented by a concrete LinkDummyRaw struct. Resolving a dummy links endpoints.
type LinkEndpointType ¶
type LinkEndpointType string
type LinkHostRaw ¶
type LinkHostRaw struct {
LinkCommonParams `yaml:",inline"`
HostInterface string `yaml:"host-interface"`
Endpoint *EndpointRaw `yaml:"endpoint"`
}
LinkHostRaw is the raw (string) representation of a host link as defined in the topology file.
func (*LinkHostRaw) GetType ¶
func (*LinkHostRaw) GetType() LinkType
func (*LinkHostRaw) Resolve ¶
func (r *LinkHostRaw) Resolve(params *ResolveParams) (Link, error)
func (*LinkHostRaw) ToLinkBriefRaw ¶
func (r *LinkHostRaw) ToLinkBriefRaw() *LinkBriefRaw
ToLinkBriefRaw converts the raw link into a LinkConfig.
type LinkMacVlan ¶
type LinkMacVlan struct {
LinkCommonParams
HostEndpoint *EndpointMacVlan
NodeEndpoint Endpoint
Mode MacVlanMode
}
func (*LinkMacVlan) GetEndpoints ¶
func (l *LinkMacVlan) GetEndpoints() []Endpoint
func (*LinkMacVlan) GetParentInterfaceMTU ¶ added in v0.46.2
func (l *LinkMacVlan) GetParentInterfaceMTU() (int, error)
func (*LinkMacVlan) GetType ¶
func (*LinkMacVlan) GetType() LinkType
type LinkMacVlanRaw ¶
type LinkMacVlanRaw struct {
LinkCommonParams ` yaml:",inline"`
HostInterface string `yaml:"host-interface"`
Endpoint *EndpointRaw `yaml:"endpoint"`
Mode string `yaml:"mode"`
}
LinkMacVlanRaw is the raw (string) representation of a macvlan link as defined in the topology file.
func (*LinkMacVlanRaw) GetType ¶
func (*LinkMacVlanRaw) GetType() LinkType
func (*LinkMacVlanRaw) Resolve ¶
func (r *LinkMacVlanRaw) Resolve(params *ResolveParams) (Link, error)
func (*LinkMacVlanRaw) ToLinkBriefRaw ¶
func (r *LinkMacVlanRaw) ToLinkBriefRaw() *LinkBriefRaw
ToLinkBriefRaw converts the raw link into a LinkConfig.
type LinkMgmtNetRaw ¶
type LinkMgmtNetRaw struct {
LinkCommonParams ` yaml:",inline"`
HostInterface string `yaml:"host-interface"`
Endpoint *EndpointRaw `yaml:"endpoint"`
}
func (*LinkMgmtNetRaw) GetType ¶
func (*LinkMgmtNetRaw) GetType() LinkType
func (*LinkMgmtNetRaw) Resolve ¶
func (r *LinkMgmtNetRaw) Resolve(params *ResolveParams) (Link, error)
func (*LinkMgmtNetRaw) ToLinkBriefRaw ¶
func (r *LinkMgmtNetRaw) ToLinkBriefRaw() *LinkBriefRaw
type LinkType ¶
type LinkType string
LinkType represents the type of a link definition.
const ( LinkTypeVEth LinkType = "veth" LinkTypeMgmtNet LinkType = "mgmt-net" LinkTypeMacVLan LinkType = "macvlan" LinkTypeHost LinkType = "host" LinkTypeVxlan LinkType = "vxlan" LinkTypeVxlanStitch LinkType = "vxlan-stitch" LinkTypeDummy LinkType = "dummy" LinkTypeBridge LinkType = "bridge" // LinkTypeBrief is a link definition where link types // are encoded in the endpoint definition as string and allow users // to quickly type out link endpoints in a yaml file. LinkTypeBrief LinkType = "brief" )
type LinkVEth ¶
type LinkVEth struct {
LinkCommonParams
Endpoints []Endpoint
// contains filtered or unexported fields
}
func NewLinkVEth ¶ added in v0.46.0
func NewLinkVEth() *LinkVEth
func (*LinkVEth) Deploy ¶
Deploy deploys the veth link by creating the A and B sides of the veth pair independently based on the calling endpoint.
func (*LinkVEth) GetEndpoints ¶
type LinkVEthRaw ¶
type LinkVEthRaw struct {
LinkCommonParams ` yaml:",inline"`
Endpoints []*EndpointRaw `yaml:"endpoints"`
}
LinkVEthRaw is the raw (string) representation of a veth link as defined in the topology file.
func (*LinkVEthRaw) GetType ¶
func (*LinkVEthRaw) GetType() LinkType
func (*LinkVEthRaw) Resolve ¶
func (r *LinkVEthRaw) Resolve(params *ResolveParams) (Link, error)
Resolve resolves the raw veth link definition into a Link interface that is implemented by a concrete LinkVEth struct. Resolving a veth link resolves its endpoints.
func (*LinkVEthRaw) ToLinkBriefRaw ¶
func (r *LinkVEthRaw) ToLinkBriefRaw() *LinkBriefRaw
ToLinkBriefRaw converts the raw link into a LinkBriefRaw.
type LinkVxlan ¶ added in v0.46.0
type LinkVxlan struct {
LinkCommonParams
// contains filtered or unexported fields
}
func (*LinkVxlan) GetEndpoints ¶ added in v0.46.0
type LinkVxlanRaw ¶ added in v0.46.0
type LinkVxlanRaw struct {
LinkCommonParams ` yaml:",inline"`
Remote string `yaml:"remote"`
VNI int `yaml:"vni"`
Endpoint EndpointRaw `yaml:"endpoint"`
UdpPort int `yaml:"udp-port,omitempty"` // deprecated
DstPort int `yaml:"dst-port,omitempty"`
ParentInterface string `yaml:"parent-interface,omitempty"`
SrcPort int `yaml:"src-port,omitempty"`
// we use the same struct for vxlan and vxlan stitch, so we need to differentiate them in the
// raw format
LinkType LinkType
}
LinkVxlanRaw is the raw (string) representation of a vxlan link as defined in the topology file.
func (*LinkVxlanRaw) GetType ¶ added in v0.46.0
func (*LinkVxlanRaw) GetType() LinkType
func (*LinkVxlanRaw) Resolve ¶ added in v0.46.0
func (lr *LinkVxlanRaw) Resolve(params *ResolveParams) (Link, error)
type MacVlanMode ¶
type MacVlanMode string
func MacVlanModeParse ¶
func MacVlanModeParse(s string) (MacVlanMode, error)
func (MacVlanMode) ToNetlinkMode ¶ added in v0.46.2
func (m MacVlanMode) ToNetlinkMode() netlink.MacvlanMode
type Node ¶
type Node interface {
// AddLinkToContainer adds a link to the node (container).
// In case of a regular container, it will push the link into the
// network namespace and then run the function f within the namespace
// this is to rename the link, set mtu, set the interface up, e.g. see
// link.SetNameMACAndUpInterface()
//
// In case of a bridge node (ovs or regular linux bridge) it will take the interface and make
// the bridge
// the master of the interface and bring the interface up.
AddLinkToContainer(ctx context.Context, link netlink.Link, f func(ns.NetNS) error) error
// AddEndpoint adds the Endpoint to the node
AddEndpoint(e Endpoint) error
GetLinkEndpointType() LinkEndpointType
GetShortName() string
GetEndpoints() []Endpoint
ExecFunction(context.Context, func(ns.NetNS) error) error
GetState() clabnodesstate.NodeState
Delete(ctx context.Context) error
}
Node interface is an interface that is satisfied by all nodes. It is used a subset of the nodes.Node interface and is used to pass nodes.Nodes to the link resolver without causing a circular dependency.
func GetHostLinkNode ¶
func GetHostLinkNode() Node
GetHostLinkNode returns the host link node singleton.
func GetMgmtBrLinkNode ¶
func GetMgmtBrLinkNode() Node
type RawLink ¶
type RawLink interface {
Resolve(params *ResolveParams) (Link, error)
GetType() LinkType
}
RawLink is an interface that all raw link types must implement. Raw link types define the links as they are defined in the topology file and solely a product of unmarshaling. Raw links are later "resolved" to concrete link types (e.g LinkVeth).
type ResolveParams ¶
type ResolveParams struct {
Nodes map[string]Node
MgmtBridgeName string
// list of node shortnames that user
// passed as a node filter
NodesFilter []string
// for the tools command we need to overwrite the
// veth interface name on the host side. So this can
// be set and will thereby overwrite the general interface
// name generation.
VxlanIfaceNameOverwrite string
}
ResolveParams is a struct that is passed to the Resolve() function of a raw link to resolve it to a concrete link type. Parameters include all nodes of a topology and the name of the management bridge.
type VerifyLinkParams ¶
type VerifyLinkParams struct {
RunBridgeExistsCheck bool
}
func NewVerifyLinkParams ¶
func NewVerifyLinkParams() *VerifyLinkParams
type VxlanStitched ¶ added in v0.46.0
type VxlanStitched struct {
LinkCommonParams
// contains filtered or unexported fields
}
func NewVxlanStitched ¶ added in v0.46.0
func NewVxlanStitched(vxlan *LinkVxlan, veth *LinkVEth, vethStitchEp Endpoint) *VxlanStitched
NewVxlanStitched constructs a new VxlanStitched object.
func (*VxlanStitched) Deploy ¶ added in v0.46.0
func (l *VxlanStitched) Deploy(ctx context.Context, ep Endpoint) error
Deploy provisions the stitched vxlan link with all its underlying sub-links.
func (*VxlanStitched) DeployWithExistingVeth ¶ added in v0.46.0
func (l *VxlanStitched) DeployWithExistingVeth(ctx context.Context) error
DeployWithExistingVeth provisions the stitched vxlan link whilst the veth interface does already exist, hence it is not created as part of this deployment. The VxLAN interface is created and TC stitch rules are applied.
func (*VxlanStitched) GetEndpoints ¶ added in v0.46.0
func (l *VxlanStitched) GetEndpoints() []Endpoint
GetEndpoints returns the endpoints that are part of the link.
func (*VxlanStitched) GetType ¶ added in v0.46.0
func (*VxlanStitched) GetType() LinkType
GetType returns the LinkType enum.
func (*VxlanStitched) Remove ¶ added in v0.46.0
func (l *VxlanStitched) Remove(ctx context.Context) error
Remove deprovisions the stitched vxlan link.
func (*VxlanStitched) Stitch ¶ added in v0.74.0
func (l *VxlanStitched) Stitch() error
Stitch applies only the TC redirect rules to bridge the already-existing VxLAN and veth interfaces on the host. Both interfaces must already exist. Used during lab deploy where VxLAN is created by host endpoint deploy and veth is created by node workers.