network

package
Version: v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package network provides resources which describe networking subsystem state.

Index

Constants

View Source
const (
	LinkKindVLAN      = "vlan"
	LinkKindBond      = "bond"
	LinkKindWireguard = "wireguard"
)

Link kinds.

View Source
const (
	// Default node address (should be a single address in the spec).
	//
	// Used to set for example published etcd peer address.
	NodeAddressDefaultID = "default"
	// Current node addresses (as seen at the moment).
	//
	// Shows a list of addresses for the node for the UP interfaces.
	NodeAddressCurrentID = "current"
	// Accumulative list of the addresses node had over time.
	//
	// If some address is no longer present, it will be still kept in the accumulative list.
	NodeAddressAccumulativeID = "accumulative"
)

NodeAddress well-known IDs.

View Source
const AddressSpecType = resource.Type("AddressSpecs.net.talos.dev")

AddressSpecType is type of AddressSpec resource.

View Source
const AddressStatusType = resource.Type("AddressStatuses.net.talos.dev")

AddressStatusType is type of AddressStatus resource.

View Source
const ConfigNamespaceName resource.Namespace = "network-config"

ConfigNamespaceName contains umerged resources related to networking generate from the configuration.

Resources in the ConfigNamespaceName namespace are merged to produce final versions in the NamespaceName namespace.

View Source
const HostnameID resource.ID = "hostname"

HostnameID is the ID of the singleton instance.

View Source
const HostnameSpecType = resource.Type("HostnameSpecs.net.talos.dev")

HostnameSpecType is type of HostnameSpec resource.

View Source
const HostnameStatusType = resource.Type("HostnameStatuses.net.talos.dev")

HostnameStatusType is type of HostnameStatus resource.

View Source
const LinkRefreshType = resource.Type("LinkRefreshes.net.talos.dev")

LinkRefreshType is type of LinkRefresh resource.

View Source
const LinkSpecType = resource.Type("LinkSpecs.net.talos.dev")

LinkSpecType is type of LinkSpec resource.

View Source
const LinkStatusType = resource.Type("LinkStatuses.net.talos.dev")

LinkStatusType is type of LinkStatus resource.

View Source
const NamespaceName resource.Namespace = "network"

NamespaceName contains resources related to networking.

View Source
const NodeAddressType = resource.Type("NodeAddresses.net.talos.dev")

NodeAddressType is type of NodeAddress resource.

View Source
const OperatorSpecType = resource.Type("OperatorSpecs.net.talos.dev")

OperatorSpecType is type of OperatorSpec resource.

View Source
const ResolverID resource.ID = "resolvers"

ResolverID is the ID of the singleton instance.

View Source
const ResolverSpecType = resource.Type("ResolverSpecs.net.talos.dev")

ResolverSpecType is type of ResolverSpec resource.

View Source
const ResolverStatusType = resource.Type("ResolverStatuses.net.talos.dev")

ResolverStatusType is type of ResolverStatus resource.

View Source
const RouteSpecType = resource.Type("RouteSpecs.net.talos.dev")

RouteSpecType is type of RouteSpec resource.

View Source
const RouteStatusType = resource.Type("RouteStatuses.net.talos.dev")

RouteStatusType is type of RouteStatus resource.

View Source
const StatusID resource.ID = "status"

StatusID is the resource ID of the singleton instance.

View Source
const StatusType = resource.Type("NetworkStatuses.net.talos.dev")

StatusType is type of Status resource.

View Source
const TimeServerID resource.ID = "timeservers"

TimeServerID is the ID of the singleton instance.

View Source
const TimeServerSpecType = resource.Type("TimeServerSpecs.net.talos.dev")

TimeServerSpecType is type of TimeServerSpec resource.

View Source
const TimeServerStatusType = resource.Type("TimeServerStatuses.net.talos.dev")

TimeServerStatusType is type of TimeServerStatus resource.

Variables

This section is empty.

Functions

func AddressID

func AddressID(linkName string, addr netaddr.IPPrefix) string

AddressID builds ID (primary key) for the address.

func AddressReady

func AddressReady(spec *StatusSpec) bool

AddressReady checks if address is ready.

func ConnectivityReady

func ConnectivityReady(spec *StatusSpec) bool

ConnectivityReady checks if connectivity is ready.

func EtcFilesReady

func EtcFilesReady(spec *StatusSpec) bool

EtcFilesReady checks if etc files are ready.

func HostnameReady

func HostnameReady(spec *StatusSpec) bool

HostnameReady checks if hostname is ready.

func LayeredID

func LayeredID(layer ConfigLayer, id string) string

