Documentation ¶
Index ¶
- Constants
- Variables
- type Boot
- type BootType
- type BrokenDevice
- type BrokenPool
- type Container
- type ContainerID
- type ContainerModule
- type ContainerNetworkConfig
- type ContractCancelledEvent
- type Device
- type DeviceType
- type DiskIOCountersStat
- type DisksIOCountersStat
- type ErrInvalidDeviceType
- type ErrNotEnoughSpace
- type EventKind
- type Events
- type FarmID
- type Flister
- type Gateway
- type GatewayMetrics
- type HostMonitor
- type Identifier
- type IdentityManager
- type IfaceType
- type KernelArgs
- type MachineMetric
- type MachineMetrics
- type Member
- type MountInfo
- type MountOptions
- type NetID
- type NetMetric
- type NetlinkAddress
- type NetlinkAddresses
- type Network
- type NetworkInfo
- type Networker
- type NicIOCounterStat
- type NicsIOCounterStat
- type OptionPublicConfig
- type PoolStats
- type PoolsStats
- type Provision
- type PublicConfig
- type PublicConfigEvent
- type QSFSD
- type QSFSInfo
- type QSFSMetrics
- type RootFSPropagation
- type Route
- type SharedDir
- type Statistics
- type Stats
- type StorageModule
- type StrIdentifier
- type SystemMonitor
- type TimesStat
- type Usage
- type VDisk
- type VM
- type VMDisk
- type VMIface
- type VMInfo
- type VMModule
- type VMNetworkInfo
- type VersionMonitor
- type VirtualMemoryStat
- type Volume
- type YggdrasilTap
Constants ¶
const ( RootFSPropagationSlave = "slave" RootFSPropagationRslave = "rslave" RootFSPropagationPrivate = "private" RootFSPropagationRprivate = "rprivate" )
Variables ¶
var ( //DefaultMountOptions has sane values for mount DefaultMountOptions = MountOptions{ ReadOnly: false, Limit: 256 * gridtypes.Megabyte, } //ReadOnlyMountOptions shortcut for readonly mount options ReadOnlyMountOptions = MountOptions{ ReadOnly: true, } )
Functions ¶
This section is empty.
Types ¶
type Boot ¶ added in v0.5.5
type Boot struct { Type BootType Path string //Environment only works with Boot type virtiofs Environment map[string]string }
Boot structure
type BrokenDevice ¶
type BrokenDevice struct { // Path to allow identification of the disk Path string // Err returned which lead to the disk being marked as faulty Err error }
BrokenDevice is a disk which is somehow not fully functional. Storage keeps track of disks which have failed at some point, so they are not used, and to be able to later report this to other daemons.
type BrokenPool ¶
type BrokenPool struct { // Label of the broken pool Label string // Err returned by the action which let to the pool being marked as broken Err error }
BrokenPool contains info about a malfunctioning storage pool
type Container ¶
type Container struct { // Name of container Name string // path to the rootfs of the container RootFS string // Env env variables to container in format {'KEY=VALUE', 'KEY2=VALUE2'} Env []string // WorkingDir of the entrypoint command WorkingDir string // Network network info for container Network NetworkInfo // Mounts extra mounts for container Mounts []MountInfo // Entrypoint the process to start inside the container Entrypoint string // Interactivity enable Core X as PID 1 on the container Interactive bool // CPU count limit CPU uint // Memory limit in Memory gridtypes.Unit // Logs backends Logs []logger.Logs // Stats container metrics backend Stats []Stats // Elevated privileges (to use fuse inside) Elevated bool // CreatedAt time CreatedAt time.Time // RootfsPropagation root fs propagation mode (rshared,shared,slave,...) RootFsPropagation RootFSPropagation // How much time to wait for the container to gracefully shutdown before sending a SIGKILL (default: 5) ShutdownTimeout time.Duration }
Container creation info
type ContainerModule ¶
type ContainerModule interface { // Run creates and starts a container on the node. It also auto // starts command defined by `entrypoint` inside the container // ns: tenant namespace // data: Container info Run(ns string, data Container) (ContainerID, error) // Exec executes a command in the container // stdout and stderr is ignored Exec(ns string, containerID string, timeout time.Duration, args ...string) error // ListNS list the name of all the container namespaces ListNS() ([]string, error) // List all the existing container IDs from a certain namespace ns // if ns is empty, then the container IDs from all existing namespaces will be return List(ns string) ([]ContainerID, error) // Inspect, return information about the container, given its container id Inspect(ns string, id ContainerID) (Container, error) SignalDelete(ns string, id ContainerID) error Delete(ns string, id ContainerID) error // Get logs of the container Logs(ns string, containerID string) (logs string, err error) }
ContainerModule defines rpc interface to containerd
type ContainerNetworkConfig ¶ added in v0.4.0
ContainerNetworkConfig defines how to construct the network namespace of a container
type ContractCancelledEvent ¶ added in v0.5.5
ContractCancelledEvent a contract has been cancelled, The type specify if this is just notification of the reconnection, or actual event has been received.
type DeviceType ¶
type DeviceType = zos.DeviceType
DeviceType is the actual type of hardware that the storage device runs on, i.e. SSD or HDD
type DiskIOCountersStat ¶
type DiskIOCountersStat struct { disk.IOCountersStat Time time.Time }
DiskIOCountersStat struct
func (*DiskIOCountersStat) String ¶
func (s *DiskIOCountersStat) String() string
type DisksIOCountersStat ¶
type DisksIOCountersStat map[string]DiskIOCountersStat
DisksIOCountersStat alias for map[string]IOCountersStat required by zbus
type ErrInvalidDeviceType ¶ added in v0.3.4
type ErrInvalidDeviceType struct {
DeviceType DeviceType
}
ErrInvalidDeviceType raised when trying to allocate space on unsupported device type
func (ErrInvalidDeviceType) Error ¶ added in v0.3.4
func (e ErrInvalidDeviceType) Error() string
type ErrNotEnoughSpace ¶
type ErrNotEnoughSpace struct {
DeviceType DeviceType
}
ErrNotEnoughSpace indicates that there is not enough space in a pool of the requested type to create the filesystem
func (ErrNotEnoughSpace) Error ¶
func (e ErrNotEnoughSpace) Error() string
type EventKind ¶ added in v0.5.5
type EventKind int
EventKind describes event kind
const ( // EventSubscribed event is always sent when a new connection to tfchain is done // this will let the receiver know that we just reconnected to the network hence // possible events loss has occurred. Hence the receiver need to make sure // it's in sync with the network EventSubscribed EventKind = iota // EventReceived mean a new event has been received, and need to be handled EventReceived )
type Events ¶ added in v0.5.5
type Events interface { PublicConfigEvent(ctx context.Context) <-chan PublicConfigEvent ContractCancelledEvent(ctx context.Context) <-chan ContractCancelledEvent }
type Flister ¶
type Flister interface { // Mount mounts an flist located at url using the 0-db located at storage // in a RO mode. note that there is no way u can unmount a ro flist because // it can be shared by many users, it's then up to system to decide if the // mount is not needed anymore and clean it up Mount(name, url string, opt MountOptions) (path string, err error) // UpdateMountSize change the mount size UpdateMountSize(name string, limit gridtypes.Unit) (path string, err error) // Umount a RW mount. this only unmounts the RW layer and remove the assigned // volume. Unmount(name string) error // HashFromRootPath returns flist hash from a running g8ufs mounted with NamedMount HashFromRootPath(name string) (string, error) // FlistHash returns md5 of flist if available (requesting the hub) FlistHash(url string) (string, error) Exists(name string) (bool, error) }
Flister is the interface for the flist module
type GatewayMetrics ¶ added in v0.5.5
func (*GatewayMetrics) Nu ¶ added in v0.5.5
func (m *GatewayMetrics) Nu(service string) (result uint64)
type HostMonitor ¶
HostMonitor interface (provided by noded)
type Identifier ¶
type Identifier interface {
Identity() string
}
Identifier is the interface that defines how an object can be used as an identity
type IdentityManager ¶
type IdentityManager interface { // NodeID returns the node id (public key) NodeID() StrIdentifier // NodeIDNumeric returns the node registered ID. NodeIDNumeric() (uint32, error) // FarmID return the farm id this node is part of. this is usually a configuration // that the node is booted with. An error is returned if the farmer id is not configured FarmID() (FarmID, error) // Farm returns name of the farm. Or error Farm() (string, error) //FarmSecret get the farm secret as defined in the boot params FarmSecret() (string, error) // Sign signs the message with privateKey and returns a signature. Sign(message []byte) ([]byte, error) // Verify reports whether sig is a valid signature of message by publicKey. Verify(message, sig []byte) error // Encrypt encrypts message with the public key of the node Encrypt(message []byte) ([]byte, error) // Decrypt decrypts message with the private of the node Decrypt(message []byte) ([]byte, error) // EncryptECDH aes encrypt msg using a shared key derived from private key of the node and public key of the other party using Elliptic curve Diffie Helman algorithm // the nonce if prepended to the encrypted message EncryptECDH(msg []byte, publicKey []byte) ([]byte, error) // DecryptECDH decrypt aes encrypted msg using a shared key derived from private key of the node and public key of the other party using Elliptic curve Diffie Helman algorithm DecryptECDH(msg []byte, publicKey []byte) ([]byte, error) // PrivateKey sends the keypair PrivateKey() []byte }
IdentityManager interface.
type IfaceType ¶ added in v0.5.5
type IfaceType string
IfaceType define the different public interface supported
type KernelArgs ¶ added in v0.5.5
KernelArgs are arguments passed to the kernel
func (KernelArgs) Extend ¶ added in v0.5.5
func (s KernelArgs) Extend(k KernelArgs)
Extend the arguments with set of extra arguments
func (KernelArgs) String ¶ added in v0.5.5
func (s KernelArgs) String() string
String builds commandline string
type MachineMetric ¶ added in v0.5.5
MachineMetric is a container for metrics from multiple networks currently only groped as private (wiregaurd + yggdrasil), and public (public Ips)
type MachineMetrics ¶ added in v0.5.5
type MachineMetrics map[string]MachineMetric
MachineMetrics container for metrics from multiple machines
type MountInfo ¶
type MountInfo struct { Source string // source of the mount point on the host Target string // target of mount inside the container }
MountInfo defines a mount point
type MountOptions ¶
type MountOptions struct { // ReadOnly ReadOnly bool // Limit size of read-write layer Limit gridtypes.Unit // optional storage url (default to hub storage) Storage string // PersistedVolume used in RW mode. If not provided // one that will be created automatically with `Limit` that uses the same mount // name, and will be delete (by name) on Unmount. If provided, make sure // use use a different name than the mount id, or it will also get deleted // on unmount. PersistedVolume string }
MountOptions struct
type NetMetric ¶ added in v0.5.5
type NetMetric struct { NetRxPackets uint64 `json:"net_rx_packets"` NetRxBytes uint64 `json:"net_rx_bytes"` NetTxPackets uint64 `json:"net_tx_packets"` NetTxBytes uint64 `json:"net_tx_bytes"` }
NetMetric aggregated metrics from a single network
type NetlinkAddresses ¶
NetlinkAddresses alias for [][]NetlinkAddress
type NetworkInfo ¶
type NetworkInfo struct { // Containers don't need to know about anything about bridges, // IPs, wireguards since this is all is only known by the network // resource which is out of the scope of this module Namespace string }
NetworkInfo defines a network configuration for a container
type Networker ¶
type Networker interface { // Ready return nil is networkd is ready to operate // This function is used by other deamon to test if networkd is done booting Ready() error // Create a new network resource CreateNR(Network) (string, error) // Delete a network resource DeleteNR(Network) error // ZDBPrepare creates a network namespace with a macvlan interface into it // to allow the 0-db container to be publicly accessible // it retusn the name of the network namespace created // id is the zdb id (should be unique) is used to drive the hw mac // address for the interface so they always get the same IP ZDBPrepare(id string) (string, error) // ZDBDestroy is the opposite of ZDPrepare, it makes sure network setup done // for zdb is rewind. ns param is the namespace return by the ZDBPrepare ZDBDestroy(ns string) error // QSFSNamespace returns the namespace of the qsfs workload QSFSNamespace(id string) string // QSFSYggIP returns the ygg ip of the qsfs workload QSFSYggIP(id string) (string, error) // QSFSPrepare creates a network namespace with a macvlan interface into it // to allow qsfs container to reach the internet but not be reachable itself // it return the name of the network namespace created, and the ygg ip. // the id should be unique. QSFSPrepare(id string) (string, string, error) // QSFSDestroy rewind setup by QSFSPrepare QSFSDestroy(id string) error // SetupPrivTap sets up a tap device in the network namespace for the networkID. It is hooked // to the network bridge. The name of the tap interface is returned SetupPrivTap(networkID NetID, name string) (string, error) // SetupYggTap sets up a tap device in the host namespace for the yggdrasil ip SetupYggTap(name string) (YggdrasilTap, error) // TapExists checks if the tap device with the given name exists already TapExists(name string) (bool, error) // RemoveTap removes the tap device with the given name RemoveTap(name string) error // PublicIPv4Support enabled on this node for reservations PublicIPv4Support() bool // SetupPubTap sets up a tap device in the host namespace for the public ip // reservation id. It is hooked to the public bridge. The name of the tap // interface is returned SetupPubTap(name string) (string, error) // PubTapExists checks if the tap device for the public network exists already PubTapExists(name string) (bool, error) // RemovePubTap removes the public tap device from the host namespace RemovePubTap(name string) error // SetupPubIPFilter sets up filter for this public ip SetupPubIPFilter(filterName string, iface string, ipv4 net.IP, ipv6 net.IP, mac string) error // RemovePubIPFilter removes the filter setted up by SetupPubIPFilter RemovePubIPFilter(filterName string) error // PubIPFilterExists checks if there is a filter installed with that name PubIPFilterExists(filterName string) bool // DisconnectPubTap disconnects the public tap from the network. The interface // itself is not removed and will need to be cleaned up later DisconnectPubTap(name string) error // GetSubnet of the network with the given ID on the local node GetSubnet(networkID NetID) (net.IPNet, error) // GetNet returns the full network range of the network GetNet(networkID NetID) (net.IPNet, error) // GetPublicIPv6Subnet returns the IPv6 prefix op the public subnet of the host GetPublicIPv6Subnet() (net.IPNet, error) // GetDefaultGwIP returns the IPs of the default gateways inside the network // resource identified by the network ID on the local node, for IPv4 and IPv6 // respectively GetDefaultGwIP(networkID NetID) (net.IP, net.IP, error) // GetIPv6From4 generates an IPv6 address from a given IPv4 address in a NR GetIPv6From4(networkID NetID, ip net.IP) (net.IPNet, error) // Addrs return the IP addresses of interface // if the interface is in a network namespace netns needs to be not empty Addrs(iface string, netns string) (ips []net.IP, mac string, err error) WireguardPorts() ([]uint, error) // Set node public namespace config SetPublicConfig(cfg PublicConfig) error // Get node public namespace config GetPublicConfig() (PublicConfig, error) // ZOSAddresses monitoring streams for ZOS bridge IPs ZOSAddresses(ctx context.Context) <-chan NetlinkAddresses // DMZAddresses monitoring streams for dmz public interface DMZAddresses(ctx context.Context) <-chan NetlinkAddresses // YggAddresses monitoring streams for yggdrasil interface YggAddresses(ctx context.Context) <-chan NetlinkAddresses PublicAddresses(ctx context.Context) <-chan OptionPublicConfig }
Networker is the interface for the network module
type NicIOCounterStat ¶
type NicIOCounterStat struct { net.IOCountersStat RateOut uint64 RateIn uint64 }
NicIOCounterStat counter for a nic
type NicsIOCounterStat ¶
type NicsIOCounterStat []NicIOCounterStat
NicsIOCounterStat alias for []NicIOCounterStat
type OptionPublicConfig ¶ added in v0.5.5
type OptionPublicConfig struct { PublicConfig HasPublicConfig bool }
type PoolStats ¶
type PoolStats struct { disk.UsageStat // Counters IO counter for each pool device Counters map[string]disk.IOCountersStat `json:"counters"` }
PoolStats is pool statistics reported by storaged
type PublicConfig ¶ added in v0.5.5
type PublicConfig struct { // Type define if we need to use // the Vlan field or the MacVlan Type IfaceType `json:"type"` IPv4 gridtypes.IPNet `json:"ipv4"` IPv6 gridtypes.IPNet `json:"ipv6"` GW4 net.IP `json:"gw4"` GW6 net.IP `json:"gw6"` // Domain is the node domain name like gent01.devnet.grid.tf // or similar Domain string `json:"domain"` }
PublicConfig is the configuration of the interface that is connected to the public internet
func PublicConfigFrom ¶ added in v0.5.5
func PublicConfigFrom(cfg substrate.PublicConfig) (pub PublicConfig, err error)
func (PublicConfig) Equal ¶ added in v0.5.5
func (p PublicConfig) Equal(cfg PublicConfig) bool
type PublicConfigEvent ¶ added in v0.5.5
type PublicConfigEvent struct { Kind EventKind PublicConfig substrate.PublicConfig }
PublicConfigEvent pubic config event received. The type specify if this is just notification of the reconnection, or actual event has been received.
type QSFSD ¶ added in v0.5.5
type QSFSD interface { Mount(wlID string, cfg zos.QuantumSafeFS) (QSFSInfo, error) UpdateMount(wlID string, cfg zos.QuantumSafeFS) (QSFSInfo, error) SignalDelete(wlID string) error Metrics() (QSFSMetrics, error) }
type QSFSMetrics ¶ added in v0.5.5
func (*QSFSMetrics) Nu ¶ added in v0.5.5
func (q *QSFSMetrics) Nu(wlID string) (result uint64)
type RootFSPropagation ¶ added in v0.5.5
type RootFSPropagation string
RootFSPropagation defines how the submounts are propagated to its mountpoint peers
type Route ¶ added in v0.5.5
type Route struct { Net net.IPNet // Gateway can be nil, in that // case the device is used as a dev instead Gateway net.IP }
Route structure
type Statistics ¶ added in v0.5.5
type Stats ¶ added in v0.5.5
type Stats struct { Type string `bson:"type" json:"type"` Endpoint string `bson:"endpoint" json:"endpoint"` }
Stats endpoints
type StorageModule ¶
type StorageModule interface { // Cache method return information about zos cache volume Cache() (Volume, error) // Total gives the total amount of storage available for a device type Total(kind DeviceType) (uint64, error) // BrokenPools lists the broken storage pools that have been detected BrokenPools() []BrokenPool // BrokenDevices lists the broken devices that have been detected BrokenDevices() []BrokenDevice //Monitor returns stats stream about pools Monitor(ctx context.Context) <-chan PoolsStats // VolumeCreate creates a new volume VolumeCreate(name string, size gridtypes.Unit) (Volume, error) // VolumeUpdate updates the size of an existing volume VolumeUpdate(name string, size gridtypes.Unit) error // VolumeLookup return volume information for given name VolumeLookup(name string) (Volume, error) // VolumeDelete deletes a volume by name VolumeDelete(name string) error // VolumeList list all volumes VolumeList() ([]Volume, error) // DiskCreate creates a virtual disk given name and size DiskCreate(name string, size gridtypes.Unit) (VDisk, error) // DiskResize resizes the disk to given size DiskResize(name string, size gridtypes.Unit) (VDisk, error) // DiskWrite writes the given raw image to disk DiskWrite(name string, image string) error // DiskFormat makes sure disk has filesystem, if it already formatted nothing happens DiskFormat(name string) error // DiskLookup looks up vdisk by name DiskLookup(name string) (VDisk, error) // DiskExists checks if disk exists DiskExists(name string) bool // DiskDelete deletes a disk DiskDelete(name string) error DiskList() ([]VDisk, error) //Devices list all "allocated" devices Devices() ([]Device, error) // DeviceAllocate allocates a new device (formats and give a new ID) DeviceAllocate(min gridtypes.Unit) (Device, error) // DeviceLookup inspects a previously allocated device DeviceLookup(name string) (Device, error) }
StorageModule is the storage subsystem interface this should allow you to work with the following types of storage medium - full disks (device) (these are used by zdb) - subvolumes these are used as a read-write layers for 0-fs mounts - vdisks are used by zmachines this works as following: a storage module maintains a list of ALL disks on the system separated in 2 sets of pools (SSDs, and HDDs) ssd pools can only be used for - subvolumes - vdisks hdd pools are only used by zdb as one disk
type StrIdentifier ¶
type StrIdentifier string
StrIdentifier is a helper type that implement the Identifier interface on top of simple string
func (StrIdentifier) Identity ¶
func (s StrIdentifier) Identity() string
Identity implements the Identifier interface
type SystemMonitor ¶
type SystemMonitor interface { NodeID() uint32 Memory(ctx context.Context) <-chan VirtualMemoryStat CPU(ctx context.Context) <-chan TimesStat Disks(ctx context.Context) <-chan DisksIOCountersStat Nics(ctx context.Context) <-chan NicsIOCounterStat }
SystemMonitor interface (provided by noded)
type VM ¶
type VM struct { // virtual machine name, or ID Name string // CPU is number of cores assigned to the VM CPU uint8 // Memory size Memory gridtypes.Unit // Network is network info Network VMNetworkInfo // KernelImage path to uncompressed linux kernel ELF KernelImage string // InitrdImage (optiona) path to initrd disk InitrdImage string // KernelArgs to override the default kernel arguments. (default: "ro console=ttyS0 noapic reboot=k panic=1 pci=off nomodules") KernelArgs KernelArgs // Entrypoint a shell-compatible command to execute as the init process Entrypoint string // Disks are a list of disks that are going to // be auto allocated on the provided storage path Disks []VMDisk Shared []SharedDir // Boot options Boot Boot // Environment is injected to the VM via container mechanism (virtiofs) // otherwise it's added to the kernel arguments Environment map[string]string // If this flag is set, the VM module will not auto start // this machine hence, also no auto clean up when it exits // it's up to the caller to check for the machine status // and do clean up (module.Delete(vm)) when needed NoKeepAlive bool }
VM config structure
type VMDisk ¶
type VMDisk struct { // Path raw disk path Path string // Target is mount point. Only in container mode Target string }
VMDisk specifies vm disk params
type VMIface ¶ added in v0.4.9
type VMIface struct { // Tap device name Tap string // Mac address of the device MAC string // ips assigned to this interface IPs []net.IPNet // extra routes on this interface Routes []Route // IP4DefaultGateway address for ipv4 IP4DefaultGateway net.IP // IP6DefaultGateway address for ipv6 IP6DefaultGateway net.IP // Private or public network Public bool }
VMIface structure
type VMInfo ¶
type VMInfo struct { // Flag for enabling/disabling Hyperthreading // Required: true HtEnabled bool // Memory size of VM // Required: true Memory int64 // Number of vCPUs (either 1 or an even number) CPU int64 }
VMInfo returned by the inspect method
type VMModule ¶
type VMModule interface { Run(vm VM) error Inspect(name string) (VMInfo, error) Delete(name string) error Exists(name string) bool Logs(name string) (string, error) List() ([]string, error) Metrics() (MachineMetrics, error) }
VMModule defines the virtual machine module interface
type VMNetworkInfo ¶
type VMNetworkInfo struct { // Interfaces for the vm network Ifaces []VMIface // Nameservers dns servers Nameservers []net.IP }
VMNetworkInfo structure
type VersionMonitor ¶
type VersionMonitor interface { GetVersion() semver.Version Version(ctx context.Context) <-chan semver.Version }
VersionMonitor interface (provided by identityd)
type YggdrasilTap ¶ added in v0.5.5
YggdrasilTap structure
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package gedis implements a client for Gedis (https://github.com/threefoldtech/digitalmeX/tree/master/docs/Gedis)
|
Package gedis implements a client for Gedis (https://github.com/threefoldtech/digitalmeX/tree/master/docs/Gedis) |
options
Package options abstract setting common networking sys flags on the selected namespaces
|
Package options abstract setting common networking sys flags on the selected namespaces |
Package provision exposes the Engine type.
|
Package provision exposes the Engine type. |
common
Package common hold logic that is used by both the provision and primitive package it purpose is mainly to avoid circular dependencies
|
Package common hold logic that is used by both the provision and primitive package it purpose is mainly to avoid circular dependencies |
Package zdb implements a client to 0-db: https://github.com/threefoldtech/0-DB
|
Package zdb implements a client to 0-db: https://github.com/threefoldtech/0-DB |
Package zinit exposes function to interat with zinit service life cyle management
|
Package zinit exposes function to interat with zinit service life cyle management |