Documentation
¶
Index ¶
- Constants
- Variables
- func BuildGridProxyFilters(options FilterOptions, twinId uint64) proxyTypes.NodeFilter
- func GetFarmerBotResult(action FarmerBotAction, key string) (string, error)
- func GetNodesIDs(nodes []proxyTypes.Node) []uint32
- type AddMachineParams
- type AddWorkerParams
- type Args
- type Backend
- type Backends
- type Client
- func (c *Client) AddK8sWorker(ctx context.Context, params AddWorkerParams) (K8sCluster, error)
- func (c *Client) AssignNodes(ctx context.Context, workloads Reservations) error
- func (c *Client) DeleteDiscourse(ctx context.Context, name string) error
- func (c *Client) DeletePeertube(ctx context.Context, name string) error
- func (c *Client) DeletePresearch(ctx context.Context, name string) error
- func (c *Client) DeleteTaiga(ctx context.Context, name string) error
- func (c *Client) DeleteVM(ctx context.Context, networkName string) error
- func (c *Client) Deletefunkwhale(ctx context.Context, name string) error
- func (c *Client) DeployDiscourse(ctx context.Context, discourse Discourse) (DiscourseResult, error)
- func (c *Client) DeployPeertube(ctx context.Context, peertube Peertube) (PeertubeResult, error)
- func (c *Client) DeployPresearch(ctx context.Context, presearch Presearch) (PresearchResult, error)
- func (c *Client) DeployTaiga(ctx context.Context, taiga Taiga) (TaigaResult, error)
- func (c *Client) DeployVM(ctx context.Context, vm VM) (VMResult, error)
- func (c *Client) Deployfunkwhale(ctx context.Context, funkwhale Funkwhale) (FunkwhaleResult, error)
- func (r *Client) FilterNodes(ctx context.Context, options FilterOptions) ([]uint32, error)
- func (r *Client) FilterNodesWithFarmerBot(ctx context.Context, options FilterOptions) ([]uint32, error)
- func (r *Client) FilterNodesWithGridProxy(ctx context.Context, options FilterOptions) ([]uint32, error)
- func (c *Client) GatewayFQDNDelete(ctx context.Context, modelName string) error
- func (c *Client) GatewayFQDNDeploy(ctx context.Context, gw GatewayFQDNModel) (GatewayFQDNModel, error)
- func (c *Client) GatewayFQDNGet(ctx context.Context, modelName string) (GatewayFQDNModel, error)
- func (c *Client) GatewayNameDelete(ctx context.Context, modelName string) error
- func (c *Client) GatewayNameDeploy(ctx context.Context, gw GatewayNameModel) (GatewayNameModel, error)
- func (c *Client) GatewayNameGet(ctx context.Context, modelName string) (GatewayNameModel, error)
- func (c *Client) GetDiscourse(ctx context.Context, name string) (DiscourseResult, error)
- func (r *Client) GetFarmerTwinIDByFarmID(farmID uint32) (uint32, error)
- func (c *Client) GetPeertube(ctx context.Context, name string) (PeertubeResult, error)
- func (c *Client) GetPresearch(ctx context.Context, name string) (PresearchResult, error)
- func (c *Client) GetTaiga(ctx context.Context, name string) (TaigaResult, error)
- func (c *Client) GetVM(ctx context.Context, networkName string) (VMResult, error)
- func (c *Client) Getfunkwhale(ctx context.Context, name string) (FunkwhaleResult, error)
- func (r *Client) HasFarmerBot(ctx context.Context, farmID uint32) bool
- func (c *Client) K8sDelete(ctx context.Context, clusterName string) error
- func (c *Client) K8sDeploy(ctx context.Context, cluster K8sCluster) (K8sCluster, error)
- func (c *Client) K8sGet(ctx context.Context, params GetClusterParams) (K8sCluster, error)
- func (c *Client) Login(ctx context.Context, credentials Credentials) error
- func (c *Client) Logout(ctx context.Context)
- func (c *Client) MachineAdd(ctx context.Context, params AddMachineParams) (MachinesModel, error)
- func (c *Client) MachineRemove(ctx context.Context, params RemoveMachineParams) (MachinesModel, error)
- func (r *Client) MachinesDelete(ctx context.Context, modelName string) error
- func (c *Client) MachinesDeploy(ctx context.Context, model MachinesModel) (MachinesModel, error)
- func (c *Client) MachinesGet(ctx context.Context, modelName string) (MachinesModel, error)
- func (c *Client) RemoveK8sWorker(ctx context.Context, worker RemoveWorkerParams) (K8sCluster, error)
- func (c *Client) RemoveVM(ctx context.Context, args RemoveVM) (VMResult, error)
- func (c *Client) ZDBDelete(ctx context.Context, modelName string) error
- func (c *Client) ZDBDeploy(ctx context.Context, zdb ZDB) (ZDB, error)
- func (r *Client) ZDBGet(ctx context.Context, modelName string) (ZDB, error)
- func (r *Client) ZOSDeploymentChanges(ctx context.Context, nodeID uint32, contractID uint64) ([]gridtypes.Workload, error)
- func (r *Client) ZOSDeploymentDelete(ctx context.Context, nodeID uint32, contractID uint64) error
- func (r *Client) ZOSDeploymentDeploy(ctx context.Context, nodeID uint32, dl gridtypes.Deployment) error
- func (r *Client) ZOSDeploymentGet(ctx context.Context, nodeID uint32, contractID uint64) (gridtypes.Deployment, error)
- func (r *Client) ZOSDeploymentUpdate(ctx context.Context, nodeID uint32, dl gridtypes.Deployment) error
- func (r *Client) ZOSNetworkGetPublicExitDevice(ctx context.Context, nodeID uint32) (exit client.ExitDevice, err error)
- func (r *Client) ZOSNetworkInterfaces(ctx context.Context, nodeID uint32) (map[string][]net.IP, error)
- func (r *Client) ZOSNetworkListAllInterfaces(ctx context.Context, nodeID uint32) (result map[string]client.Interface, err error)
- func (r *Client) ZOSNetworkListWGPorts(ctx context.Context, nodeID uint32) ([]uint16, error)
- func (r *Client) ZOSNetworkPublicConfigGet(ctx context.Context, nodeID uint32) (client.PublicConfig, error)
- func (r *Client) ZOSNetworkSetPublicExitDevice(ctx context.Context, nodeID uint32, iface string) error
- func (r *Client) ZOSStatisticsGet(ctx context.Context, nodeID uint32) (Statistics, error)
- func (r *Client) ZOSStoragePools(ctx context.Context, nodeID uint32) (pools []client.PoolMetrics, err error)
- func (r *Client) ZOSSystemDMI(ctx context.Context, nodeID uint32) (dmi.DMI, error)
- func (r *Client) ZOSSystemHypervisor(ctx context.Context, nodeID uint32) (string, error)
- func (r *Client) ZOSVersion(ctx context.Context, nodeID uint32) (client.Version, error)
- func (r *Client) ZosHasPublicIPv6(ctx context.Context, nodeID uint32) (bool, error)
- type Credentials
- type Discourse
- type DiscourseResult
- type Disk
- type FarmerBotAction
- type FarmerBotArgs
- type FilterOptions
- type FilterResult
- type Funkwhale
- type FunkwhaleResult
- type GatewayFQDNModel
- type GatewayNameModel
- type GatewayedMachines
- type GetClusterParams
- type Group
- type Groups
- type K8sCluster
- type K8sNode
- type Machine
- type MachinesModel
- type Metadata
- type Network
- type Params
- type Peertube
- type PeertubeResult
- type PlannedReservation
- type PoolMetrics
- type Presearch
- type PresearchResult
- type ProjectState
- type QSFS
- type RemoveMachineParams
- type RemoveVM
- type RemoveWorkerParams
- type Reservations
- type Statistics
- type TFGridClient
- type Taiga
- type TaigaResult
- type VM
- type VMResult
- type ZDB
- type Zlog
Constants ¶
const ( FarmerBotVersionAction = "farmerbot.farmmanager.version" FarmerBotFindNodeAction = "farmerbot.nodemanager.findnode" FarmerBotRMBFunction = "execute_job" )
Variables ¶
var ( Status = "up" TrueVal = true )
Functions ¶
func BuildGridProxyFilters ¶
func BuildGridProxyFilters(options FilterOptions, twinId uint64) proxyTypes.NodeFilter
func GetFarmerBotResult ¶
func GetFarmerBotResult(action FarmerBotAction, key string) (string, error)
func GetNodesIDs ¶
func GetNodesIDs(nodes []proxyTypes.Node) []uint32
Types ¶
type AddMachineParams ¶
type AddWorkerParams ¶
type Args ¶
type Args struct { RequiredHRU *uint64 `json:"required_hru,omitempty"` RequiredSRU *uint64 `json:"required_sru,omitempty"` RequiredCRU *uint64 `json:"required_cru,omitempty"` RequiredMRU *uint64 `json:"required_mru,omitempty"` NodeExclude []uint32 `json:"node_exclude,omitempty"` Dedicated *bool `json:"dedicated,omitempty"` PublicConfig *bool `json:"public_config,omitempty"` PublicIPs *uint32 `json:"public_ips"` Certified *bool `json:"certified,omitempty"` }
type Client ¶
type Client struct { GridClient TFGridClient TwinID uint32 Identity substrate.Identity // holds each Projects deployments Projects map[string]ProjectState }
Client holds a tfgrid client instance.
func (*Client) AddK8sWorker ¶
func (c *Client) AddK8sWorker(ctx context.Context, params AddWorkerParams) (K8sCluster, error)
AddK8sWorker adds a worker to a deployed kubernetes cluster
func (*Client) AssignNodes ¶
func (c *Client) AssignNodes(ctx context.Context, workloads Reservations) error
Searching for node for each workload considering the reserved capacity by workloads in the same deployment. Assign the NodeID if found one or return it with NodeID: 0
func (*Client) DeleteDiscourse ¶
func (*Client) DeletePeertube ¶
func (*Client) DeletePresearch ¶
func (*Client) Deletefunkwhale ¶
func (*Client) DeployDiscourse ¶
func (*Client) DeployPeertube ¶
func (*Client) DeployPresearch ¶
func (*Client) DeployTaiga ¶
func (*Client) Deployfunkwhale ¶
func (*Client) FilterNodes ¶
func (*Client) FilterNodesWithFarmerBot ¶
func (*Client) FilterNodesWithGridProxy ¶
func (*Client) GatewayFQDNDelete ¶
func (*Client) GatewayFQDNDeploy ¶
func (c *Client) GatewayFQDNDeploy(ctx context.Context, gw GatewayFQDNModel) (GatewayFQDNModel, error)
func (*Client) GatewayFQDNGet ¶
func (*Client) GatewayNameDelete ¶
func (*Client) GatewayNameDeploy ¶
func (c *Client) GatewayNameDeploy(ctx context.Context, gw GatewayNameModel) (GatewayNameModel, error)
func (*Client) GatewayNameGet ¶
func (*Client) GetDiscourse ¶
func (*Client) GetFarmerTwinIDByFarmID ¶
func (*Client) GetPeertube ¶
func (*Client) GetPresearch ¶
func (*Client) Getfunkwhale ¶
func (*Client) HasFarmerBot ¶
func (*Client) K8sDeploy ¶
func (c *Client) K8sDeploy(ctx context.Context, cluster K8sCluster) (K8sCluster, error)
K8sDeploy deploys a kubernetes cluster
func (*Client) K8sGet ¶
func (c *Client) K8sGet(ctx context.Context, params GetClusterParams) (K8sCluster, error)
K8sGet retrieves a kubernetes cluster specified by the cluster name
func (*Client) MachineAdd ¶
func (c *Client) MachineAdd(ctx context.Context, params AddMachineParams) (MachinesModel, error)
func (*Client) MachineRemove ¶
func (c *Client) MachineRemove(ctx context.Context, params RemoveMachineParams) (MachinesModel, error)
func (*Client) MachinesDelete ¶
func (*Client) MachinesDeploy ¶
func (c *Client) MachinesDeploy(ctx context.Context, model MachinesModel) (MachinesModel, error)
nodes should always be provided
func (*Client) MachinesGet ¶
func (*Client) RemoveK8sWorker ¶
func (c *Client) RemoveK8sWorker(ctx context.Context, worker RemoveWorkerParams) (K8sCluster, error)
RemoveK8sWorker removes a worker from a deployed kubernetes cluster
func (*Client) ZOSDeploymentChanges ¶
func (*Client) ZOSDeploymentDelete ¶
func (*Client) ZOSDeploymentDeploy ¶
func (*Client) ZOSDeploymentGet ¶
func (*Client) ZOSDeploymentUpdate ¶
func (*Client) ZOSNetworkGetPublicExitDevice ¶
func (*Client) ZOSNetworkInterfaces ¶
func (*Client) ZOSNetworkListAllInterfaces ¶
func (*Client) ZOSNetworkListWGPorts ¶
func (*Client) ZOSNetworkPublicConfigGet ¶
func (*Client) ZOSNetworkSetPublicExitDevice ¶
func (*Client) ZOSStatisticsGet ¶
func (*Client) ZOSStoragePools ¶
func (*Client) ZOSSystemDMI ¶
func (*Client) ZOSSystemHypervisor ¶
func (*Client) ZOSVersion ¶
type Credentials ¶
type Discourse ¶
type Discourse struct { Name string `json:"name"` FarmID uint64 `json:"farm_id"` Capacity string `json:"capacity"` DiskSize uint32 `json:"disk_size"` SSHKey string `json:"ssh_key"` DeveloperEmail string `json:"developer_email"` SMTPUsername string `json:"smtp_username"` SMTPPassword string `json:"smtp_password"` SMTPAddress string `json:"smtp_address"` SMTPEnableTLS bool `json:"smtp_enable_tls"` SMTPPort uint32 `json:"smtp_port"` PublicIPv6 bool `json:"public_ipv6"` }
type DiscourseResult ¶
type Disk ¶
type Disk struct { MountPoint string `json:"mountpoint"` SizeGB int `json:"size"` Description string `json:"description"` // computed Name string `json:"name"` }
Disk struct
type FarmerBotAction ¶
type FarmerBotAction struct { Guid string `json:"guid"` TwinID uint32 `json:"twinid"` Action string `json:"action"` Args FarmerBotArgs `json:"args"` Result FarmerBotArgs `json:"result"` State string `json:"state"` Start uint64 `json:"start"` End uint64 `json:"end"` GracePeriod uint32 `json:"grace_period"` Error string `json:"error"` Timeout uint32 `json:"timeout"` SourceTwinID uint32 `json:"src_twinid"` SourceAction string `json:"src_action"` Dependencies []string `json:"dependencies"` }
func BuildFarmerBotAction ¶
type FarmerBotArgs ¶
type FilterOptions ¶
type FilterResult ¶
type FilterResult struct { FilterOption FilterOptions `json:"filter_options"` AvailableNodes []uint32 `json:"available_nodes"` }
type Funkwhale ¶
type Funkwhale struct { Name string `json:"name"` FarmID uint64 `json:"farm_id"` Capacity string `json:"capacity"` SSHKey string `json:"ssh_key"` AdminEmail string `json:"admin_email"` AdminUsername string `json:"admin_username"` AdminPassword string `json:"admin_password"` PublicIPv6 bool `json:"public_ipv6"` }
type FunkwhaleResult ¶
type GatewayFQDNModel ¶
type GatewayFQDNModel struct { // required NodeID uint32 `json:"node_id"` // Backends are list of backend ips Backends []zos.Backend `json:"backends"` // FQDN deployed on the node FQDN string `json:"fqdn"` // Name is the workload name Name string `json:"name"` // optional // Passthrough whether to pass tls traffic or not TLSPassthrough bool `json:"tls_passthrough"` Description string `json:"description"` // computed ContractID uint64 `json:"contract_id"` }
GatewayFQDNModel for gateway FQDN proxy
func GatewayFQDNToModel ¶
func GatewayFQDNToModel(gw workloads.GatewayFQDNProxy) GatewayFQDNModel
type GatewayNameModel ¶
type GatewayNameModel struct { // Required NodeID uint32 `json:"node_id"` // Name the fully qualified domain name to use (cannot be present with Name) Name string `json:"name"` // Backends are list of backend ips Backends []zos.Backend `json:"backends"` // Optional // Passthrough whether to pass tls traffic or not TLSPassthrough bool `json:"tls_passthrough"` Description string `json:"description"` // FQDN deployed on the node FQDN string `json:"fqdn"` NameContractID uint64 `json:"name_contract_id"` ContractID uint64 `json:"contract_id"` }
GatewayNameModel struct for gateway name proxy
type GatewayedMachines ¶
type GatewayedMachines struct { Machine Machine `json:"machine"` Gateway GatewayNameModel `json:"gateway"` }
type GetClusterParams ¶
type K8sCluster ¶
type K8sCluster struct { Name string `json:"name"` Master *K8sNode `json:"master"` Workers []K8sNode `json:"workers"` Token string `json:"token"` NetworkName string `json:"network_name"` SSHKey string `json:"ssh_key"` AddWGAccess bool `json:"add_wg_access"` }
K8sCluster struct for k8s cluster
type K8sNode ¶
type K8sNode struct { Name string `json:"name"` NodeID uint32 `json:"node_id"` FarmID uint32 `json:"farm_id"` DiskSize int `json:"disk_size"` PublicIP bool `json:"public_ip"` PublicIP6 bool `json:"public_ip6"` Planetary bool `json:"planetary"` Flist string `json:"flist"` CPU int `json:"cpu"` Memory int `json:"memory"` // computed ComputedIP4 string `json:"computed_ip4"` ComputedIP6 string `json:"computed_ip6"` WGIP string `json:"wg_ip"` YggIP string `json:"ygg_ip"` }
K8sNode kubernetes data
type Machine ¶
type Machine struct { NodeID uint32 `json:"node_id"` FarmID uint32 `json:"farm_id"` Name string `json:"name"` Flist string `json:"flist"` PublicIP bool `json:"public_ip"` PublicIP6 bool `json:"public_ip6"` Planetary bool `json:"planetary"` Description string `json:"description"` CPU int `json:"cpu"` Memory int `json:"memory"` RootfsSize int `json:"rootfs_size"` Entrypoint string `json:"entrypoint"` Zlogs []Zlog `json:"zlogs"` Disks []Disk `json:"disks"` QSFSs []QSFS `json:"qsfss"` EnvVars map[string]string `json:"env_vars"` // computed ComputedIP4 string `json:"computed_ip4"` ComputedIP6 string `json:"computed_ip6"` WGIP string `json:"wireguard_ip"` YggIP string `json:"ygg_ip"` }
type MachinesModel ¶
type MachinesModel struct { Name string `json:"name"` // this is the name of the deployment, should be unique Network Network `json:"network"` // network specs Machines []Machine `json:"machines"` // machines specs }
Machines model ensures that each node has one deployment that includes all workloads
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 Params ¶
type Params struct { Key string `json:"key"` Value interface{} `json:"value"` }
func BuildFarmerBotParams ¶
func BuildFarmerBotParams(options FilterOptions) []Params
type Peertube ¶
type Peertube struct { Name string `json:"name"` FarmID uint64 `json:"farm_id"` Capacity string `json:"capacity"` SSHKey string `json:"ssh_key"` DBUserName string `json:"db_username"` DBPassword string `json:"db_password"` AdminEmail string `json:"admin_email"` PublicIPv6 bool `json:"public_ipv6"` }
type PeertubeResult ¶
type PlannedReservation ¶
type PoolMetrics ¶
type PoolMetrics struct { Name string `json:"name"` Type zos.DeviceType `json:"type"` Size gridtypes.Unit `json:"size"` Used gridtypes.Unit `json:"used"` }
PoolMetrics stores storage pool metrics
type Presearch ¶
type Presearch struct { Name string `json:"name"` FarmID uint64 `json:"farm_id"` SSHKey string `json:"ssh_key"` DiskSize uint32 `json:"disk_size"` PublicIP bool `json:"public_ipv4"` PublicIPv6 bool `json:"public_ipv6"` PublicRestoreKey string `json:"public_restore_key"` PrivateRestoreKey string `json:"private_restore_key"` RegistrationCode string `json:"registration_code"` }
type PresearchResult ¶
type ProjectState ¶
type ProjectState struct {
// contains filtered or unexported fields
}
type QSFS ¶
type QSFS struct { MountPoint string `json:"mountpoint"` 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"` // computed Name string `json:"name"` MetricsEndpoint string `json:"metrics_endpoint"` }
QSFS struct
type RemoveMachineParams ¶
type RemoveWorkerParams ¶
type Reservations ¶
type Reservations map[string]*PlannedReservation
type Statistics ¶
type TFGridClient ¶
type TFGridClient interface { DeployGWFQDN(ctx context.Context, gw *workloads.GatewayFQDNProxy) error DeployGWName(ctx context.Context, gw *workloads.GatewayNameProxy) error DeployK8sCluster(ctx context.Context, k8s *workloads.K8sCluster) error DeployNetwork(ctx context.Context, znet *workloads.ZNet) error DeployDeployment(ctx context.Context, d *workloads.Deployment) error CancelProject(ctx context.Context, projectName string) error GetProjectContracts(ctx context.Context, projectName string) (graphql.Contracts, error) GetNodeClient(nodeID uint32) (*client.NodeClient, error) RMBCall(ctx context.Context, twin uint32, fn string, data interface{}, result interface{}) error FilterNodes(filter types.NodeFilter, pagination types.Limit) (res []types.Node, totalCount int, err error) FilterFarms(filter types.FarmFilter, pagination types.Limit) (res []types.Farm, totalCount int, err error) GetNode(nodeID uint32) (res types.NodeWithNestedCapacity, err error) GetNodeDomain(ctx context.Context, nodeID uint32) (string, error) GetNodeFarm(nodeID uint32) (uint32, error) SetContractState(contracts map[uint32]state.ContractIDs) LoadNetwork(networkName string) (workloads.ZNet, error) LoadGatewayFQDN(modelName string, nodeID uint32) (workloads.GatewayFQDNProxy, error) LoadGatewayName(modelName string, nodeID uint32) (workloads.GatewayNameProxy, error) LoadK8s(modelName string, nodeIDs []uint32) (workloads.K8sCluster, error) LoadDeployment(modelName string, nodeID uint32) (workloads.Deployment, error) LoadZDB(modelName string, nodeID uint32) (workloads.ZDB, error) CancelDeployment(ctx context.Context, dl *workloads.Deployment) error CancelContract(ctx context.Context, contractID uint64) error Close() }
func NewTFGridClient ¶
func NewTFGridClient(c *deployer.TFPluginClient) TFGridClient
type Taiga ¶
type Taiga struct { Name string `json:"name"` FarmID uint64 `json:"farm_id"` Capacity string `json:"capacity"` SSHKey string `json:"ssh_key"` DiskSize uint32 `json:"disk_size"` AdminEmail string `json:"admin_email"` AdminUsername string `json:"admin_username"` AdminPassword string `json:"admin_password"` PublicIPv6 bool `json:"public_ipv6"` }
type TaigaResult ¶
type VM ¶
type VM struct { Name string `json:"name"` FarmID uint64 `json:"farm_id"` Network string `json:"network"` Capacity string `json:"capacity"` Times uint32 `json:"times"` DiskSize uint32 `json:"disk_size"` SSHKey string `json:"ssh_key"` Gateway bool `json:"gateway"` AddWireguardAccess bool `json:"add_wireguard_access"` AddPublicIPv4 bool `json:"add_public_ipv4"` AddPublicIPv6 bool `json:"add_public_ipv6"` }
type VMResult ¶
type VMResult struct { Network string `json:"network"` WireguardConfig string `json:"wireguard_config"` VMs []GatewayedMachines `json:"vms"` }
type ZDB ¶
type ZDB struct { NodeID uint32 `json:"node_id"` Name string `json:"name"` Password string `json:"password"` Public bool `json:"public"` Size int `json:"size"` Description string `json:"description"` Mode string `json:"mode"` // computed Port uint32 `json:"port"` Namespace string `json:"namespace"` IPs []string `json:"ips"` }