zos

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ZMountType type
	ZMountType gridtypes.WorkloadType = "zmount"
	// NetworkType type
	NetworkType gridtypes.WorkloadType = "network"
	// ZDBType type
	ZDBType gridtypes.WorkloadType = "zdb"
	// ZMachineType type
	ZMachineType gridtypes.WorkloadType = "zmachine"
	//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"
)
View Source
const (
	ZDBModeUser = "user"
	ZDBModeSeq  = "seq"
)

Enumeration of the modes 0-db can operate in

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend string

func (Backend) Valid

func (b Backend) Valid() error

check if valid http://x.x.x.x:port or [::]:port

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

func (DeviceType) Valid

func (d DeviceType) Valid() error

Valid validates device type

type Encryption

type Encryption struct {
	Algorithm EncryptionAlgorithm `json:"algorithm" toml:"algorithm"`
	Key       EncryptionKey       `json:"key" toml:"key"`
}

func (*Encryption) Challenge

func (c *Encryption) Challenge(w io.Writer) error

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 GatewayFQDNProxy

type GatewayFQDNProxy struct {
	// FQDN the fully qualified domain name to use (cannot be present with Name)
	FQDN string `json:"fqdn"`

	// Passthroug whether to pass tls traffic or not
	TLSPassthrough bool `json:"tls_passthrough"`

	// Backends are list of backend ips
	Backends []Backend `json:"backends"`
}

GatewayFQDNProxy definition. this will proxy name.<zos.domain> to backends

func (GatewayFQDNProxy) Capacity

func (g GatewayFQDNProxy) Capacity() (gridtypes.Capacity, error)

func (GatewayFQDNProxy) Challenge

func (g GatewayFQDNProxy) Challenge(w io.Writer) error

func (GatewayFQDNProxy) Valid

type GatewayFQDNResult

type GatewayFQDNResult struct {
}

GatewayProxyResult results

type GatewayNameProxy

type GatewayNameProxy struct {
	// Name the fully qualified domain name to use (cannot be present with Name)
	Name string `json:"name"`

	// Passthroug whether to pass tls traffic or not
	TLSPassthrough bool `json:"tls_passthrough"`

	// Backends are list of backend ips
	Backends []Backend `json:"backends"`
}

GatewayNameProxy definition. this will proxy name.<zos.domain> to backends

func (GatewayNameProxy) Capacity

func (g GatewayNameProxy) Capacity() (gridtypes.Capacity, error)

func (GatewayNameProxy) Challenge

func (g GatewayNameProxy) Challenge(w io.Writer) error

func (GatewayNameProxy) Valid

type GatewayProxyResult

type GatewayProxyResult struct {
	FQDN string `json:"fqdn"`
}

GatewayProxyResult results

type MachineCapacity

type MachineCapacity struct {
	CPU    uint8          `json:"cpu"`
	Memory gridtypes.Unit `json:"memory"`
}

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

func (*MachineMount) Challenge

func (m *MachineMount) Challenge(w io.Writer) error

Challenge builder

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"`
	// Interfaces list of user znets to join
	Interfaces []MachineInterface `json:"interfaces"`
}

MachineNetwork structure

func (*MachineNetwork) Challenge

func (n *MachineNetwork) Challenge(w io.Writer) error

Challenge builder

type NetID

type NetID string

NetID is a type defining the ID of a network

func NetworkID

func NetworkID(twin uint32, network gridtypes.Name) NetID

NetworkID construct a network ID based on a userID and network name

func (NetID) String

func (i NetID) String() string

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"`
}

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.

func (Network) Capacity

func (n Network) Capacity() (gridtypes.Capacity, error)

Capacity implementation

func (Network) Challenge

func (n Network) Challenge(b io.Writer) error

Challenge implements WorkloadData

func (Network) Valid

func (n Network) 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

func (Peer) Challenge

func (p Peer) Challenge(w io.Writer) error

Challenge for peer

func (*Peer) Valid

func (p *Peer) Valid() error

Valid checks if peer is valid

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"`
}

func (PublicIP) Capacity

func (p PublicIP) Capacity() (gridtypes.Capacity, error)

Capacity implementation

func (PublicIP) Challenge

func (p PublicIP) Challenge(w io.Writer) error

Challenge implementation

func (PublicIP) Valid

func (p PublicIP) Valid(getter gridtypes.WorkloadGetter) error

Valid validate public ip input

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

func (PublicIP4) Capacity

func (p PublicIP4) Capacity() (gridtypes.Capacity, error)

Capacity implementation

func (PublicIP4) Challenge

func (p PublicIP4) Challenge(b io.Writer) error

Challenge implementation

func (PublicIP4) Valid

func (p PublicIP4) Valid(getter gridtypes.WorkloadGetter) error