LayeredID builds configuration for the entity at some layer.

func LinkID

func LinkID(linkName string) string

LinkID builds ID (primary key) for the link (interface).

func OperatorID

func OperatorID(operator Operator, linkName string) string

OperatorID builds ID (primary key) for the operators.

func RouteID

func RouteID(table nethelpers.RoutingTable, family nethelpers.Family, destination netaddr.IPPrefix, gateway netaddr.IP, priority uint32) string

RouteID builds ID (primary key) for the route.

Types

type AddressSpec

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

AddressSpec resource holds physical network link status.

func NewAddressSpec

func NewAddressSpec(namespace resource.Namespace, id resource.ID) *AddressSpec

NewAddressSpec initializes a AddressSpec resource.

func (*AddressSpec) DeepCopy

func (r *AddressSpec) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*AddressSpec) Metadata

func (r *AddressSpec) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*AddressSpec) ResourceDefinition

func (r *AddressSpec) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*AddressSpec) Spec

func (r *AddressSpec) Spec() interface{}

Spec implements resource.Resource.

func (*AddressSpec) String

func (r *AddressSpec) String() string

func (*AddressSpec) TypedSpec

func (r *AddressSpec) TypedSpec() *AddressSpecSpec

TypedSpec allows to access the Spec with the proper type.

type AddressSpecSpec

type AddressSpecSpec struct {
	Address         netaddr.IPPrefix        `yaml:"address"`
	LinkName        string                  `yaml:"linkName"`
	Family          nethelpers.Family       `yaml:"family"`
	Scope           nethelpers.Scope        `yaml:"scope"`
	Flags           nethelpers.AddressFlags `yaml:"flags"`
	AnnounceWithARP bool                    `yaml:"announceWithARP,omitempty"`
	ConfigLayer     ConfigLayer             `yaml:"layer"`
}

AddressSpecSpec describes status of rendered secrets.

type AddressStatus

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

AddressStatus resource holds physical network link status.

func NewAddressStatus

func NewAddressStatus(namespace resource.Namespace, id resource.ID) *AddressStatus

NewAddressStatus initializes a AddressStatus resource.

func (*AddressStatus) DeepCopy

func (r *AddressStatus) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*AddressStatus) Metadata

func (r *AddressStatus) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*AddressStatus) ResourceDefinition

func (r *AddressStatus) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*AddressStatus) Spec

func (r *AddressStatus) Spec() interface{}

Spec implements resource.Resource.

func (*AddressStatus) String

func (r *AddressStatus) String() string

func (*AddressStatus) TypedSpec

func (r *AddressStatus) TypedSpec() *AddressStatusSpec

TypedSpec allows to access the Spec with the proper type.

type AddressStatusSpec

type AddressStatusSpec struct {
	Address   netaddr.IPPrefix        `yaml:"address"`
	Local     netaddr.IP              `yaml:"local,omitempty"`
	Broadcast netaddr.IP              `yaml:"broadcast,omitempty"`
	Anycast   netaddr.IP              `yaml:"anycast,omitempty"`
	Multicast netaddr.IP              `yaml:"multicast,omitempty"`
	LinkIndex uint32                  `yaml:"linkIndex"`
	LinkName  string                  `yaml:"linkName"`
	Family    nethelpers.Family       `yaml:"family"`
	Scope     nethelpers.Scope        `yaml:"scope"`
	Flags     nethelpers.AddressFlags `yaml:"flags"`
}

AddressStatusSpec describes status of rendered secrets.

type BondMasterSpec

type BondMasterSpec struct {
	Mode            nethelpers.BondMode           `yaml:"mode"`
	HashPolicy      nethelpers.BondXmitHashPolicy `yaml:"xmitHashPolicy"`
	LACPRate        nethelpers.LACPRate           `yaml:"lacpRate"`
	ARPValidate     nethelpers.ARPValidate        `yaml:"arpValidate"`
	ARPAllTargets   nethelpers.ARPAllTargets      `yaml:"arpAllTargets"`
	PrimaryIndex    uint32                        `yaml:"primary,omitempty"`
	PrimaryReselect nethelpers.PrimaryReselect    `yaml:"primaryReselect"`
	FailOverMac     nethelpers.FailOverMAC        `yaml:"failOverMac"`
	ADSelect        nethelpers.ADSelect           `yaml:"adSelect,omitempty"`
	MIIMon          uint32                        `yaml:"miimon,omitempty"`
	UpDelay         uint32                        `yaml:"updelay,omitempty"`
	DownDelay       uint32                        `yaml:"downdelay,omitempty"`
	ARPInterval     uint32                        `yaml:"arpInterval,omitempty"`
	ResendIGMP      uint32                        `yaml:"resendIgmp,omitempty"`
	MinLinks        uint32                        `yaml:"minLinks,omitempty"`
	LPInterval      uint32                        `yaml:"lpInterval,omitempty"`
	PacketsPerSlave uint32                        `yaml:"packetsPerSlave,omitempty"`
	NumPeerNotif    uint8                         `yaml:"numPeerNotif,omitempty"`
	TLBDynamicLB    uint8                         `yaml:"tlbLogicalLb,omitempty"`
	AllSlavesActive uint8                         `yaml:"allSlavesActive,omitempty"`
	UseCarrier      bool                          `yaml:"useCarrier,omitempty"`
	ADActorSysPrio  uint16                        `yaml:"adActorSysPrio,omitempty"`
	ADUserPortKey   uint16                        `yaml:"adUserPortKey,omitempty"`
	PeerNotifyDelay uint32                        `yaml:"peerNotifyDelay,omitempty"`
}

