Documentation
¶
Overview ¶
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads is the terraform provider ¶
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Package workloads includes workloads types (vm, zdb, QSFS, public IP, gateway name, gateway fqdn, disk)
Index ¶
- Constants
- Variables
- func ConstructK8sPublicIPWorkload(workloadName string, ipv4 bool, ipv6 bool) gridtypes.Workload
- func ConstructPublicIPWorkload(workloadName string, ipv4 bool, ipv6 bool) zos.Workload
- func Contains[T comparable](elements []T, element T) bool
- func Delete[T comparable](elements []T, element T) []T
- func FlistChecksumURL(url string) string
- func GenerateWGConfig(Address string, AccessPrivatekey string, NodePublicKey string, ...) string
- func GetFlistChecksum(url string) (string, error)
- func GetUsedIPs(dl zos.Deployment, nodeID uint32) ([]byte, error)
- func IPNet(a, b, c, d, msk byte) zos.IPNet
- func NewGridDeployment(twin uint32, contractID uint64, workloads []zos.Workload) zos.Deployment
- func NewIPRange(n net.IPNet) zos.IPNet
- func NewWorkloadFromMap(wlMap map[string]interface{}, result interface{}) (interface{}, error)
- func NewZosBackends(bks []string) (backends []zos.Backend)
- func RandomMyceliumIPSeed() ([]byte, error)
- func RandomMyceliumKey() ([]byte, error)
- func ToMap(workload interface{}) (map[string]interface{}, error)
- func ValidateFlist(flistUrl, flistChecksum string) error
- func WgIP(ip zos.IPNet) zos.IPNet
- type Backend
- type Backends
- type Deployment
- type DeploymentData
- type Disk
- type GatewayFQDNProxy
- type GatewayNameProxy
- type Group
- type Groups
- type K8sCluster
- func (k *K8sCluster) GenerateMetadata() (string, error)
- func (k *K8sCluster) InvalidateBrokenAttributes(sub subi.SubstrateExt) error
- func (k *K8sCluster) Validate() error
- func (k *K8sCluster) ValidateIPranges() error
- func (k *K8sCluster) ValidateToken() error
- func (k *K8sCluster) ZosWorkloads() ([]gridtypes.Workload, error)
- type K8sNode
- type Metadata
- type Mount
- type Network
- type NetworkMetaData
- type QSFS
- type UserAccess
- type VM
- type VMLight
- func (vm *VMLight) AssignPrivateIP(networkName, ipRange string, nodeID uint32, ipRangeCIDR *net.IPNet, ip net.IP, ...) (string, error)
- func (vm *VMLight) LoadFromVM(vm2 *VMLight)
- func (vm *VMLight) MinRootSize() uint64
- func (vm *VMLight) Validate() error
- func (vm *VMLight) ZosWorkload() []zos.Workload
- type Version
- type Volume
- type ZDB
- type ZNet
- func (znet *ZNet) AssignNodesIPs(nodes []uint32) error
- func (znet *ZNet) AssignNodesWGKey(nodes []uint32) error
- func (znet *ZNet) AssignNodesWGPort(ctx context.Context, sub subi.SubstrateExt, ncPool client.NodeClientGetter, ...) error
- func (znet *ZNet) GenerateMetadata() (string, error)
- func (znet *ZNet) GenerateVersionlessDeployments(ctx context.Context, ncPool client.NodeClientGetter, subConn subi.SubstrateExt, ...) (map[uint32]zos.Deployment, error)
- func (znet *ZNet) GetAccessWGConfig() string
- func (znet *ZNet) GetAddWGAccess() bool
- func (znet *ZNet) GetDescription() string
- func (znet *ZNet) GetExternalIP() *zos.IPNet
- func (znet *ZNet) GetExternalSK() wgtypes.Key
- func (znet *ZNet) GetIPRange() zos.IPNet
- func (znet *ZNet) GetMyceliumKeys() map[uint32][]byte
- func (znet *ZNet) GetName() string
- func (znet *ZNet) GetNodeDeploymentID() map[uint32]uint64
- func (znet *ZNet) GetNodes() []uint32
- func (znet *ZNet) GetNodesIPRange() map[uint32]zos.IPNet
- func (znet *ZNet) GetPublicNodeID() uint32
- func (znet *ZNet) GetSolutionType() string
- func (znet *ZNet) GetVersion() Version
- func (znet *ZNet) InvalidateBrokenAttributes(subConn subi.SubstrateExt, ncPool client.NodeClientGetter) error
- func (znet *ZNet) ReadNodesConfig(ctx context.Context, nodeDeployments map[uint32]zos.Deployment) error
- func (znet *ZNet) SetAccessWGConfig(accessWGConfig string)
- func (znet *ZNet) SetExternalIP(ip *zos.IPNet)
- func (znet *ZNet) SetExternalSK(key wgtypes.Key)
- func (znet *ZNet) SetKeys(keys map[uint32]wgtypes.Key)
- func (znet *ZNet) SetMyceliumKeys(keys map[uint32][]byte)
- func (znet *ZNet) SetNodeDeploymentID(nodeDeploymentsIDs map[uint32]uint64)
- func (znet *ZNet) SetNodes(nodes []uint32)
- func (znet *ZNet) SetNodesIPRange(nodesIPRange map[uint32]zos.IPNet)
- func (znet *ZNet) SetPublicNodeID(node uint32)
- func (znet *ZNet) SetWGPort(wgPort map[uint32]int)
- func (znet *ZNet) Validate() error
- func (znet *ZNet) ZosWorkload(subnet zos.IPNet, wgPrivateKey string, wgListenPort uint16, peers []zos.Peer, ...) zos.Workload
- type ZNetLight
- func (znet *ZNetLight) AssignNodesIPs(nodes []uint32) error
- func (znet *ZNetLight) GenerateMetadata() (string, error)
- func (znet *ZNetLight) GenerateVersionlessDeployments(ctx context.Context, ncPool client.NodeClientGetter, subConn subi.SubstrateExt, ...) (map[uint32]zos.Deployment, error)
- func (znet *ZNetLight) GetAccessWGConfig() string
- func (znet *ZNetLight) GetAddWGAccess() bool
- func (znet *ZNetLight) GetDescription() string
- func (znet *ZNetLight) GetExternalIP() *zos.IPNet
- func (znet *ZNetLight) GetExternalSK() wgtypes.Key
- func (znet *ZNetLight) GetIPRange() zos.IPNet
- func (znet *ZNetLight) GetMyceliumKeys() map[uint32][]byte
- func (znet *ZNetLight) GetName() string
- func (znet *ZNetLight) GetNodeDeploymentID() map[uint32]uint64
- func (znet *ZNetLight) GetNodes() []uint32
- func (znet *ZNetLight) GetNodesIPRange() map[uint32]zos.IPNet
- func (znet *ZNetLight) GetPublicNodeID() uint32
- func (znet *ZNetLight) GetSolutionType() string
- func (znet *ZNetLight) GetVersion() Version
- func (znet *ZNetLight) InvalidateBrokenAttributes(subConn subi.SubstrateExt, ncPool client.NodeClientGetter) error
- func (znet *ZNetLight) ReadNodesConfig(ctx context.Context, nodeDeployments map[uint32]zos.Deployment) error
- func (znet *ZNetLight) SetAccessWGConfig(accessWGConfig string)
- func (znet *ZNetLight) SetExternalIP(ip *zos.IPNet)
- func (znet *ZNetLight) SetExternalSK(key wgtypes.Key)
- func (znet *ZNetLight) SetKeys(keys map[uint32]wgtypes.Key)
- func (znet *ZNetLight) SetMyceliumKeys(keys map[uint32][]byte)
- func (znet *ZNetLight) SetNodeDeploymentID(nodeDeploymentsIDs map[uint32]uint64)
- func (znet *ZNetLight) SetNodes(nodes []uint32)
- func (znet *ZNetLight) SetNodesIPRange(nodesIPRange map[uint32]zos.IPNet)
- func (znet *ZNetLight) SetPublicNodeID(node uint32)
- func (znet *ZNetLight) SetWGPort(wgPort map[uint32]int)
- func (znet *ZNetLight) Validate() error
- func (znet *ZNetLight) ZosWorkload(subnet zos.IPNet, _ string, _ uint16, _ []zos.Peer, metadata string, ...) zos.Workload
- type Zlog
Constants ¶
const ( ZDBModeUser = "user" ZDBModeSeq = "seq" )
Variables ¶
var ( // VMType for deployment date of vms VMType = "vm" // GatewayNameType for deployment date of name gateway GatewayNameType = "Gateway Name" // GatewayFQDNType for deployment date of fqdn gateway GatewayFQDNType = "Gateway Fqdn" // K8sType for deployment date of k8s K8sType = "kubernetes" // NetworkType for deployment date of network NetworkType = "network" )
var ExternalSKZeroValue = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
ExternalSKZeroValue as its not empty when it is zero
var K8sFlist = "https://hub.grid.tf/tf-official-apps/threefolddev-k3s-v1.31.0.flist"
old: https://hub.grid.tf/tf-official-apps/threefoldtech-k3s-latest.flist
Functions ¶
func ConstructK8sPublicIPWorkload ¶ added in v0.16.0
ConstructPublicIPWorkload constructs a public IP workload
func ConstructPublicIPWorkload ¶
ConstructPublicIPWorkload constructs a public IP workload
func Contains ¶
func Contains[T comparable](elements []T, element T) bool
Contains check if a slice contains an element
func Delete ¶
func Delete[T comparable](elements []T, element T) []T
Delete removes an element from a slice
func FlistChecksumURL ¶
FlistChecksumURL returns flist check sum url format
func GenerateWGConfig ¶
func GenerateWGConfig(Address string, AccessPrivatekey string, NodePublicKey string, NodeEndpoint string, NetworkIPRange string) string
GenerateWGConfig generates wireguard configs
func GetFlistChecksum ¶
GetFlistChecksum gets flist check sum url
func GetUsedIPs ¶
func GetUsedIPs(dl zos.Deployment, nodeID uint32) ([]byte, error)
GetUsedIPs returns used IPs for a deployment
func NewGridDeployment ¶
NewGridDeployment generates a new grid deployment
func NewIPRange ¶
NewIPRange generates a new IPRange from the given network IP
func NewWorkloadFromMap ¶
NewWorkloadFromMap converts a map (dict) to a workload
func NewZosBackends ¶
NewZosBackends generates new zos backends for the given string backends
func RandomMyceliumIPSeed ¶ added in v0.13.22
func RandomMyceliumKey ¶ added in v0.13.22
func ValidateFlist ¶ added in v0.15.12
Types ¶
type Backends ¶
type Backends []Backend
Backends is a list of backends
func BackendsFromZos ¶
func BackendsFromZos(bs []zos.ZdbBackend) (backends Backends)
BackendsFromZos gets backends from zos
type Deployment ¶
type Deployment struct { Name string NodeID uint32 SolutionType string SolutionProvider *uint64 // TODO: remove NetworkName string Disks []Disk Zdbs []ZDB Vms []VM VmsLight []VMLight QSFS []QSFS Volumes []Volume // computed NodeDeploymentID map[uint32]uint64 ContractID uint64 IPrange string }
Deployment struct
func NewDeployment ¶
func NewDeployment(name string, nodeID uint32, solutionType string, solutionProvider *uint64, NetworkName string, disks []Disk, zdbs []ZDB, vms []VM, vmsLight []VMLight, QSFS []QSFS, volumes []Volume, ) Deployment
NewDeployment generates a new deployment
func NewDeploymentFromZosDeployment ¶
func NewDeploymentFromZosDeployment(d zos.Deployment, nodeID uint32) (Deployment, error)
NewDeploymentFromZosDeployment generates deployment from zos deployment
func (*Deployment) GenerateMetadata ¶
func (d *Deployment) GenerateMetadata() (string, error)
GenerateMetadata generates deployment metadata
func (*Deployment) Match ¶
func (d *Deployment) Match(disks []Disk, QSFS []QSFS, zdbs []ZDB, vms []VM, vmsLight []VMLight, volumes []Volume)
Match objects to match the input
func (*Deployment) ZosDeployment ¶
func (d *Deployment) ZosDeployment(twin uint32) (zos.Deployment, error)
ZosDeployment generates a new zos deployment from a deployment
type DeploymentData ¶
type DeploymentData struct { Version int `json:"version"` Type string `json:"type"` Name string `json:"name"` ProjectName string `json:"projectName"` }
DeploymentData for deployments meta data
func ParseDeploymentData ¶
func ParseDeploymentData(deploymentMetaData string) (DeploymentData, error)
ParseDeploymentData parses the deployment metadata
type Disk ¶
type Disk struct { Name string `json:"name"` SizeGB uint64 `json:"size"` Description string `json:"description"` }
Disk struct
func NewDiskFromWorkload ¶
NewDiskFromWorkload generates a new disk from a workload
func (*Disk) ZosWorkload ¶
ZosWorkload generates a workload from a disk
type GatewayFQDNProxy ¶
type GatewayFQDNProxy struct { // required NodeID uint32 // Backends are list of backend ips Backends []zos.Backend // FQDN deployed on the node FQDN string // Name is the workload name Name string // optional // Passthrough whether to pass tls traffic or not TLSPassthrough bool // Network name to join Network string Description string SolutionType string // computed ContractID uint64 NodeDeploymentID map[uint32]uint64 }
GatewayFQDNProxy for gateway FQDN proxy
func NewGatewayFQDNProxyFromZosWorkload ¶
func NewGatewayFQDNProxyFromZosWorkload(wl gridtypes.Workload) (GatewayFQDNProxy, error)
NewGatewayFQDNProxyFromZosWorkload generates a gateway FQDN proxy from a zos workload
func (*GatewayFQDNProxy) GenerateMetadata ¶
func (g *GatewayFQDNProxy) GenerateMetadata() (string, error)
GenerateMetadata generates gateway deployment metadata
func (*GatewayFQDNProxy) Validate ¶ added in v0.15.12
func (g *GatewayFQDNProxy) Validate() error
Validate validates gateway data
func (*GatewayFQDNProxy) ZosWorkload ¶
func (g *GatewayFQDNProxy) ZosWorkload() gridtypes.Workload
ZosWorkload generates a zos workload from GatewayFQDNProxy
type GatewayNameProxy ¶
type GatewayNameProxy struct { // Required NodeID uint32 // Name the fully qualified domain name to use (cannot be present with Name) Name string // Backends are list of backend ips Backends []zos.Backend // Optional // Passthrough whether to pass tls traffic or not TLSPassthrough bool // Network name to join Network string Description string SolutionType string // computed // FQDN deployed on the node NodeDeploymentID map[uint32]uint64 FQDN string NameContractID uint64 ContractID uint64 }
GatewayNameProxy struct for gateway name proxy
func NewGatewayNameProxyFromZosWorkload ¶
func NewGatewayNameProxyFromZosWorkload(wl gridtypes.Workload) (GatewayNameProxy, error)
NewGatewayNameProxyFromZosWorkload generates a gateway name proxy from a zos workload
func (*GatewayNameProxy) GenerateMetadata ¶
func (g *GatewayNameProxy) GenerateMetadata() (string, error)
GenerateMetadata generates gateway deployment metadata
func (*GatewayNameProxy) Validate ¶ added in v0.15.12
func (g *GatewayNameProxy) Validate() error
Validate validates gateway data
func (*GatewayNameProxy) ZosWorkload ¶
func (g *GatewayNameProxy) ZosWorkload() gridtypes.Workload
ZosWorkload generates a zos workload from GatewayNameProxy
type Groups ¶
type Groups []Group
Groups is a list of groups
func GroupsFromZos ¶
GroupsFromZos gets groups from zos
type K8sCluster ¶
type K8sCluster struct { Master *K8sNode Workers []K8sNode Token string NetworkName string Flist string `json:"flist"` FlistChecksum string `json:"flist_checksum"` Entrypoint string `json:"entry_point"` // optional SolutionType string SSHKey string // computed NodesIPRange map[uint32]gridtypes.IPNet NodeDeploymentID map[uint32]uint64 }
K8sCluster struct for k8s cluster
func (*K8sCluster) GenerateMetadata ¶
func (k *K8sCluster) GenerateMetadata() (string, error)
GenerateMetadata generates deployment metadata
func (*K8sCluster) InvalidateBrokenAttributes ¶
func (k *K8sCluster) InvalidateBrokenAttributes(sub subi.SubstrateExt) error
InvalidateBrokenAttributes removes outdated attrs and deleted contracts
func (*K8sCluster) Validate ¶ added in v0.15.12
func (k *K8sCluster) Validate() error
func (*K8sCluster) ValidateIPranges ¶
func (k *K8sCluster) ValidateIPranges() error
ValidateIPranges validates NodesIPRange of master && workers of k8s cluster
func (*K8sCluster) ValidateToken ¶
func (k *K8sCluster) ValidateToken() error
ValidateToken validate cluster token
func (*K8sCluster) ZosWorkloads ¶
func (k *K8sCluster) ZosWorkloads() ([]gridtypes.Workload, error)
ZosWorkloads generates k8s workloads from a k8s cluster
type K8sNode ¶
K8sNode kubernetes data
func NewK8sNodeFromWorkload ¶
func NewK8sNodeFromWorkload(wl gridtypes.Workload, nodeID uint32, diskSize uint64, computedIP string, computedIP6 string) (K8sNode, error)
NewK8sNodeFromWorkload generates a new k8s from a workload
func (*K8sNode) MasterZosWorkload ¶
func (k *K8sNode) MasterZosWorkload(cluster *K8sCluster) (K8sWorkloads []gridtypes.Workload)
MasterZosWorkload generates a k8s master workload from a k8s node
func (*K8sNode) WorkerZosWorkload ¶
func (k *K8sNode) WorkerZosWorkload(cluster *K8sCluster) (K8sWorkloads []gridtypes.Workload)
WorkerZosWorkload generates a k8s worker workload from a k8s node
type Metadata ¶
type Metadata struct { Type string `json:"type"` Prefix string `json:"prefix"` EncryptionAlgorithm string `json:"encryption_algorithm"` EncryptionKey string `json:"encryption_key"` Backends Backends `json:"backends"` }
Metadata for QSFS
type Mount ¶
type Mount struct { Name string `json:"name"` MountPoint string `yaml:"mount_point" json:"mount_point"` }
Mount disks/volumes struct
type Network ¶ added in v0.16.0
type Network interface { Validate() error GetVersion() Version ZosWorkload(subnet zos.IPNet, wgPrivateKey string, wgListenPort uint16, peers []zos.Peer, metadata string, myceliumKey []byte) zos.Workload GenerateMetadata() (string, error) InvalidateBrokenAttributes(subConn subi.SubstrateExt, ncPool client.NodeClientGetter) error GenerateVersionlessDeployments( ctx context.Context, ncPool client.NodeClientGetter, subConn subi.SubstrateExt, twinID, publicNode uint32, allNodes map[uint32]struct{}, endpoints map[uint32]net.IP, nodeUsedPorts map[uint32][]uint16, ) (map[uint32]zos.Deployment, error) ReadNodesConfig(ctx context.Context, nodeDeployments map[uint32]zos.Deployment) error GetNodes() []uint32 GetNodeDeploymentID() map[uint32]uint64 GetPublicNodeID() uint32 GetNodesIPRange() map[uint32]zos.IPNet GetName() string GetSolutionType() string GetDescription() string GetAddWGAccess() bool GetMyceliumKeys() map[uint32][]byte GetIPRange() zos.IPNet GetAccessWGConfig() string GetExternalIP() *zos.IPNet GetExternalSK() wgtypes.Key SetNodeDeploymentID(nodeDeploymentsIDs map[uint32]uint64) SetNodes(nodes []uint32) SetMyceliumKeys(keys map[uint32][]byte) SetKeys(keys map[uint32]wgtypes.Key) SetNodesIPRange(nodesIPRange map[uint32]zos.IPNet) SetWGPort(wgPort map[uint32]int) SetAccessWGConfig(accessWGConfig string) SetExternalIP(ip *zos.IPNet) SetExternalSK(key wgtypes.Key) SetPublicNodeID(node uint32) }
type NetworkMetaData ¶
type NetworkMetaData struct { Version int `json:"version"` UserAccesses []UserAccess `json:"user_accesses"` }
NetworkMetaData is added to network workloads to help rebuilding networks when retrieved from the grid
func (*NetworkMetaData) UnmarshalJSON ¶ added in v0.14.7
func (m *NetworkMetaData) UnmarshalJSON(data []byte) error
type QSFS ¶
type QSFS struct { Name string `json:"name"` Description string `json:"description"` Cache int `json:"cache"` MinimalShards uint32 `json:"minimal_shards"` ExpectedShards uint32 `json:"expected_shards"` RedundantGroups uint32 `json:"redundant_groups"` RedundantNodes uint32 `json:"redundant_nodes"` MaxZDBDataDirSize uint32 `json:"max_zdb_data_dir_size"` EncryptionAlgorithm string `json:"encryption_algorithm"` EncryptionKey string `json:"encryption_key"` CompressionAlgorithm string `json:"compression_algorithm"` Metadata Metadata `json:"metadata"` Groups Groups `json:"groups"` // OUTPUT MetricsEndpoint string `json:"metrics_endpoint"` }
QSFS struct
func NewQSFSFromWorkload ¶
NewQSFSFromWorkload generates a new QSFS from a workload
func (*QSFS) UpdateFromWorkload ¶
UpdateFromWorkload updates a QSFS from a workload TODO: no updates, should construct itself from the workload
type UserAccess ¶
type UserAccess struct { Subnet string `json:"subnet"` PrivateKey string `json:"private_key"` NodeID uint32 `json:"node_id"` }
UserAccess struct
type VM ¶
type VM struct { Name string `json:"name"` NodeID uint32 `json:"node"` NetworkName string `json:"network_name"` Description string `json:"description"` Flist string `json:"flist"` FlistChecksum string `json:"flist_checksum"` Entrypoint string `json:"entrypoint"` PublicIP bool `json:"publicip"` PublicIP6 bool `json:"publicip6"` Planetary bool `json:"planetary"` Corex bool `json:"corex"` // TODO: Is it works ?? IP string `json:"ip"` // used to get the same mycelium ip for the vm. MyceliumIPSeed []byte `json:"mycelium_ip_seed"` GPUs []zosTypes.GPU `json:"gpus"` CPU uint8 `json:"cpu"` MemoryMB uint64 `json:"memory"` RootfsSizeMB uint64 `json:"rootfs_size"` Mounts []Mount `json:"mounts"` Zlogs []Zlog `json:"zlogs"` EnvVars map[string]string `json:"env_vars"` // OUTPUT ComputedIP string `json:"computedip"` ComputedIP6 string `json:"computedip6"` PlanetaryIP string `json:"planetary_ip"` MyceliumIP string `json:"mycelium_ip"` ConsoleURL string `json:"console_url"` }
VM is a virtual machine struct
func NewVMFromWorkload ¶
NewVMFromWorkload generates a new vm from given workloads and deployment
func (*VM) AssignPrivateIP ¶ added in v0.16.0
func (*VM) LoadFromVM ¶
LoadFromVM compares the vm with another given vm
func (*VM) MinRootSize ¶ added in v0.15.12
func (*VM) ZosWorkload ¶
ZosWorkload generates zos vm workloads
type VMLight ¶ added in v0.16.0
type VMLight struct { Name string `json:"name"` NodeID uint32 `json:"node"` NetworkName string `json:"network_name"` Description string `json:"description"` Flist string `json:"flist"` FlistChecksum string `json:"flist_checksum"` Entrypoint string `json:"entrypoint"` Corex bool `json:"corex"` IP string `json:"ip"` // used to get the same mycelium ip for the vm. MyceliumIPSeed []byte `json:"mycelium_ip_seed"` GPUs []zos.GPU `json:"gpus"` CPU uint8 `json:"cpu"` MemoryMB uint64 `json:"memory"` RootfsSizeMB uint64 `json:"rootfs_size"` Mounts []Mount `json:"mounts"` Zlogs []Zlog `json:"zlogs"` EnvVars map[string]string `json:"env_vars"` // OUTPUT MyceliumIP string `json:"mycelium_ip"` ConsoleURL string `json:"console_url"` }
VMLight is a virtual machine struct
func NewVMLightFromWorkload ¶ added in v0.16.0
NewVMLightFromWorkload generates a new vm from given workloads and deployment
func (*VMLight) AssignPrivateIP ¶ added in v0.16.0
func (*VMLight) LoadFromVM ¶ added in v0.16.0
LoadFromVM compares the vm with another given vm
func (*VMLight) MinRootSize ¶ added in v0.16.0
func (*VMLight) ZosWorkload ¶ added in v0.16.0
ZosWorkload generates zos vm workloads
type Volume ¶ added in v0.15.12
type Volume struct { Name string `json:"name"` SizeGB uint64 `json:"size"` Description string `json:"description"` }
Volume struct
func NewVolumeFromWorkload ¶ added in v0.15.12
NewVolumeFromWorkload generates a new volume from a workload
func (*Volume) ZosWorkload ¶ added in v0.15.12
ZosWorkload generates a workload from a volume
type ZDB ¶
type ZDB struct { Name string `json:"name"` Password string `json:"password"` Public bool `json:"public"` SizeGB uint64 `json:"size"` Description string `json:"description"` Mode string `json:"mode"` // OUTPUT IPs []string `json:"ips"` Port uint32 `json:"port"` Namespace string `json:"namespace"` }
ZDB workload struct
func NewZDBFromWorkload ¶
NewZDBFromWorkload generates a new zdb from a workload
func (*ZDB) ZosWorkload ¶
ZosWorkload generates a workload from a zdb
type ZNet ¶
type ZNet struct { Name string Description string Nodes []uint32 IPRange zos.IPNet AddWGAccess bool MyceliumKeys map[uint32][]byte SolutionType string // computed AccessWGConfig string ExternalIP *zos.IPNet ExternalSK wgtypes.Key PublicNodeID uint32 NodesIPRange map[uint32]zos.IPNet NodeDeploymentID map[uint32]uint64 WGPort map[uint32]int Keys map[uint32]wgtypes.Key }
ZNet is zos network workload
func NewNetworkFromWorkload ¶
NewNetworkFromWorkload generates a new znet from a workload
func (*ZNet) AssignNodesIPs ¶
AssignNodesIPs assign network nodes ips
func (*ZNet) AssignNodesWGKey ¶
AssignNodesWGKey assign network nodes wireguard key
func (*ZNet) AssignNodesWGPort ¶
func (znet *ZNet) AssignNodesWGPort(ctx context.Context, sub subi.SubstrateExt, ncPool client.NodeClientGetter, nodes []uint32, usedPorts map[uint32][]uint16) error
AssignNodesWGPort assign network nodes wireguard port
func (*ZNet) GenerateMetadata ¶
GenerateMetadata generates deployment metadata
func (*ZNet) GenerateVersionlessDeployments ¶ added in v0.16.0
func (znet *ZNet) GenerateVersionlessDeployments( ctx context.Context, ncPool client.NodeClientGetter, subConn subi.SubstrateExt, twinID, publicNode uint32, allNodes map[uint32]struct{}, endpoints map[uint32]net.IP, nodeUsedPorts map[uint32][]uint16, ) (map[uint32]zos.Deployment, error)
GenerateVersionlessDeployments generates deployments for network without versions.
func (*ZNet) GetAccessWGConfig ¶ added in v0.16.0
func (*ZNet) GetAddWGAccess ¶ added in v0.16.0
func (*ZNet) GetDescription ¶ added in v0.16.0
func (*ZNet) GetExternalIP ¶ added in v0.16.0
func (*ZNet) GetExternalSK ¶ added in v0.16.0
func (*ZNet) GetIPRange ¶ added in v0.16.0
func (*ZNet) GetMyceliumKeys ¶ added in v0.16.0
func (*ZNet) GetNodeDeploymentID ¶ added in v0.16.0
func (*ZNet) GetNodesIPRange ¶ added in v0.16.0
func (*ZNet) GetPublicNodeID ¶ added in v0.16.0
func (*ZNet) GetSolutionType ¶ added in v0.16.0
func (*ZNet) GetVersion ¶ added in v0.16.0
func (*ZNet) InvalidateBrokenAttributes ¶ added in v0.16.0
func (znet *ZNet) InvalidateBrokenAttributes(subConn subi.SubstrateExt, ncPool client.NodeClientGetter) error
InvalidateBrokenAttributes removes outdated attrs and deleted contracts
func (*ZNet) ReadNodesConfig ¶ added in v0.16.0
func (znet *ZNet) ReadNodesConfig(ctx context.Context, nodeDeployments map[uint32]zos.Deployment) error
ReadNodesConfig reads the configuration of a network
func (*ZNet) SetAccessWGConfig ¶ added in v0.16.0
func (*ZNet) SetExternalIP ¶ added in v0.16.0
func (*ZNet) SetExternalSK ¶ added in v0.16.0
func (*ZNet) SetMyceliumKeys ¶ added in v0.16.0
func (*ZNet) SetNodeDeploymentID ¶ added in v0.16.0
func (*ZNet) SetNodesIPRange ¶ added in v0.16.0
func (*ZNet) SetPublicNodeID ¶ added in v0.16.0
type ZNetLight ¶ added in v0.16.0
type ZNetLight struct { Name string Description string SolutionType string Nodes []uint32 IPRange zos.IPNet MyceliumKeys map[uint32][]byte // computed PublicNodeID uint32 NodesIPRange map[uint32]zos.IPNet NodeDeploymentID map[uint32]uint64 }
ZNetLight is zos network light workload
func NewNetworkLightFromWorkload ¶ added in v0.16.0
NewNetworkFromWorkload generates a new znet from a workload
func (*ZNetLight) AssignNodesIPs ¶ added in v0.16.0
AssignNodesIPs assign network nodes ips
func (*ZNetLight) GenerateMetadata ¶ added in v0.16.0
GenerateMetadata generates deployment metadata
func (*ZNetLight) GenerateVersionlessDeployments ¶ added in v0.16.0
func (znet *ZNetLight) GenerateVersionlessDeployments( ctx context.Context, ncPool client.NodeClientGetter, subConn subi.SubstrateExt, twinID, publicNode uint32, allNodes map[uint32]struct{}, _ map[uint32]net.IP, _ map[uint32][]uint16, ) (map[uint32]zos.Deployment, error)
GenerateVersionlessDeployments generates deployments for network without versions.
func (*ZNetLight) GetAccessWGConfig ¶ added in v0.16.0
func (*ZNetLight) GetAddWGAccess ¶ added in v0.16.0
func (*ZNetLight) GetDescription ¶ added in v0.16.0
func (*ZNetLight) GetExternalIP ¶ added in v0.16.0
func (*ZNetLight) GetExternalSK ¶ added in v0.16.0
func (*ZNetLight) GetIPRange ¶ added in v0.16.0
func (*ZNetLight) GetMyceliumKeys ¶ added in v0.16.0
func (*ZNetLight) GetNodeDeploymentID ¶ added in v0.16.0
func (*ZNetLight) GetNodesIPRange ¶ added in v0.16.0
func (*ZNetLight) GetPublicNodeID ¶ added in v0.16.0
func (*ZNetLight) GetSolutionType ¶ added in v0.16.0
func (*ZNetLight) GetVersion ¶ added in v0.16.0
func (*ZNetLight) InvalidateBrokenAttributes ¶ added in v0.16.0
func (znet *ZNetLight) InvalidateBrokenAttributes(subConn subi.SubstrateExt, ncPool client.NodeClientGetter) error
InvalidateBrokenAttributes removes outdated attrs and deleted contracts
func (*ZNetLight) ReadNodesConfig ¶ added in v0.16.0
func (znet *ZNetLight) ReadNodesConfig(ctx context.Context, nodeDeployments map[uint32]zos.Deployment) error
ReadNodesConfig reads the configuration of a network