Documentation
¶
Index ¶
- Constants
- type Backend
- type Bytes
- type DeviceType
- type Encryption
- type EncryptionAlgorithm
- type EncryptionKey
- type GPU
- type GatewayBase
- type GatewayFQDNProxy
- type GatewayFQDNResult
- type GatewayNameProxy
- type GatewayProxyResult
- type MachineCapacity
- type MachineInterface
- type MachineMount
- type MachineNetwork
- type MachineNetworkLight
- type Mycelium
- type MyceliumIP
- type MyceliumPeer
- type NetID
- type Network
- type NetworkLight
- type Peer
- type PublicIP
- type PublicIP4
- type PublicIPResult
- type QuantumCompression
- type QuantumSafeConfig
- type QuantumSafeFS
- type QuantumSafeFSConfig
- type QuantumSafeMeta
- type QuatumSafeFSResult
- type Volume
- type VolumeResult
- type ZDB
- type ZDBMode
- type ZDBResult
- type ZLogs
- type ZMachine
- type ZMachineLight
- type ZMachineLightResult
- type ZMachineResult
- type ZMount
- type ZMountResult
- type ZdbBackend
- type ZdbGroup
Constants ¶
const ( // ZMountType type ZMountType gridtypes.WorkloadType = "zmount" // NetworkType type NetworkType gridtypes.WorkloadType = "network" // NetworkLightType type NetworkLightType gridtypes.WorkloadType = "network-light" // ZDBType type ZDBType gridtypes.WorkloadType = "zdb" // ZMachineType type ZMachineType gridtypes.WorkloadType = "zmachine" // ZMachineLightType type ZMachineLightType gridtypes.WorkloadType = "zmachine-light" // VolumeType type VolumeType gridtypes.WorkloadType = "volume" //PublicIPv4Type type [deprecated] PublicIPv4Type gridtypes.WorkloadType = "ipv4" //PublicIPType type is the new way to assign public ips // to a VM. this has flags (V4, and V6) that has to be set. PublicIPType gridtypes.WorkloadType = "ip" // GatewayNameProxyType type GatewayNameProxyType gridtypes.WorkloadType = "gateway-name-proxy" // GatewayFQDNProxyType type GatewayFQDNProxyType gridtypes.WorkloadType = "gateway-fqdn-proxy" // QuantumSafeFSType type QuantumSafeFSType gridtypes.WorkloadType = "qsfs" // ZLogsType type ZLogsType gridtypes.WorkloadType = "zlogs" )
const ( ZDBModeUser = "user" ZDBModeSeq = "seq" )
Enumeration of the modes 0-db can operate in
const (
MyceliumIPSeedLen = 6
)
const (
MyceliumKeyLen = 32
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend string
func (Backend) Valid ¶
Parse accepts http://ip:port, http://ip or ip:port checks if backend string is a valid string based on the tlsPassthrough parameter ip:port is only valid in case of tlsPassthrough is true http://ip:port or http://ip is valid in case of tlsPassthrough is false
type Bytes ¶
type Bytes []byte
Bytes value that is represented as hex when serialized to json
func MustBytesFromHex ¶
MustBytesFromHex like BytesFromHex but panics if h is not a valid hex string
func (Bytes) MarshalText ¶
func (*Bytes) UnmarshalText ¶
type DeviceType ¶
type DeviceType string
DeviceType is the actual type of hardware that the storage device runs on, i.e. SSD or HDD
const ( SSDDevice DeviceType = "ssd" HDDDevice DeviceType = "hdd" )
Known device types
func (DeviceType) String ¶
func (d DeviceType) String() string
type Encryption ¶
type Encryption struct { Algorithm EncryptionAlgorithm `json:"algorithm" toml:"algorithm"` Key EncryptionKey `json:"key" toml:"key"` }
type EncryptionAlgorithm ¶
type EncryptionAlgorithm string
type EncryptionKey ¶
type EncryptionKey []byte
func (EncryptionKey) MarshalText ¶
func (k EncryptionKey) MarshalText() ([]byte, error)
func (*EncryptionKey) UnmarshalText ¶
func (k *EncryptionKey) UnmarshalText(data []byte) error
func (EncryptionKey) Valid ¶
func (k EncryptionKey) Valid() error
type GPU ¶
type GPU string
GPU ID Used by a VM, a GPU id is in the format <slot>/<vendor>/<device> This can be queried either from the node features on the chain or listed via the node rmb API. example of a valid gpu definition `0000:28:00.0/1002/731f“
type GatewayBase ¶
type GatewayBase struct { // Passthrough whether to pass tls traffic or not TLSPassthrough bool `json:"tls_passthrough"` // Backends are list of backend ips (only one is supported atm) Backends []Backend `json:"backends"` // Network name to join [optional]. // If set the backend IP can be a private ip in that network. // the network then must be // the same rules for tls-passthrough applies. Network *gridtypes.Name `json:"network,omitempty"` }
GatewayBase definition. this will proxy name.<zos.domain> to backends
func (GatewayBase) Valid ¶
func (g GatewayBase) Valid(getter gridtypes.WorkloadGetter) error
type GatewayFQDNProxy ¶
type GatewayFQDNProxy struct { GatewayBase // FQDN the fully qualified domain name to use (cannot be present with Name) FQDN string `json:"fqdn"` }
GatewayFQDNProxy definition. this will proxy name.<zos.domain> to backends
func (GatewayFQDNProxy) Valid ¶
func (g GatewayFQDNProxy) Valid(getter gridtypes.WorkloadGetter) error
type GatewayNameProxy ¶
type GatewayNameProxy struct { GatewayBase // Name the fully qualified domain name to use (cannot be present with Name) Name string `json:"name"` }
GatewayNameProxy definition. this will proxy name.<zos.domain> to backends
func (GatewayNameProxy) Valid ¶
func (g GatewayNameProxy) Valid(getter gridtypes.WorkloadGetter) error
type GatewayProxyResult ¶
type GatewayProxyResult struct {
FQDN string `json:"fqdn"`
}
GatewayProxyResult results
type MachineCapacity ¶
MachineCapacity structure
func (*MachineCapacity) Challenge ¶
func (c *MachineCapacity) Challenge(w io.Writer) error
Challenge builder
func (*MachineCapacity) String ¶
func (c *MachineCapacity) String() string
type MachineInterface ¶
type MachineInterface struct { // Network name (znet name) to join Network gridtypes.Name `json:"network"` // IP of the zmachine on this network must be a valid Ip in the // selected network IP net.IP `json:"ip"` }
MachineInterface structure
type MachineMount ¶
type MachineMount struct { // Name is name of a zmount. The name must be a valid zmount // in the same deployment as the zmachine Name gridtypes.Name `json:"name"` // Mountpoint inside the container. Not used if the zmachine // is running in a vm mode. Mountpoint string `json:"mountpoint"` }
MachineMount structure
type MachineNetwork ¶
type MachineNetwork struct { // PublicIP optional public IP attached to this machine. If set // it must be a valid name of a PublicIP workload in the same deployment PublicIP gridtypes.Name `json:"public_ip"` // Planetary support planetary network Planetary bool `json:"planetary"` // Mycelium IP config, if planetary is true, but Mycelium is not set we fall back // to yggdrasil support. Otherwise (if mycelium is set) a mycelium ip is used instead. Mycelium *MyceliumIP `json:"mycelium,omitempty"` // Interfaces list of user znets to join Interfaces []MachineInterface `json:"interfaces"` }
MachineNetwork structure
type MachineNetworkLight ¶
type MachineNetworkLight struct { // Mycelium IP config, if planetary is true, but Mycelium is not set we fall back // to yggdrasil support. Otherwise (if mycelium is set) a mycelium ip is used instead. Mycelium *MyceliumIP `json:"mycelium,omitempty"` // Interfaces list of user znets to join Interfaces []MachineInterface `json:"interfaces"` }
MachineNetworkLight structure
type Mycelium ¶
type Mycelium struct { // Key is the key of the mycelium peer in the mycelium node // associated with this network. // It's provided by the user so it can be later moved to other nodes // without losing the key. Key Bytes `json:"hex_key"` // An optional mycelium peer list to be used with this node, otherwise // the default peer list is used. Peers []MyceliumPeer `json:"peers"` }
type MyceliumIP ¶
type MyceliumIP struct { // Network name (znet name) to join Network gridtypes.Name // Seed is a six bytes random number that is used // as a seed to derive a vm mycelium IP. // // This means that a VM "ip" can be moved to another VM if needed // by simply using the same seed. // This of course will only work if the network mycelium setup is using // the same HexKey Seed Bytes `json:"hex_seed"` }
type MyceliumPeer ¶
type MyceliumPeer string
type NetID ¶
type NetID string
NetID is a type defining the ID of a network
func NetworkIDFromWorkloadID ¶
func NetworkIDFromWorkloadID(wl gridtypes.WorkloadID) (NetID, error)
type Network ¶
type Network struct { // IP range of the network, must be an IPv4 /16 // for example a 10.1.0.0/16 NetworkIPRange gridtypes.IPNet `json:"ip_range"` // IPV4 subnet for this network resource // this must be a valid subnet of the entire network ip range. // for example 10.1.1.0/24 Subnet gridtypes.IPNet `json:"subnet"` // The private wg key of this node (this peer) which is installing this // network workload right now. // This has to be filled in by the user (and not generated for example) // because other peers need to be installed as well (with this peer public key) // hence it's easier to configure everything one time at the user side and then // apply everything on all nodes at once WGPrivateKey string `json:"wireguard_private_key"` // WGListenPort is the wireguard listen port on this node. this has // to be filled in by the user for same reason as private key (other nodes need to know about it) // To find a free port you have to ask the node first by a call over RMB about which ports are possible // to use. WGListenPort uint16 `json:"wireguard_listen_port"` // Peers is a list of other peers in this network Peers []Peer `json:"peers"` // Optional mycelium configuration. If provided // VMs in this network can use the mycelium feature. // if no mycelium configuration is provided, vms can't // get mycelium IPs. Mycelium *Mycelium `json:"mycelium,omitempty"` }
Network is the description of a part of a network local to a specific node. A network workload defines a wireguard network that is usually spans multiple nodes. One of the nodes must work as an access node in other words, it must be reachable from other nodes, hence it needs to have a `PublicConfig`. Since the user library creates all deployments upfront then all wireguard keys, and ports must be pre-determinstic and must be also created upfront. A network structure basically must consist of - The network information (IP range) must be an ipv4 /16 range - The local (node) peer definition (subnet of the network ip range, wireguard secure key, wireguard port if any) - List of other peers that are part of the same network with their own config - For each PC or a laptop (for each wireguard peer) there must be a peer in the peer list (on all nodes) This is why this can get complicated.
type NetworkLight ¶
type NetworkLight struct { // IPV4 subnet for this network resource // this must be a valid subnet of the entire network ip range. // for example 10.1.1.0/24 Subnet gridtypes.IPNet `json:"subnet"` // Optional mycelium configuration. If provided // VMs in this network can use the mycelium feature. // if no mycelium configuration is provided, vms can't // get mycelium IPs. Mycelium Mycelium `json:"mycelium,omitempty"` }
NetworkLight is the description of a part of a network local to a specific node. A network workload defines a wireguard network that is usually spans multiple nodes. One of the nodes must work as an access node in other words, it must be reachable from other nodes, hence it needs to have a `PublicConfig`. Since the user library creates all deployments upfront then all wireguard keys, and ports must be pre-deterministic and must be also created upfront. A network structure basically must consist of - The network information (IP range) must be an ipv4 /16 range - The local (node) peer definition (subnet of the network ip range, wireguard secure key, wireguard port if any) - List of other peers that are part of the same network with their own config - For each PC or a laptop (for each wireguard peer) there must be a peer in the peer list (on all nodes) This is why this can get complicated.
func (NetworkLight) Capacity ¶
func (n NetworkLight) Capacity() (gridtypes.Capacity, error)
Capacity implementation
func (NetworkLight) Challenge ¶
func (n NetworkLight) Challenge(b io.Writer) error
Challenge implements WorkloadData
func (NetworkLight) Valid ¶
func (n NetworkLight) Valid(getter gridtypes.WorkloadGetter) error
Valid checks if the network resource is valid.
type Peer ¶
type Peer struct { // IPV4 subnet of the network resource of the peer Subnet gridtypes.IPNet `json:"subnet"` // WGPublicKey of the peer (driven from its private key) WGPublicKey string `json:"wireguard_public_key"` // Allowed Ips is related to his subnet. // todo: remove and derive from subnet AllowedIPs []gridtypes.IPNet `json:"allowed_ips"` // Entrypoint of the peer Endpoint string `json:"endpoint"` }
Peer is the description of a peer of a NetResource
type PublicIP ¶
type PublicIP struct { // V4 use one of the reserved Ipv4 from your contract. The Ipv4 // itself costs money + the network traffic V4 bool `json:"v4"` // V6 get an ipv6 for the VM. this is for free // but the consumed capacity (network traffic) is not V6 bool `json:"v6"` }
type PublicIP4 ¶
type PublicIP4 struct{}
PublicIP4 structure this is a deprecated type and only kept here for backward compatibility with older deployments. Please use PublicIP instead
type PublicIPResult ¶
type PublicIPResult struct { // IP of the VM. The IP must be part of the subnet available in the network // resource defined by the networkID on this node IP gridtypes.IPNet `json:"ip"` // IPv6 of the VM. IPv6 gridtypes.IPNet `json:"ip6"` // Gateway: this fields is only here because we have no idea what is the // gateway of that ip without consulting the farmer. Currently this // component does not exist. hence as a temporaray solution the user must // also provide Gateway net.IP `json:"gateway"` }
PublicIPResult result returned by publicIP reservation
func (*PublicIPResult) HasIPv4 ¶
func (p *PublicIPResult) HasIPv4() bool
func (*PublicIPResult) HasIPv6 ¶
func (p *PublicIPResult) HasIPv6() bool
type QuantumCompression ¶
type QuantumCompression struct {
Algorithm string `json:"algorithm" toml:"algorithm"`
}
type QuantumSafeConfig ¶
type QuantumSafeConfig struct { Prefix string `json:"prefix" toml:"prefix"` Encryption Encryption `json:"encryption" toml:"encryption"` Backends []ZdbBackend `json:"backends" toml:"backends"` }
type QuantumSafeFS ¶
type QuantumSafeFS struct { Cache gridtypes.Unit `json:"cache"` Config QuantumSafeFSConfig `json:"config"` }
func (QuantumSafeFS) Valid ¶
func (q QuantumSafeFS) Valid(getter gridtypes.WorkloadGetter) error
type QuantumSafeFSConfig ¶
type QuantumSafeFSConfig struct { MinimalShards uint32 `json:"minimal_shards" toml:"minimal_shards"` ExpectedShards uint32 `json:"expected_shards" toml:"expected_shards"` RedundantGroups uint32 `json:"redundant_groups" toml:"redundant_groups"` RedundantNodes uint32 `json:"redundant_nodes" toml:"redundant_nodes"` MaxZDBDataDirSize uint32 `json:"max_zdb_data_dir_size" toml:"max_zdb_data_dir_size"` Encryption Encryption `json:"encryption" toml:"encryption"` Meta QuantumSafeMeta `json:"meta" toml:"meta"` Groups []ZdbGroup `json:"groups" toml:"groups"` Compression QuantumCompression `json:"compression" toml:"compression"` }
type QuantumSafeMeta ¶
type QuantumSafeMeta struct { Type string `json:"type" toml:"type"` Config QuantumSafeConfig `json:"config" toml:"config"` }
TODO: fix challenge (and validation?)
type QuatumSafeFSResult ¶
type VolumeResult ¶
type VolumeResult struct {
ID string `json:"id"`
}
type ZDB ¶
type ZDB struct { Size gridtypes.Unit `json:"size"` Mode ZDBMode `json:"mode"` Password string `json:"password"` Public bool `json:"public"` }
ZDB namespace creation info
type ZLogs ¶
type ZMachine ¶
type ZMachine struct { // Flist of the zmachine, must be a valid url to an flist. FList string `json:"flist"` // Network configuration for machine network Network MachineNetwork `json:"network"` // Size of zmachine disk Size gridtypes.Unit `json:"size"` // ComputeCapacity configuration for machine cpu+memory ComputeCapacity MachineCapacity `json:"compute_capacity"` // Mounts configure mounts/disks attachments to this machine Mounts []MachineMount `json:"mounts"` // Entrypoint entrypoint of the container, if not set the configured one from the flist // is going to be used Entrypoint string `json:"entrypoint"` // Env variables available for a container Env map[string]string `json:"env"` // Corex works in container mode which forces replace the // entrypoing of the container to use `corex` Corex bool `json:"corex"` // GPU attached to the VM // the list of the GPUs ids must: // - Exist, obviously // - Not used by other VMs // - Only possible on `dedicated` nodes GPU []GPU `json:"gpu,omitempty"` }
ZMachine reservation data
func (*ZMachine) MinRootSize ¶
type ZMachineLight ¶
type ZMachineLight struct { // Flist of the zmachine, must be a valid url to an flist. FList string `json:"flist"` // Network configuration for machine network Network MachineNetworkLight `json:"network"` // Size of zmachine disk Size gridtypes.Unit `json:"size"` // ComputeCapacity configuration for machine cpu+memory ComputeCapacity MachineCapacity `json:"compute_capacity"` // Mounts configure mounts/disks attachments to this machine Mounts []MachineMount `json:"mounts"` // Entrypoint entrypoint of the container, if not set the configured one from the flist // is going to be used Entrypoint string `json:"entrypoint"` // Env variables available for a container Env map[string]string `json:"env"` // Corex works in container mode which forces replace the // entrypoing of the container to use `corex` Corex bool `json:"corex"` // GPU attached to the VM // the list of the GPUs ids must: // - Exist, obviously // - Not used by other VMs // - Only possible on `dedicated` nodes GPU []GPU `json:"gpu,omitempty"` }
ZMachineLight reservation data
func (ZMachineLight) Capacity ¶
func (v ZMachineLight) Capacity() (gridtypes.Capacity, error)
Capacity implementation
func (ZMachineLight) Challenge ¶
func (v ZMachineLight) Challenge(b io.Writer) error
Challenge creates signature challenge
func (*ZMachineLight) MinRootSize ¶
func (m *ZMachineLight) MinRootSize() gridtypes.Unit
func (*ZMachineLight) RootSize ¶
func (m *ZMachineLight) RootSize() gridtypes.Unit
func (ZMachineLight) Valid ¶
func (v ZMachineLight) Valid(getter gridtypes.WorkloadGetter) error
Valid implementation
type ZMachineLightResult ¶
type ZMachineLightResult struct { ID string `json:"id"` IP string `json:"ip"` MyceliumIP string `json:"mycelium_ip"` ConsoleURL string `json:"console_url"` }
ZMachineLightResult result returned by VM reservation
type ZMachineResult ¶
type ZMachineResult struct { ID string `json:"id"` IP string `json:"ip"` PlanetaryIP string `json:"planetary_ip"` MyceliumIP string `json:"mycelium_ip"` ConsoleURL string `json:"console_url"` }
ZMachineResult result returned by VM reservation
func (*ZMachineResult) UnmarshalJSON ¶
func (r *ZMachineResult) UnmarshalJSON(data []byte) error
type ZMount ¶
ZMount defines a mount point
type ZMountResult ¶
type ZMountResult struct {
ID string `json:"volume_id"`
}
ZMountResult is the information return to the BCDB after deploying a volume