BondMasterSpec describes bond settings if Kind == "bond".

func (*BondMasterSpec) Decode

func (bond *BondMasterSpec) Decode(data []byte) error

Decode the BondMasterSpec from netlink attributes.

func (*BondMasterSpec) Encode

func (bond *BondMasterSpec) Encode() ([]byte, error)

Encode the BondMasterSpec into netlink attributes.

func (*BondMasterSpec) FillDefaults

func (bond *BondMasterSpec) FillDefaults()

FillDefaults fills zero values with proper default values.

type ConfigLayer

type ConfigLayer int

ConfigLayer describes network configuration layers, with lowest priority first.

const (
	ConfigDefault              ConfigLayer = iota // default
	ConfigCmdline                                 // cmdline
	ConfigPlatform                                // platform
	ConfigOperator                                // operator
	ConfigMachineConfiguration                    // configuration
)

Configuration layers.

func (ConfigLayer) MarshalYAML

func (layer ConfigLayer) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (ConfigLayer) String

func (i ConfigLayer) String() string

type DHCP4OperatorSpec

type DHCP4OperatorSpec struct {
	RouteMetric uint32 `yaml:"routeMetric"`
}

DHCP4OperatorSpec describes DHCP4 operator options.

type DHCP6OperatorSpec

type DHCP6OperatorSpec struct {
	RouteMetric uint32 `yaml:"routeMetric"`
}

DHCP6OperatorSpec describes DHCP6 operator options.

type HostnameSpec

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

HostnameSpec resource holds node hostname.

func NewHostnameSpec

func NewHostnameSpec(namespace resource.Namespace, id resource.ID) *HostnameSpec

NewHostnameSpec initializes a HostnameSpec resource.

func (*HostnameSpec) DeepCopy

func (r *HostnameSpec) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*HostnameSpec) Metadata

func (r *HostnameSpec) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*HostnameSpec) ResourceDefinition

func (r *HostnameSpec) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*HostnameSpec) Spec

func (r *HostnameSpec) Spec() interface{}

Spec implements resource.Resource.

func (*HostnameSpec) String

func (r *HostnameSpec) String() string

func (*HostnameSpec) TypedSpec

func (r *HostnameSpec) TypedSpec() *HostnameSpecSpec

TypedSpec allows to access the Spec with the proper type.

type HostnameSpecSpec

type HostnameSpecSpec struct {
	Hostname    string      `yaml:"hostname"`
	Domainname  string      `yaml:"domainname"`
	ConfigLayer ConfigLayer `yaml:"layer"`
}

HostnameSpecSpec describes node nostname.

func (*HostnameSpecSpec) FQDN

func (spec *HostnameSpecSpec) FQDN() string

FQDN returns the fully-qualified domain name.

func (*HostnameSpecSpec) ParseFQDN

func (spec *HostnameSpecSpec) ParseFQDN(fqdn string) error

ParseFQDN into parts and validate it.

func (*HostnameSpecSpec) Validate

func (spec *HostnameSpecSpec) Validate() error

Validate the hostname.

type HostnameStatus

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

HostnameStatus resource holds node hostname.

func NewHostnameStatus

func NewHostnameStatus(namespace resource.Namespace, id resource.ID) *HostnameStatus

NewHostnameStatus initializes a HostnameStatus resource.

func (*HostnameStatus) DeepCopy

func (r *HostnameStatus) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*HostnameStatus) Metadata

func (r *HostnameStatus) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*HostnameStatus) ResourceDefinition

func (r *HostnameStatus) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*HostnameStatus) Spec

