module tfgrid
TFGrid workload deployment
inspired by: https://library.threefold.me/info/manual/#/manual3_iac/grid3_javascript
this client allows deployment of all kinds of workloads on TFGrid
- kubernetes
- vm
- zdb
- networks
- qsfs (quantum safe filesystem)
- kvs (key value stor)
- gateways
- ...
TODO:
Principles
The metadata we need to remember is stored in the KVS on TFChain (encrypted by the private key of the account). This metadata is important it has all info in relation to workloads we have deployed, where are they deployed, ...
TODO
- key value stor on tfchain
- most of primitives
- how to do capacity planning using the TFGrid Proxy
Contents
- account_delete
- account_init
- vm_create
- vm_delete
- vm_info
- zdb_create
- zdb_delete
- zdb_info
- ZDBMode
- AccountArgs
- IPRange
- MultiSig
- VMArgs
- VMDisk
- VMInfo
- VMNet
- ZDBArgs
- ZDBInfo
account_delete
fn account_delete(name string) ?
delete account on the handler in case it was already initialized, does not give error if not active yet if multisignature more than one will have to do
account_init
fn account_init(args AccountArgs)
init the account on the action handler for TFGrid will give error if it already exists and mneomonic or type different will also give error if an error to create it e.g. wrong mnemonic the account will be selected, which means all actions done after are done on this account
vm_create
fn vm_create(args VMArgs) ?
init the account on the action handler for TFGrid will give error if it already exists and mneomonic or type different will also give error if an error to create it e.g. wrong mnemonic the account will be selected, which means all actions done after are done on this account
vm_delete
fn vm_delete(name string) ?
vm_info
fn vm_info(name string) ?VMInfo
get object info from a deployed ZDB namespace
zdb_create
fn zdb_create(args ZDBArgs) ?
init the account on the action handler for TFGrid will give error if it already exists and mneomonic or type different will also give error if an error to create it e.g. wrong mnemonic the account will be selected, which means all actions done after are done on this account
zdb_delete
fn zdb_delete(name string) ?
zdb_info
fn zdb_info(name string) ?ZDBInfo
get object info from a deployed ZDB namespace
ZDBMode
enum ZDBMode {
user
seq
}
AccountArgs
struct AccountArgs {
pub:
name string
mnemonic string // private key in mnemonic form to be able to work on the right TFGrid net (TFChain)
nettype TFGridNet
expiration int = 300 // will expire default 5 min
multisig MultiSig // optional, not implemented yet in TFGrid
}
IPRange
struct IPRange {
pub:
range string = '10.10.0.0'
mask i16 = 16
}
MultiSig
struct MultiSig {
pub:
pubkeys []string // the pubkeys of who needs to sign
min_signature i16 // how many need minimally to sign
}
used for when we do smart contract for IT with multiple people
VMArgs
struct VMArgs {
pub:
name string
disks []VMDisk
network VMNet
node_id u32 // id of the node where this VM needs to be deployed
public_ip bool // connect virtual machine to public internet, this VM will receive an IP address
planetary bool // connect the virtual machine to the planetary network
cpu u8 // nr of cpu cores 1...16
memory u16 // MB of ram e.g. 1024*2 would be 2 GB
rootfs_size u16 = 1 // GB of root filesystem
flist string = 'https://hub.grid.tf/tf-official-apps/base:latest.flist'
entrypoint string = '/sbin/zinit init'
env map[string]string // environment variables as passed to VM
ssh_key string // default ssh_key is alias to SSH_KEY in env
}
VMDisk
struct VMDisk {
pub:
name string = 'default'
size i16 = 8 // GB size of disk
mountpoint string = '/testdisk'
}
VMInfo
struct VMInfo {
pub:
name string
disks []VMDisk
network VMNet
node_id u32 // id of the node where this VM needs to be deployed
public_ip bool // connect virtual machine to public internet, this VM will receive an IP address
planetary bool // connect the virtual machine to the planetary network
cpu u8 // nr of cpu cores 1...16
memory u16 // MB of ram e.g. 1024*2 would be 2 GB
rootfs_size u16 = 1 // GB of root filesystem
flist string = 'https://hub.grid.tf/tf-official-apps/base:latest.flist'
entrypoint string = '/sbin/zinit init'
env map[string]string // environment variables as passed to VM
ssh_key string // default ssh_key is alias to SSH_KEY in env
}
TODO what info comes back?
VMNet
struct VMNet {
pub:
name string
range IPRange
}
network needs to correspond to network created on nodes, otherwise this will not work
ZDBArgs
struct ZDBArgs {
pub:
name string
node_id u32 // id of the node where this ZDB namespace needs to be deployed
mode ZDBMode
disk_size u16 = 9
public bool // a public namespace can be read-only if a password is set
password string // password as set on the namespace
}
ZDBInfo
struct ZDBInfo {
pub:
name string
node_id u32 // id of the node where this ZDB namespace needs to be deployed
mode ZDBMode
disk_size u16 = 9
public bool // a public namespace can be read-only if a password is set
password string // password as set on the namespace
}
TODO what info comes back?