v1alpha1

package
v0.7.5-157-g2c900d2d Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file expect in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file expect in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

Index

Constants

View Source
const (
	NetworkInterfaceStateUnknown      = NetworkInterfaceState("unknown")
	NetworkInterfaceStateConnected    = NetworkInterfaceState("connected")
	NetworkInterfaceStateDisconnected = NetworkInterfaceState("disconnected")
)
View Source
const (
	NetworkStateUnknown = NetworkState("unknown")
	NetworkStateUp      = NetworkState("up")
	NetworkStateDown    = NetworkState("down")
)
View Source
const Version = "v1alpha1"

Variables

View Source
var SchemeGroupVersion = schema.GroupVersion{
	Group:   network.GroupName,
	Version: Version,
}

Functions

func AddToScheme

func AddToScheme(scheme *runtime.Scheme) error

func AddToSchemeWithGV

func AddToSchemeWithGV(scheme *runtime.Scheme, schemeGroupVersion schema.GroupVersion) error

Types

type Network

type Network = zip.Object[NetworkSpec, NetworkStatus]

Network is the mutable API object that represents a network.

type NetworkInterface

NetworkInterface is the mutable API object that represents network interfaces.

type NetworkInterfaceList

NetworkInterfaceList is the mutable API object that represents a list of networks.

type NetworkInterfaceSpec

type NetworkInterfaceSpec struct {
	// The name of the interface.
	IfName string `json:"ifname,omitempty"`

	// IPv4 address in CIDR notation, which includes the subnet.
	CIDR string

	// Gateway IPv4 address.
	Gateway string

	// IPv4 address of the primary DNS server.
	DNS0 string

	// IPv4 address of the secondary DNS server.
	DNS1 string

	// Hostname of the IPv4 address.
	Hostname string

	// Domain/Search suffix for IPv4 address.
	Domain string

	// Hardware address of a machine interface.
	MacAddress string `json:"mac,omitempty"`
}

NetworkInterfaceSpec represents a specific network interface which is situated on the network.

type NetworkInterfaceState

type NetworkInterfaceState string

NetworkInterfaceState indicates the state of the network.

func (NetworkInterfaceState) String

func (ms NetworkInterfaceState) String() string

String implements fmt.Stringer

type NetworkInterfaceStatus

type NetworkInterfaceStatus struct {
	// State is the current state of the network interface.
	State NetworkInterfaceState `json:"state"`
}

type NetworkInterfaceTemplateSpec

type NetworkInterfaceTemplateSpec struct {
	// Metadata of the pods created from this template.
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec defines the behavior of the network interface.
	Spec NetworkInterfaceSpec `json:"spec,omitempty"`
}

NetworkInterfaceTemplateSpec describes the data a network interface should have when created from a template.

type NetworkList

type NetworkList = zip.ObjectList[NetworkSpec, NetworkStatus]

NetworkList is the mutable API object that represents a list of networks.

type NetworkService

type NetworkService interface {
	Create(context.Context, *Network) (*Network, error)
	Start(context.Context, *Network) (*Network, error)
	Stop(context.Context, *Network) (*Network, error)
	Update(context.Context, *Network) (*Network, error)
	Delete(context.Context, *Network) (*Network, error)
	Get(context.Context, *Network) (*Network, error)
	List(context.Context, *NetworkList) (*NetworkList, error)
}

NetworkService is the interface of available methods which can be performed by an implementing network driver.

func NewNetworkServiceHandler

func NewNetworkServiceHandler(ctx context.Context, impl NetworkService, opts ...zip.ClientOption) (NetworkService, error)

NewNetworkServiceHandler returns a service based on an inline API client which essentially wraps the specific call, enabling pre- and post- call hooks. This is useful for wrapping the command with decorators, for example, a cache, error handlers, etc. Simultaneously, it enables access to the service via inline code without having to make invocations to an external handler.

type NetworkServiceHandler

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

NetworkServiceHandler provides a Zip API Object Framework service for the network.

func (*NetworkServiceHandler) Create