func (r *HostnameStatus) Spec() interface{}

Spec implements resource.Resource.

func (*HostnameStatus) String

func (r *HostnameStatus) String() string

func (*HostnameStatus) TypedSpec

func (r *HostnameStatus) TypedSpec() *HostnameStatusSpec

TypedSpec allows to access the Spec with the proper type.

type HostnameStatusSpec

type HostnameStatusSpec struct {
	Hostname   string `yaml:"hostname"`
	Domainname string `yaml:"domainname"`
}

HostnameStatusSpec describes node nostname.

func (*HostnameStatusSpec) DNSNames

func (spec *HostnameStatusSpec) DNSNames() []string

DNSNames returns DNS names to be added to the certificate based on the hostname and fqdn.

func (*HostnameStatusSpec) FQDN

func (spec *HostnameStatusSpec) FQDN() string

FQDN returns the fully-qualified domain name.

type LinkRefresh

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

LinkRefresh resource is used to communicate link changes which can't be subscribed to via netlink.

The only usecase for now is the Wireguards, as there's no way subscribe to wireguard updates via the netlink API.

Whenever Wireguard interface is updated, LinkRefresh resource is modified to trigger a reconcile loop in the LinkStatusController.

func NewLinkRefresh

func NewLinkRefresh(namespace resource.Namespace, id resource.ID) *LinkRefresh

NewLinkRefresh initializes a LinkRefresh resource.

func (*LinkRefresh) Bump

func (r *LinkRefresh) Bump()

Bump performs an update.

func (*LinkRefresh) DeepCopy

func (r *LinkRefresh) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*LinkRefresh) Metadata

func (r *LinkRefresh) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*LinkRefresh) ResourceDefinition

func (r *LinkRefresh) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*LinkRefresh) Spec

func (r *LinkRefresh) Spec() interface{}

Spec implements resource.Resource.

func (*LinkRefresh) String

func (r *LinkRefresh) String() string

type LinkRefreshSpec

type LinkRefreshSpec struct {
	Generation int `yaml:"generation"`
}

LinkRefreshSpec describes status of rendered secrets.

type LinkSpec

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

LinkSpec resource describes desired state of the link (network interface).

func NewLinkSpec

func NewLinkSpec(namespace resource.Namespace, id resource.ID) *LinkSpec

NewLinkSpec initializes a LinkSpec resource.

func (*LinkSpec) DeepCopy

func (r *LinkSpec) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*LinkSpec) Metadata

func (r *LinkSpec) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*LinkSpec) ResourceDefinition

func (r *LinkSpec) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*LinkSpec) Spec

func (r *LinkSpec) Spec() interface{}

Spec implements resource.Resource.

func (*LinkSpec) String

func (r *LinkSpec) String() string

func (*LinkSpec) TypedSpec

func (r *LinkSpec) TypedSpec() *LinkSpecSpec

TypedSpec allows to access the Spec with the proper type.

type LinkSpecSpec

type LinkSpecSpec struct {
	// Name defines link name
	Name string `yaml:"name"`

	// Logical describes if the interface should be created on the fly if it doesn't exist.
	Logical bool `yaml:"logical"`

	// If Up is true, bring interface up, otherwise bring interface down.
	//
	// TODO: make *bool ?
	Up bool `yaml:"up"`

	// Interface MTU (always applies).
	MTU uint32 `yaml:"mtu"`

	// Kind and Type are only required for Logical interfaces.
	Kind string              `yaml:"kind"`
	Type nethelpers.LinkType `yaml:"type"`

	// ParentName indicates link parent for VLAN interfaces.
	ParentName string `yaml:"parentName,omitempty"`

	// MasterName indicates master link for enslaved bonded interfaces.
	MasterName string `yaml:"masterName,omitempty"`

	// These structures are present depending on "Kind" for Logical intefaces.
	VLAN       VLANSpec       `yaml:"vlan,omitempty"`
	BondMaster BondMasterSpec `yaml:"bondMaster,omitempty"`
	Wireguard  WireguardSpec  `yaml:"wireguard,omitempty"`

	// Configuration layer.
	ConfigLayer ConfigLayer `yaml:"layer"`
}

LinkSpecSpec describes spec for the link.

func (*LinkSpecSpec) Merge

func (spec *LinkSpecSpec) Merge(other *LinkSpecSpec) error

Merge with other, overwriting fields from other if set.

type LinkStatus

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

LinkStatus resource holds physical network link status.

func NewLinkStatus

func NewLinkStatus(namespace resource.Namespace, id resource.ID) *LinkStatus