Valid validate public ip input

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

type QuantumCompression

type QuantumCompression struct {
	Algorithm string `json:"algorithm" toml:"algorithm"`
}

func (*QuantumCompression) Challenge

func (c *QuantumCompression) Challenge(w io.Writer) error

type QuantumSafeConfig

type QuantumSafeConfig struct {
	Prefix     string       `json:"prefix" toml:"prefix"`
	Encryption Encryption   `json:"encryption" toml:"encryption"`
	Backends   []ZdbBackend `json:"backends" toml:"backends"`
}

func (*QuantumSafeConfig) Challenge

func (m *QuantumSafeConfig) Challenge(w io.Writer) error

type QuantumSafeFS

type QuantumSafeFS struct {
	Cache  gridtypes.Unit      `json:"cache"`
	Config QuantumSafeFSConfig `json:"config"`
}

func (QuantumSafeFS) Capacity

func (q QuantumSafeFS) Capacity() (gridtypes.Capacity, error)

func (QuantumSafeFS) Challenge

func (q QuantumSafeFS) Challenge(w io.Writer) error

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"`
}

func (*QuantumSafeFSConfig) Challenge

func (c *QuantumSafeFSConfig) Challenge(w io.Writer) error

type QuantumSafeMeta

type QuantumSafeMeta struct {
	Type   string            `json:"type" toml:"type"`
	Config QuantumSafeConfig `json:"config" toml:"config"`
}

TODO: fix challenge (and validation?)

func (*QuantumSafeMeta) Challenge

func (m *QuantumSafeMeta) Challenge(w io.Writer) error

type QuatumSafeFSResult

type QuatumSafeFSResult struct {
	Path            string `json:"path"`
	MetricsEndpoint string `json:"metrics_endpoint"`
}

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

func (ZDB) Capacity

func (z ZDB) Capacity() (cap gridtypes.Capacity, err error)

Capacity implements WorkloadData

func (ZDB) Challenge

func (z ZDB) Challenge(b io.Writer) error

Challenge implementation

func (ZDB) Valid

func (z ZDB) Valid(getter gridtypes.WorkloadGetter) error

Valid implementation

type ZDBMode

type ZDBMode string

ZDBMode is the enumeration of the modes 0-db can operate in

func (ZDBMode) String

func (m ZDBMode) String() string

func (ZDBMode) Valid

func (m ZDBMode) Valid() error

Valid validates the mode

type ZDBResult

type ZDBResult struct {
	Namespace string
	IPs       []string
	Port      uint
}

ZDBResult is the information return to the BCDB after deploying a 0-db namespace

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 bool              `json:"corex"`
}

ZMachine reservation data

func (ZMachine) Capacity

func (v ZMachine) Capacity() (gridtypes.Capacity, error)

Capacity implementation

func (ZMachine) Challenge

func (v ZMachine) Challenge(b io.Writer) error

Challenge creates signature challenge

func (*ZMachine) MinRootSize

func (m *ZMachine) MinRootSize() gridtypes.Unit

func (*ZMachine) RootSize

func (m *ZMachine) RootSize() gridtypes.Unit

func (ZMachine) Valid

func (v ZMachine) Valid(getter gridtypes.WorkloadGetter) error

Valid implementation

type ZMachineResult

type ZMachineResult struct {
	ID    string `json:"id"`
	IP    string `json:"ip"`
	YggIP string `json:"ygg_ip"`
}

ZMachineResult result returned by VM reservation

type ZMount

type ZMount struct {
	// Size of the volume
	Size gridtypes.Unit `json:"size"`
}

ZMount defines a mount point

func (ZMount) Capacity

func (v ZMount) Capacity() (gridtypes.Capacity, error)

Capacity implements WorkloadData

func (ZMount) Challenge

func (v ZMount) Challenge(w io.Writer) error

Challenge implements WorkloadData

func (ZMount) Valid

func (v ZMount) Valid(getter gridtypes.WorkloadGetter) error

Valid implements WorkloadData

type ZMountResult

type ZMountResult struct {
	ID string `json:"volume_id"`
}

ZMountResult is the information return to the BCDB after deploying a volume

type ZdbBackend

type ZdbBackend struct {
	Address   string `json:"address" toml:"address"`
	Namespace string `json:"namespace" toml:"namespace"`
	Password  string `json:"password" toml:"password"`
}

func (*ZdbBackend) Challenge

func (z *ZdbBackend) Challenge(w io.Writer) error

type ZdbGroup

type ZdbGroup struct {
	Backends []ZdbBackend `json:"backends" toml:"backends"`
}

func (*ZdbGroup) Challenge

func (z *ZdbGroup) Challenge(w io.Writer) error

Jump to

Keyboard shortcuts

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