linuxitems

package
v0.0.0-...-a6598b8 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LocalIPRuleTypename : typename for singleton item representing IP rule for local RT.
	LocalIPRuleTypename = "Local-IP-Rule"
	// SrcIPRuleTypename : typename for source-based IP rules.
	SrcIPRuleTypename = "Src-IP-Rule"
)

Variables

This section is empty.

Functions

func RegisterItems

func RegisterItems(log *base.LogObject, registry *reconciler.DefaultRegistry,
	monitor netmonitor.NetworkMonitor) error

RegisterItems : register all configurators implemented by this package.

Types

type Adapter

type Adapter struct {
	// LogicalLabel : Note that the adapter and the underlying interface share
	// the same logical label. Inside EVE both are wrapped by a single NetworkPortConfig.
	LogicalLabel string
	// IfName : Name of the interface (as assigned by the OS) to which the adapter
	// is attached.
	IfName string
	// L2Type : link type of the underlying interface.
	// L2LinkTypeNone is used if adapter is directly attached to a physical interface.
	L2Type types.L2LinkType
}

Adapter : Network adapter (in the EVE's API also known as SystemAdapter).

func (Adapter) Dependencies

func (a Adapter) Dependencies() (deps []depgraph.Dependency)

Dependencies returns underlying lower-layer adapter as the dependency (unless this is physical interface at the lowest layer).

func (Adapter) Equal

func (a Adapter) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named adapter instances.

func (Adapter) External

func (a Adapter) External() bool

External returns false.

func (Adapter) Label

func (a Adapter) Label() string

Label returns the logical label.

func (Adapter) Name

func (a Adapter) Name() string

Name uses the interface name to identify the adapter.

func (Adapter) String

func (a Adapter) String() string

String describes network adapter.

func (Adapter) Type

func (a Adapter) Type() string

Type of the item.

type AdapterConfigurator

type AdapterConfigurator struct {
	Log            *base.LogObject
	NetworkMonitor netmonitor.NetworkMonitor
}

AdapterConfigurator implements Configurator interface (libs/reconciler) for network adapters.

func (*AdapterConfigurator) Create

func (c *AdapterConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create creates a bridge, makes the interface its slave and moves ifName and MAC address of the interface to this bridge.

func (*AdapterConfigurator) Delete

func (c *AdapterConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete undoes Create - i.e. moves MAC address and ifName back to the interface and removes the bridge.

func (*AdapterConfigurator) Modify

func (c *AdapterConfigurator) Modify(_ context.Context, _, _ depgraph.Item) (err error)

Modify is not implemented.

func (*AdapterConfigurator) NeedsRecreate

func (c *AdapterConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns true - Modify is not implemented.

type Arp

type Arp struct {
	// AdapterLL : logical label of the associated adapter.
	AdapterLL     string
	AdapterIfName string
	IPAddr        net.IP
	HwAddr        net.HardwareAddr
}

Arp : static ARP entry.

func (Arp) Dependencies

func (a Arp) Dependencies() (deps []depgraph.Dependency)

Dependencies returns the underlying adapter as the only dependency.

func (Arp) Equal

func (a Arp) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named Arp instances.

func (Arp) External

func (a Arp) External() bool

External returns false.

func (Arp) Label

func (a Arp) Label() string

Label is more human-readable than name.

func (Arp) Name

func (a Arp) Name() string

Name combines interface name with the IP address to create a unique arp entry identifier.

func (Arp) String

func (a Arp) String() string

String describes ARP entry.

func (Arp) Type

func (a Arp) Type() string

Type of the item.

type ArpConfigurator

type ArpConfigurator struct {
	Log *base.LogObject
}

ArpConfigurator implements Configurator interface (libs/reconciler) for static ARP entries.

func (*ArpConfigurator) Create

func (c *ArpConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create configures a new ARP entry.

func (*ArpConfigurator) Delete

func (c *ArpConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete removes ARP entry.

func (*ArpConfigurator) Modify

func (c *ArpConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is not implemented.

func (*ArpConfigurator) NeedsRecreate

func (c *ArpConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns true - Modify is not implemented.

type Bond

type Bond struct {
	types.BondConfig
	// LogicalLabel : logical label used for the Bond interface.
	LogicalLabel string
	// IfName : name of the Bond interface in the OS.
	IfName string
	// AggregatedIfNames : interface names of PhysicalIO network adapters aggregated
	// by this bond.
	AggregatedIfNames []string
	// Usage : How is the bond being used.
	// A change in the usage will trigger bond recreate.
	Usage genericitems.IOUsage // IOUsageBondAggrIf is not applicable
}

Bond : Bond interface.

func (Bond) Dependencies

func (b Bond) Dependencies() (deps []depgraph.Dependency)

Dependencies lists all aggregated interfaces as dependencies.

func (Bond) Equal

func (b Bond) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named Bond instances.

func (Bond) External

func (b Bond) External() bool

External returns false.

func (Bond) Label

func (b Bond) Label() string

Label returns the logical label.

func (Bond) Name

func (b Bond) Name() string

Name returns the physical name of the Bond interface.

func (Bond) String

func (b Bond) String() string

String describes Bond interface.

func (Bond) Type

func (b Bond) Type() string

Type of the item.

type BondConfigurator

type BondConfigurator struct {
	Log            *base.LogObject
	NetworkMonitor netmonitor.NetworkMonitor
}

BondConfigurator implements Configurator interface (libs/reconciler) for bond interfaces.

func (*BondConfigurator) Create

func (c *BondConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create adds new Bond interface.

func (*BondConfigurator) Delete

func (c *BondConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete removes bond interface.

func (*BondConfigurator) Modify

func (c *BondConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is able to change the set of aggregated interfaces.

func (*BondConfigurator) NeedsRecreate

func (c *BondConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns true if Bond attributes or Usage have changed. The set of aggregated interfaces can be changed without recreating Bond.

type LocalIPRule

type LocalIPRule struct {
	Priority int
}

LocalIPRule : singleton item representing IP rule for local RT This is for both IPv4 and IPv6.

func (LocalIPRule) Dependencies

func (r LocalIPRule) Dependencies() (deps []depgraph.Dependency)

Dependencies returns nothing.

func (LocalIPRule) Equal

func (r LocalIPRule) Equal(other depgraph.Item) bool

Equal only compares the priority to check if it changed.

func (LocalIPRule) External

func (r LocalIPRule) External() bool

External returns false.

func (LocalIPRule) Label

func (r LocalIPRule) Label() string

Label is not defined.

func (LocalIPRule) Name

func (r LocalIPRule) Name() string

Name returns a constant string - LocalIPRule is a singleton.

func (LocalIPRule) String

func (r LocalIPRule) String() string

String describes the Local IP rule (priority).

func (LocalIPRule) Type

func (r LocalIPRule) Type() string

Type of the item.

type LocalIPRuleConfigurator

type LocalIPRuleConfigurator struct {
	Log *base.LogObject
}

LocalIPRuleConfigurator implements Configurator interface (libs/reconciler) for local IP Rule.

func (*LocalIPRuleConfigurator) Create

Create modifies the priority of the (automatically created) local IP rule.

func (*LocalIPRuleConfigurator) Delete

Delete always returns error. NIM never reverts back to the original priority of the local IP rule.

func (*LocalIPRuleConfigurator) Modify

func (c *LocalIPRuleConfigurator) Modify(_ context.Context, _, _ depgraph.Item) (err error)

Modify is not implemented.

func (*LocalIPRuleConfigurator) NeedsRecreate

func (c *LocalIPRuleConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate is not relevant here - neither Modify nor Delete should ever be called for this item.

type Route

type Route struct {
	netlink.Route
	// AdapterIfName : name of the interface associated with the route.
	// Should match with Route.LinkIndex.
	// Empty if this route is referencing unmanaged link.
	AdapterIfName string
	// AdapterLL : logical label of the associated interface.
	// Empty if this route is referencing unmanaged link.
	AdapterLL string
	// True if this route is referencing link not managed by EVE.
	// It is used by DPC Reconciler to install routes for the bridge cni0 created
	// and used by Flannel CNI.
	// Later this will likely go away as we find cleaner solution for integration
	// between EVE and (possibly any) CNI plugin.
	UnmanagedLink bool
}

Route : Network route.

func (Route) Dependencies

func (r Route) Dependencies() (deps []depgraph.Dependency)

Dependencies of a network route are:

  • the "via" adapter must exist and be UP
  • the "via" adapter must have an IP address assigned from the subnet of the route gateway.

func (Route) Equal

func (r Route) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named route instances.

func (Route) External

func (r Route) External() bool

External returns false.

func (Route) Label

func (r Route) Label() string

Label is more human-readable than name.

func (Route) Name

func (r Route) Name() string

Name combines the interface name, route table ID and the destination address to construct a unique route identifier.

func (Route) String

func (r Route) String() string

String describes the network route.

func (Route) Type

func (r Route) Type() string

Type of the item.

type RouteConfigurator

type RouteConfigurator struct {
	Log *base.LogObject
}

RouteConfigurator implements Configurator interface (libs/reconciler) for network routes.

func (*RouteConfigurator) Create

func (c *RouteConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create adds network route.

func (*RouteConfigurator) Delete

func (c *RouteConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete removes network route.

func (*RouteConfigurator) Modify

func (c *RouteConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) (err error)

Modify is not implemented.

func (*RouteConfigurator) NeedsRecreate

func (c *RouteConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns true - Modify is not implemented.

type SrcIPRule

type SrcIPRule struct {
	// AdapterLL : Adapter's logical label.
	AdapterLL     string
	AdapterIfName string
	IPAddr        net.IP
	Priority      int
}

SrcIPRule : IP rule for source-based IP routing.

func (SrcIPRule) Dependencies

func (r SrcIPRule) Dependencies() (deps []depgraph.Dependency)

Dependencies lists the referenced adapter as the only dependency. This dependency is not actually necessary. IP rule can be configured even if the adapter is missing.

func (SrcIPRule) Equal

func (r SrcIPRule) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named src-IP-rule instances.

func (SrcIPRule) External

func (r SrcIPRule) External() bool

External returns false.

func (SrcIPRule) Label

func (r SrcIPRule) Label() string

Label is more human-readable than name.

func (SrcIPRule) Name

func (r SrcIPRule) Name() string

Name combines interface name with the IP address to construct a unique identifier for the src IP rule.

func (SrcIPRule) String

func (r SrcIPRule) String() string

String describes source-based IP rule.

func (SrcIPRule) Type

func (r SrcIPRule) Type() string

Type of the item.

type SrcIPRuleConfigurator

type SrcIPRuleConfigurator struct {
	Log            *base.LogObject
	NetworkMonitor netmonitor.NetworkMonitor
}

SrcIPRuleConfigurator implements Configurator interface (libs/reconciler) for IP Rules.

func (*SrcIPRuleConfigurator) Create

func (c *SrcIPRuleConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create adds the source-based IP rule.

func (*SrcIPRuleConfigurator) Delete

func (c *SrcIPRuleConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete removes the source-based IP rule.

func (*SrcIPRuleConfigurator) Modify

func (c *SrcIPRuleConfigurator) Modify(_ context.Context, _, _ depgraph.Item) (err error)

Modify is not implemented.

func (*SrcIPRuleConfigurator) NeedsRecreate

func (c *SrcIPRuleConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns true - Modify is not implemented.

type Vlan

type Vlan struct {
	// LogicalLabel : logical label used for the VLAN sub-interface.
	LogicalLabel string
	// IfName : name of the VLAN sub-interface in the OS.
	IfName string
	// ParentLL : Logical label of the parent port.
	ParentLL string
	// ParentIfName : name of the parent interface in the OS.
	ParentIfName string
	// ParentL2Type : link type of the parent interface (bond or physical).
	ParentL2Type types.L2LinkType
	// VLAN ID.
	ID uint16
}

Vlan : VLAN sub-interface.

func (Vlan) Dependencies

func (v Vlan) Dependencies() (deps []depgraph.Dependency)

Dependencies lists the parent adapter as the only dependency.

func (Vlan) Equal

func (v Vlan) Equal(other depgraph.Item) bool

Equal is a comparison method for two equally-named VLAN instances.

func (Vlan) External

func (v Vlan) External() bool

External returns false.

func (Vlan) Label

func (v Vlan) Label() string

Label returns the logical label of the VLAN adapter.

func (Vlan) Name

func (v Vlan) Name() string

Name returns the physical name of the VLAN sub-interface.

func (Vlan) String

func (v Vlan) String() string

String describes the VLAN sub-interface.

func (Vlan) Type

func (v Vlan) Type() string

Type of the item.

type VlanConfigurator

type VlanConfigurator struct {
	Log            *base.LogObject
	NetworkMonitor netmonitor.NetworkMonitor
}

VlanConfigurator implements Configurator interface (libs/reconciler) for VLAN sub-interfaces.

func (*VlanConfigurator) Create

func (c *VlanConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create creates a VLAN sub-interface.

func (*VlanConfigurator) Delete

func (c *VlanConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete removes VLAN sub-interface.

func (*VlanConfigurator) Modify

func (c *VlanConfigurator) Modify(_ context.Context, _, _ depgraph.Item) (err error)

Modify is not implemented.

func (*VlanConfigurator) NeedsRecreate

func (c *VlanConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate always returns true - Modify is not implemented.

type WifiConfig

type WifiConfig struct {
	types.WifiConfig
	Credentials types.EncryptionBlock
}

WifiConfig : WiFi configuration.

func (WifiConfig) String

func (wc WifiConfig) String() string

String describes WifiConfig without revealing any sensitive info.

type Wlan

type Wlan struct {
	Config []WifiConfig
	// EnableRF : Enable or disable radio transmission.
	EnableRF bool
}

Wlan : WLAN (WiFi) configuration (for WPA supplicant and rfkill). Note that currently only one WiFi adapter per device is supported.

func (Wlan) Dependencies

func (w Wlan) Dependencies() (deps []depgraph.Dependency)

Dependencies returns nothing. Configurator for this config item only installs wpa_supplicant.conf and that has no dependencies.

func (Wlan) Equal

func (w Wlan) Equal(other depgraph.Item) bool

Equal compares two WLAN configurations.

func (Wlan) External

func (w Wlan) External() bool

External returns false.

func (Wlan) Label

func (w Wlan) Label() string

Label is not defined.

func (Wlan) Name

func (w Wlan) Name() string

Name returns the wpa_supplicant.conf file path as the name.

func (Wlan) String

func (w Wlan) String() string

String describes the WLAN configuration.

func (Wlan) Type

func (w Wlan) Type() string

Type of the item.

type WlanConfigurator

type WlanConfigurator struct {
	Log *base.LogObject
}

WlanConfigurator implements Configurator interface (libs/reconciler) for wpa_supplicant.conf.

func (*WlanConfigurator) Create

func (c *WlanConfigurator) Create(ctx context.Context, item depgraph.Item) error

Create installs wpa_supplicant.conf.

func (*WlanConfigurator) Delete

func (c *WlanConfigurator) Delete(ctx context.Context, item depgraph.Item) error

Delete clears previously installed wpa file.

func (*WlanConfigurator) Modify

func (c *WlanConfigurator) Modify(ctx context.Context, oldItem, newItem depgraph.Item) error

Modify updates the content of wpa_supplicant.conf.

func (*WlanConfigurator) NeedsRecreate

func (c *WlanConfigurator) NeedsRecreate(oldItem, newItem depgraph.Item) (recreate bool)

NeedsRecreate returns false - Modify can apply any change.

Jump to

Keyboard shortcuts

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