NewLinkStatus initializes a LinkStatus resource.

func (*LinkStatus) DeepCopy

func (r *LinkStatus) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*LinkStatus) Metadata

func (r *LinkStatus) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*LinkStatus) Physical

func (r *LinkStatus) Physical() bool

Physical checks if the link is physical ethernet.

func (*LinkStatus) ResourceDefinition

func (r *LinkStatus) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*LinkStatus) Spec

func (r *LinkStatus) Spec() interface{}

Spec implements resource.Resource.

func (*LinkStatus) String

func (r *LinkStatus) String() string

func (*LinkStatus) TypedSpec

func (r *LinkStatus) TypedSpec() *LinkStatusSpec

TypedSpec allows to access the Spec with the proper type.

type LinkStatusSpec

type LinkStatusSpec struct {
	// Fields coming from rtnetlink API.
	Index            uint32                      `yaml:"index"`
	Type             nethelpers.LinkType         `yaml:"type"`
	LinkIndex        uint32                      `yaml:"linkIndex"`
	Flags            nethelpers.LinkFlags        `yaml:"flags"`
	HardwareAddr     nethelpers.HardwareAddr     `yaml:"hardwareAddr"`
	BroadcastAddr    nethelpers.HardwareAddr     `yaml:"broadcastAddr"`
	MTU              uint32                      `yaml:"mtu"`
	QueueDisc        string                      `yaml:"queueDisc"`
	MasterIndex      uint32                      `yaml:"masterIndex,omitempty"`
	OperationalState nethelpers.OperationalState `yaml:"operationalState"`
	Kind             string                      `yaml:"kind"`
	SlaveKind        string                      `yaml:"slaveKind"`
	// Fields coming from ethtool API.
	LinkState     bool              `yaml:"linkState"`
	SpeedMegabits int               `yaml:"speedMbit,omitempty"`
	Port          nethelpers.Port   `yaml:"port"`
	Duplex        nethelpers.Duplex `yaml:"duplex"`
	// Following fields are only populated with respective Kind.
	VLAN       VLANSpec       `yaml:"vlan,omitempty"`
	BondMaster BondMasterSpec `yaml:"bondMaster,omitempty"`
	Wireguard  WireguardSpec  `yaml:"wireguard,omitempty"`
}

LinkStatusSpec describes status of rendered secrets.

type NodeAddress

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

NodeAddress resource holds physical network link status.

func NewNodeAddress

func NewNodeAddress(namespace resource.Namespace, id resource.ID) *NodeAddress

NewNodeAddress initializes a NodeAddress resource.

func (*NodeAddress) DeepCopy

func (r *NodeAddress) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*NodeAddress) Metadata

func (r *NodeAddress) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*NodeAddress) ResourceDefinition

func (r *NodeAddress) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*NodeAddress) Spec

func (r *NodeAddress) Spec() interface{}

Spec implements resource.Resource.

func (*NodeAddress) String

func (r *NodeAddress) String() string

func (*NodeAddress) TypedSpec

func (r *NodeAddress) TypedSpec() *NodeAddressSpec

TypedSpec allows to access the Spec with the proper type.

type NodeAddressSpec

type NodeAddressSpec struct {
	Addresses []netaddr.IP `yaml:"addresses"`
}

NodeAddressSpec describes a set of node addresses.

type Operator

type Operator int

Operator enumerates Talos network operators.

const (
	OperatorDHCP4 Operator = iota // dhcp4
	OperatorDHCP6                 // dhcp6
	OperatorVIP                   // vip
	OperatorWgLAN                 // wglan
)

Operator list.

func (Operator) MarshalYAML

func (operator Operator) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (Operator) String

func (i Operator) String() string

type OperatorSpec

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

OperatorSpec resource holds DNS resolver info.

func NewOperatorSpec

func NewOperatorSpec(namespace resource.Namespace, id resource.ID) *OperatorSpec

NewOperatorSpec initializes a OperatorSpec resource.

func (*OperatorSpec) DeepCopy

func (r *OperatorSpec) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*OperatorSpec) Metadata

func (r *OperatorSpec) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*OperatorSpec) ResourceDefinition

func (r *OperatorSpec) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*OperatorSpec) Spec

func (r *OperatorSpec) Spec() interface{}

Spec implements resource.Resource.

func (*OperatorSpec) String

func (r *OperatorSpec) String() string

func (*OperatorSpec) TypedSpec

func (r *OperatorSpec) TypedSpec() *OperatorSpecSpec

TypedSpec allows to access the Spec with the proper type.

type OperatorSpecSpec