func (client *NetworkServiceHandler) Create(ctx context.Context, req *Network) (*Network, error)

Create implements NetworkService

func (*NetworkServiceHandler) Delete

func (client *NetworkServiceHandler) Delete(ctx context.Context, req *Network) (*Network, error)

Delete implements NetworkService

func (*NetworkServiceHandler) Get

func (client *NetworkServiceHandler) Get(ctx context.Context, req *Network) (*Network, error)

Get implements NetworkService

func (*NetworkServiceHandler) List

func (client *NetworkServiceHandler) List(ctx context.Context, req *NetworkList) (*NetworkList, error)

List implements NetworkService

func (*NetworkServiceHandler) Start

func (client *NetworkServiceHandler) Start(ctx context.Context, req *Network) (*Network, error)

Start implements NetworkService

func (*NetworkServiceHandler) Stop

func (client *NetworkServiceHandler) Stop(ctx context.Context, req *Network) (*Network, error)

Stop implements NetworkService

func (*NetworkServiceHandler) Update

func (client *NetworkServiceHandler) Update(ctx context.Context, req *Network) (*Network, error)

Update implements NetworkService

type NetworkSpec

type NetworkSpec struct {
	// Driver is the name of the implementing strategy.
	Driver string `json:"driver,omitempty"`

	// Interface name of this network.
	IfName string `json:"ifName,omitempty"`

	// The gateway IP address of the network.
	Gateway string `json:"gateway,omitempty"`

	// The network mask to apply over the gateway IP address to gather the subnet
	// range.
	Netmask string `json:"netmask,omitempty"`

	// Network interfaces associated with this network.
	Interfaces []NetworkInterfaceTemplateSpec `json:"interfaces,omitempty"`
}

NetworkSpec contains the desired behavior of the network.

type NetworkState

type NetworkState string

NetworkState indicates the state of the network.

func (NetworkState) String

func (ms NetworkState) String() string

String implements fmt.Stringer

type NetworkStatus

type NetworkStatus struct {
	// State is the current state of the network.
	State NetworkState `json:"state"`

	// Statistics
	Collisions        uint64 `json:"collisions"`
	Multicast         uint64 `json:"multicast"`
	RxBytes           uint64 `json:"rxBytes"`
	RxCompressed      uint64 `json:"rxCompressed"`
	RxCrcErrors       uint64 `json:"rxCrcErrors"`
	RxDropped         uint64 `json:"rxDropped"`
	RxErrors          uint64 `json:"rxErrors"`
	RxFifoErrors      uint64 `json:"rxFifoErrors"`
	RxFrameErrors     uint64 `json:"rxFrameErrors"`
	RxLengthErrors    uint64 `json:"rxLengthErrors"`
	RxMissedErrors    uint64 `json:"rxMissedErrors"`
	RxOverErrors      uint64 `json:"rxOverErrors"`
	RxPackets         uint64 `json:"rxPackets"`
	TxAbortedErrors   uint64 `json:"txAbortedErrors"`
	TxBytes           uint64 `json:"txBytes"`
	TxCarrierErrors   uint64 `json:"txCarrierErrors"`
	TxCompressed      uint64 `json:"txCompressed"`
	TxDropped         uint64 `json:"txDropped"`
	TxErrors          uint64 `json:"txErrors"`
	TxFifoErrors      uint64 `json:"txFifoErrors"`
	TxHeartbeatErrors uint64 `json:"txHeartbeatErrors"`
	TxPackets         uint64 `json:"txPackets"`
	TxWindowErrors    uint64 `json:"txWindowErrors"`

	// DriverConfig is driver-specific attributes which are populated by the
	// underlying network implementation.
	DriverConfig interface{} `json:"driverConfig,omitempty"`
}

NetworkStatus contains the complete status of the network.

type NetworkTemplateSpec

type NetworkTemplateSpec struct {
	// Metadata of the pods created from this template.
	metav1.ObjectMeta

	// Spec defines the behavior of the network.
	Spec NetworkSpec
}

NetworkTemplateSpec describes the data a network should have when created from a template.

Jump to

Keyboard shortcuts

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