type OperatorSpecSpec struct {
	Operator  Operator `yaml:"operator"`
	LinkName  string   `yaml:"linkName"`
	RequireUp bool     `yaml:"requireUp"`

	DHCP4 DHCP4OperatorSpec `yaml:"dhcp4,omitempty"`
	DHCP6 DHCP6OperatorSpec `yaml:"dhcp6,omitempty"`
	VIP   VIPOperatorSpec   `yaml:"vip,omitempty"`
}

OperatorSpecSpec describes DNS resolvers.

type ReadyCondition

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

ReadyCondition implements condition which waits for the network to be ready.

func NewReadyCondition

func NewReadyCondition(state state.State, checks ...StatusCheck) *ReadyCondition

NewReadyCondition builds a coondition which waits for the network to be ready.

func (*ReadyCondition) String

func (condition *ReadyCondition) String() string

func (*ReadyCondition) Wait

func (condition *ReadyCondition) Wait(ctx context.Context) error

Wait implements condition interface.

type ResolverSpec

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

ResolverSpec resource holds DNS resolver info.

func NewResolverSpec

func NewResolverSpec(namespace resource.Namespace, id resource.ID) *ResolverSpec

NewResolverSpec initializes a ResolverSpec resource.

func (*ResolverSpec) DeepCopy

func (r *ResolverSpec) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*ResolverSpec) Metadata

func (r *ResolverSpec) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*ResolverSpec) ResourceDefinition

func (r *ResolverSpec) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*ResolverSpec) Spec

func (r *ResolverSpec) Spec() interface{}

Spec implements resource.Resource.

func (*ResolverSpec) String

func (r *ResolverSpec) String() string

func (*ResolverSpec) TypedSpec

func (r *ResolverSpec) TypedSpec() *ResolverSpecSpec

TypedSpec allows to access the Spec with the proper type.

type ResolverSpecSpec

type ResolverSpecSpec struct {
	DNSServers  []netaddr.IP `yaml:"dnsServers"`
	ConfigLayer ConfigLayer  `yaml:"layer"`
}

ResolverSpecSpec describes DNS resolvers.

type ResolverStatus

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

ResolverStatus resource holds DNS resolver info.

func NewResolverStatus

func NewResolverStatus(namespace resource.Namespace, id resource.ID) *ResolverStatus

NewResolverStatus initializes a ResolverStatus resource.

func (*ResolverStatus) DeepCopy

func (r *ResolverStatus) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*ResolverStatus) Metadata

func (r *ResolverStatus) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*ResolverStatus) ResourceDefinition

func (r *ResolverStatus) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*ResolverStatus) Spec

func (r *ResolverStatus) Spec() interface{}

Spec implements resource.Resource.

func (*ResolverStatus) String

func (r *ResolverStatus) String() string

func (*ResolverStatus) TypedSpec

func (r *ResolverStatus) TypedSpec() *ResolverStatusSpec

TypedSpec allows to access the Spec with the proper type.

type ResolverStatusSpec

type ResolverStatusSpec struct {
	DNSServers []netaddr.IP `yaml:"dnsServers"`
}

ResolverStatusSpec describes DNS resolvers.

type RouteSpec

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

RouteSpec resource holds route specification to be applied to the kernel.

func NewRouteSpec

func NewRouteSpec(namespace resource.Namespace, id resource.ID) *RouteSpec

NewRouteSpec initializes a RouteSpec resource.

func (*RouteSpec) DeepCopy

func (r *RouteSpec) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*RouteSpec) Metadata

func (r *RouteSpec) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*RouteSpec) ResourceDefinition

func (r *RouteSpec) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*RouteSpec) Spec

func (r *RouteSpec) Spec() interface{}

Spec implements resource.Resource.

func (*RouteSpec) String

func (r *RouteSpec) String() string

func (*RouteSpec) TypedSpec

func (r *RouteSpec) TypedSpec() *RouteSpecSpec

TypedSpec allows to access the Spec with the proper type.

type RouteSpecSpec

type RouteSpecSpec struct {
	Family      nethelpers.Family        `yaml:"family"`
	Destination netaddr.IPPrefix         `yaml:"dst"`
	Source      netaddr.IP               `yaml:"src"`
	Gateway     netaddr.IP               `yaml:"gateway"`
	OutLinkName string                   `yaml:"outLinkName,omitempty"`
	Table       nethelpers.RoutingTable  `yaml:"table"`
	Priority    uint32                   `yaml:"priority,omitempty"`
	Scope       nethelpers.Scope         `yaml:"scope"`
	Type        nethelpers.RouteType     `yaml:"type"`
	Flags       nethelpers.RouteFlags    `yaml:"flags"`
	Protocol    nethelpers.RouteProtocol `yaml:"protocol"`
	ConfigLayer ConfigLayer              `yaml:"layer"`
}

RouteSpecSpec describes the route.

func (*RouteSpecSpec) Normalize

func (route *RouteSpecSpec) Normalize()

Normalize converts 0.0.0.0 to zero value.

type RouteStatus

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

RouteStatus resource holds physical network link status.

func NewRouteStatus

func NewRouteStatus(namespace resource.Namespace, id resource.ID) *RouteStatus

NewRouteStatus initializes a RouteStatus resource.

func (*RouteStatus) DeepCopy

func (r *RouteStatus) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*RouteStatus) Metadata

func (r *RouteStatus) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*RouteStatus) ResourceDefinition

func (r *RouteStatus) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*RouteStatus) Spec

func (r *RouteStatus) Spec() interface{}

Spec implements resource.Resource.

func (*RouteStatus) String

func (r *RouteStatus) String() string

func (*RouteStatus) TypedSpec

func (r *RouteStatus) TypedSpec() *RouteStatusSpec

TypedSpec allows to access the Spec with the proper type.

type RouteStatusSpec

type RouteStatusSpec struct {
	Family       nethelpers.Family        `yaml:"family"`
	Destination  netaddr.IPPrefix         `yaml:"dst"`
	Source       netaddr.IP               `yaml:"src"`
	Gateway      netaddr.IP               `yaml:"gateway"`
	OutLinkIndex uint32                   `yaml:"outLinkIndex,omitempty"`
	OutLinkName  string                   `yaml:"outLinkName,omitempty"`
	Table        nethelpers.RoutingTable  `yaml:"table"`
	Priority     uint32                   `yaml:"priority"`
	Scope        nethelpers.Scope         `yaml:"scope"`
	Type         nethelpers.RouteType     `yaml:"type"`
	Flags        nethelpers.RouteFlags    `yaml:"flags"`
	Protocol     nethelpers.RouteProtocol `yaml:"protocol"`
}

RouteStatusSpec describes status of rendered secrets.

type Status

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

Status resource holds status of networking setup.

func NewStatus

func NewStatus(namespace resource.Namespace, id resource.ID) *Status

NewStatus initializes a Status resource.

func (*Status) DeepCopy

func (r *Status) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*Status) Metadata

func (r *Status) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*Status) ResourceDefinition

func (r *Status) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*Status) Spec

func (r *Status) Spec() interface{}

Spec implements resource.Resource.

func (*Status) String

func (r *Status) String() string

func (*Status) TypedSpec

func (r *Status) TypedSpec() *StatusSpec

TypedSpec allows to access the Spec with the proper type.

type StatusCheck

type StatusCheck func(*StatusSpec) bool

StatusCheck asserts specific part of Status to be true.

type StatusSpec

type StatusSpec struct {
	AddressReady      bool `yaml:"addressReady"`
	ConnectivityReady bool `yaml:"connectivityReady"`
	HostnameReady     bool `yaml:"hostnameReady"`
	EtcFilesReady     bool `yaml:"etcFilesReady"`
}

StatusSpec describes network state.

type TimeServerSpec

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

TimeServerSpec resource holds NTP server info.

func NewTimeServerSpec

func NewTimeServerSpec(namespace resource.Namespace, id resource.ID) *TimeServerSpec

NewTimeServerSpec initializes a TimeServerSpec resource.

func (*TimeServerSpec) DeepCopy

func (r *TimeServerSpec) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*TimeServerSpec) Metadata

func (r *TimeServerSpec) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*TimeServerSpec) ResourceDefinition

func (r *TimeServerSpec) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*TimeServerSpec) Spec

func (r *TimeServerSpec) Spec() interface{}

Spec implements resource.Resource.

func (*TimeServerSpec) String

func (r *TimeServerSpec) String() string

func (*TimeServerSpec) TypedSpec

func (r *TimeServerSpec) TypedSpec() *TimeServerSpecSpec

TypedSpec allows to access the Spec with the proper type.

type TimeServerSpecSpec

type TimeServerSpecSpec struct {
	NTPServers  []string    `yaml:"timeServers"`
	ConfigLayer ConfigLayer `yaml:"layer"`
}

TimeServerSpecSpec describes NTP servers.

type TimeServerStatus

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

TimeServerStatus resource holds NTP server info.

func NewTimeServerStatus

func NewTimeServerStatus(namespace resource.Namespace, id resource.ID) *TimeServerStatus

NewTimeServerStatus initializes a TimeServerStatus resource.

func (*TimeServerStatus) DeepCopy

func (r *TimeServerStatus) DeepCopy() resource.Resource

DeepCopy implements resource.Resource.

func (*TimeServerStatus) Metadata

func (r *TimeServerStatus) Metadata() *resource.Metadata

Metadata implements resource.Resource.

func (*TimeServerStatus) ResourceDefinition

func (r *TimeServerStatus) ResourceDefinition() meta.ResourceDefinitionSpec

ResourceDefinition implements meta.ResourceDefinitionProvider interface.

func (*TimeServerStatus) Spec

func (r *TimeServerStatus) Spec() interface{}

Spec implements resource.Resource.

func (*TimeServerStatus) String

func (r *TimeServerStatus) String() string

func (*TimeServerStatus) TypedSpec

func (r *TimeServerStatus) TypedSpec() *TimeServerStatusSpec

TypedSpec allows to access the Spec with the proper type.

type TimeServerStatusSpec

type TimeServerStatusSpec struct {
	NTPServers []string `yaml:"timeServers"`
}

TimeServerStatusSpec describes NTP servers.

type VIPEquinixMetalSpec added in v0.12.0

type VIPEquinixMetalSpec struct {
	ProjectID string `yaml:"projectID"`
	DeviceID  string `yaml:"deviceID"`
	APIToken  string `yaml:"apiToken"`
}

VIPEquinixMetalSpec describes virtual (elastic) IP settings for Equinix Metal.

type VIPOperatorSpec

type VIPOperatorSpec struct {
	IP            netaddr.IP `yaml:"ip"`
	GratuitousARP bool       `yaml:"gratuitousARP"`

	EquinixMetal VIPEquinixMetalSpec `yaml:"equinixMetal,omitempty"`
}

VIPOperatorSpec describes virtual IP operator options.

type VLANSpec

type VLANSpec struct {
	// VID is the vlan ID.
	VID uint16 `yaml:"vlanID"`

	// Protocol is the vlan protocol.
	Protocol nethelpers.VLANProtocol `yaml:"vlanProtocol"`
}

VLANSpec describes VLAN settings if Kind == "vlan".

func (*VLANSpec) Decode

func (vlan *VLANSpec) Decode(data []byte) error

Decode the VLANSpec from netlink attributes.

func (*VLANSpec) Encode

func (vlan *VLANSpec) Encode() ([]byte, error)

Encode the VLANSpec into netlink attributes.

type WireguardPeer

type WireguardPeer struct {
	PublicKey                   string             `yaml:"publicKey"`
	Endpoint                    string             `yaml:"endpoint"`
	PersistentKeepaliveInterval time.Duration      `yaml:"persistenKeepaliveInterval"`
	AllowedIPs                  []netaddr.IPPrefix `yaml:"allowedIPs"`
}

WireguardPeer describes a single peer.

func (*WireguardPeer) Equal

func (peer *WireguardPeer) Equal(other *WireguardPeer) bool

Equal checks two WireguardPeer structs for equality.

type WireguardSpec

type WireguardSpec struct {
	PrivateKey   string          `yaml:"privateKey"`
	ListenPort   int             `yaml:"listenPort"`
	FirewallMark int             `yaml:"firewallMark"`
	Peers        []WireguardPeer `yaml:"peers"`
}

WireguardSpec describes Wireguard settings if Kind == "wireguard".

func (*WireguardSpec) Decode

func (spec *WireguardSpec) Decode(dev *wgtypes.Device)

Decode spec from the device state.

func (*WireguardSpec) Encode

func (spec *WireguardSpec) Encode(existing *WireguardSpec) (*wgtypes.Config, error)

Encode converts WireguardSpec to wgctrl.Config "patch" to adjust the config to match the spec.

Both specs should be sorted.

Encode produces a "diff" as *wgtypes.Config which when applied transitions `existing` configuration into configuration `spec`.

func (*WireguardSpec) Equal

func (spec *WireguardSpec) Equal(other *WireguardSpec) bool

Equal checks two WireguardSpecs for equality.

Both specs should be sorted before calling this method.

func (*WireguardSpec) IsZero

func (spec *WireguardSpec) IsZero() bool

IsZero checks if the WireguardSpec is zero value.

func (*WireguardSpec) Merge added in v0.12.0

func (spec *WireguardSpec) Merge(other WireguardSpec)

Merge with other Wireguard spec overwriting non-zero values.

func (*WireguardSpec) Sort

func (spec *WireguardSpec) Sort()

Sort the spec so that comparison is possible.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL