tfgrid

package
v0.0.0-...-0269a1e Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

README

TFGrid

  • TFGrid package provides the access point to operations on the tfgrid.
  • operations on the tfgrid are exposed by the Runner struct.

Runner

  • Internally, a Runner holds a tfgrid client instance.
  • It provides a layer on top of the grid client to make queries to the grid a bit more manageable and easier.
  • It abstracts deployments/contracts operations from users into project operations.
  • A user is able to deploy, read, and/or delete multiple types of projects.
  • A user could deploy all types of tfgrid workloads using a combination of projects.

changes

  • rename functions to convert from grid-client types to web3proxy types
  • rename functions to convert from web3proxy types to grid-client types
  • add AddWGAccess flag to k8s cluster (maybe also iprange)
  • think of a better naming for contractsInfo struct
  • make a Contains function instead of using the one in workloads package
  • in k8s remove worker, check if there is no other worker on workerNodeID before updating network
  • hide names generate (like generateProjectName, ....)

deploy

  • make sure there is no contracts with project name
  • convert from web3proxy types to grid-client types
  • deploy
  • load from state
  • convert from grid client types to web3proxy types
  • return

delete

  • generate project name
  • delete by project name

get

  • load model contracts
  • load from state (set state, load mnha)
  • convert to web3proxy types
  • return

add (k8s, machines)

  • load model contracts
  • load from state (set state, load mnha)
  • convert new workload from web3proxy types to grid-client types
  • update deployment (network included)
    • if there is a new node, add to network
  • load updated model
  • return

remove (k8s, machines)

  • load model contracts
  • load from state(set state, load mnha)
  • update deployment (network included)
    • if there is another deployment on the same node of the removed vm, eshta
    • else, delete node from network
  • load updated model
  • return

notes

  • solutino type should be more indicative of solution type, find somewhere else for project name

refactoring #15

  • build two getters:
    • one works with graphql
    • the other works without graphql
  • local state on web proxy: project to grid state (map[uint32]contractIDs) (map[projectName]gridState)

Documentation

Index

Constants

View Source
const (
	FarmerBotVersionAction  = "farmerbot.farmmanager.version"
	FarmerBotFindNodeAction = "farmerbot.nodemanager.findnode"
	FarmerBotRMBFunction    = "execute_job"
)

Variables

View Source
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 AddMachineParams struct {
	ModelName string  `json:"model_name"`
	Machine   Machine `json:"machine"`
}

type AddWorkerParams

type AddWorkerParams struct {
	ClusterName string  `json:"cluster_name"`
	MasterName  string  `json:"master_name"`
	Worker      K8sNode `json:"worker"`
}

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 Backend

type Backend zos.ZdbBackend

Backend is a zos backend

type Backends

type Backends []Backend

Backends is a list of backends

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 (c *Client) DeleteDiscourse(ctx context.Context, name string) error

func (*Client) DeletePeertube

func (c *Client) DeletePeertube(ctx context.Context, name string) error

func (*Client) DeletePresearch

func (c *Client) DeletePresearch(ctx context.Context, name string) error

func (*Client) DeleteTaiga

func (c *Client) DeleteTaiga(ctx context.Context, name string) error

func (*Client) DeleteVM

func (c *Client) DeleteVM(ctx context.Context, networkName string) error

func (*Client) Deletefunkwhale

func (c *Client) Deletefunkwhale(ctx context.Context, name string) error

func (*Client) DeployDiscourse

func (c *Client) DeployDiscourse(ctx context.Context, discourse Discourse) (DiscourseResult, error)

func (*Client) DeployPeertube

func (c *Client) DeployPeertube(ctx context.Context, peertube Peertube) (PeertubeResult, error)

func (*Client) DeployPresearch

func (c *Client) DeployPresearch(ctx context.Context, presearch Presearch) (PresearchResult, error)

func (*Client) DeployTaiga

func (c *Client) DeployTaiga(ctx context.Context, taiga Taiga) (TaigaResult, error)

func (*Client) DeployVM

func (c *Client) DeployVM(ctx context.Context, vm VM) (VMResult, error)

func (*Client) Deployfunkwhale

func (c *Client) Deployfunkwhale(ctx context.Context, funkwhale Funkwhale) (FunkwhaleResult, error)

func (*Client) FilterNodes

func (r *Client) FilterNodes(ctx context.Context, options FilterOptions) ([]uint32, error)

func (*Client) FilterNodesWithFarmerBot

func (r *Client) FilterNodesWithFarmerBot(ctx context.Context, options FilterOptions) ([]uint32, error)

func (*Client) FilterNodesWithGridProxy

func (r *Client) FilterNodesWithGridProxy(ctx context.Context, options FilterOptions) ([]uint32, error)

func (*Client) GatewayFQDNDelete

func (c *Client) GatewayFQDNDelete(ctx context.Context, modelName string) error

func (*Client) GatewayFQDNDeploy

func (c *Client) GatewayFQDNDeploy(ctx context.Context, gw GatewayFQDNModel) (GatewayFQDNModel, error)

func (*Client) GatewayFQDNGet

func (c *Client) GatewayFQDNGet(ctx context.Context, modelName string) (GatewayFQDNModel, error)

func (*Client) GatewayNameDelete

func (c *Client) GatewayNameDelete(ctx context.Context, modelName string) error

func (*Client) GatewayNameDeploy

func (c *Client) GatewayNameDeploy(ctx context.Context, gw GatewayNameModel) (GatewayNameModel, error)

func (*Client) GatewayNameGet

func (c *Client) GatewayNameGet(ctx context.Context, modelName string) (GatewayNameModel, error)

func (*Client) GetDiscourse

func (c *Client) GetDiscourse(ctx context.Context, name string) (DiscourseResult, error)

func (*Client) GetFarmerTwinIDByFarmID

func (r *Client) GetFarmerTwinIDByFarmID(farmID uint32) (uint32, error)

func (*Client) GetPeertube

func (c *Client) GetPeertube(ctx context.Context, name string) (PeertubeResult, error)

func (*Client) GetPresearch

func (c *Client) GetPresearch(ctx context.Context, name string) (PresearchResult, error)

func (*Client) GetTaiga

func (c *Client) GetTaiga(ctx context.Context, name string) (TaigaResult, error)

func (*Client) GetVM

func (c *Client) GetVM(ctx context.Context, networkName string) (VMResult, error)

func (*Client) Getfunkwhale

func (c *Client) Getfunkwhale(ctx context.Context, name string) (FunkwhaleResult, error)

func (*Client) HasFarmerBot

func (r *Client) HasFarmerBot(ctx context.Context, farmID uint32) bool

func (*Client) K8sDelete

func (c *Client) K8sDelete(ctx context.Context, clusterName string) error

K8sDelete deletes a kubernetes cluster specified by the cluster name

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) Login

func (c *Client) Login(ctx context.Context, credentials Credentials) error

func (*Client) Logout

func (c *Client) Logout(ctx context.Context)

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 (r *Client) MachinesDelete(ctx context.Context, modelName string) error

func (*Client) MachinesDeploy

func (c *Client) MachinesDeploy(ctx context.Context, model MachinesModel) (MachinesModel, error)

nodes should always be provided

func (*Client) MachinesGet

func (c *Client) MachinesGet(ctx context.Context, modelName string) (MachinesModel, error)

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) RemoveVM

func (c *Client) RemoveVM(ctx context.Context, args RemoveVM) (VMResult, error)

func (*Client) ZDBDelete

func (c *Client) ZDBDelete(ctx context.Context, modelName string) error

func (*Client) ZDBDeploy

func (c *Client) ZDBDeploy(ctx context.Context, zdb ZDB) (ZDB, error)

func (*Client) ZDBGet

func (r *Client) ZDBGet(ctx context.Context, modelName string) (ZDB, error)

func (*Client) ZOSDeploymentChanges

func (r *Client) ZOSDeploymentChanges(ctx context.Context, nodeID uint32, contractID uint64) ([]gridtypes.Workload, error)

func (*Client) ZOSDeploymentDelete

func (r *Client) ZOSDeploymentDelete(ctx context.Context, nodeID uint32, contractID uint64) error

func (*Client) ZOSDeploymentDeploy

func (r *Client) ZOSDeploymentDeploy(ctx context.Context, nodeID uint32, dl gridtypes.Deployment) error

func (*Client) ZOSDeploymentGet

func (r *Client) ZOSDeploymentGet(ctx context.Context, nodeID uint32, contractID uint64) (gridtypes.Deployment, error)

func (*Client) ZOSDeploymentUpdate

func (r *Client) ZOSDeploymentUpdate(ctx context.Context, nodeID uint32, dl gridtypes.Deployment) error

func (*Client) ZOSNetworkGetPublicExitDevice

func (r *Client) ZOSNetworkGetPublicExitDevice(ctx context.Context, nodeID uint32) (exit client.ExitDevice, err error)

func (*Client) ZOSNetworkInterfaces

func (r *Client) ZOSNetworkInterfaces(ctx context.Context, nodeID uint32) (map[string][]net.IP, error)

func (*Client) ZOSNetworkListAllInterfaces

func (r *Client) ZOSNetworkListAllInterfaces(ctx context.Context, nodeID uint32) (result map[string]client.Interface, err error)

func (*Client) ZOSNetworkListWGPorts

func (r *Client) ZOSNetworkListWGPorts(ctx context.Context, nodeID uint32) ([]uint16, error)

func (*Client) ZOSNetworkPublicConfigGet

func (r *Client) ZOSNetworkPublicConfigGet(ctx context.Context, nodeID uint32) (client.PublicConfig, error)

func (*Client) ZOSNetworkSetPublicExitDevice

func (r *Client) ZOSNetworkSetPublicExitDevice(ctx context.Context, nodeID uint32, iface string) error

func (*Client) ZOSStatisticsGet

func (r *Client) ZOSStatisticsGet(ctx context.Context, nodeID uint32) (Statistics, error)

func (*Client) ZOSStoragePools

func (r *Client) ZOSStoragePools(ctx context.Context, nodeID uint32) (pools []client.PoolMetrics, err error)

func (*Client) ZOSSystemDMI

func (r *Client) ZOSSystemDMI(ctx context.Context, nodeID uint32) (dmi.DMI, error)

func (*Client) ZOSSystemHypervisor

func (r *Client) ZOSSystemHypervisor(ctx context.Context, nodeID uint32) (string, error)

func (*Client) ZOSVersion

func (r *Client) ZOSVersion(ctx context.Context, nodeID uint32) (client.Version, error)

func (*Client) ZosHasPublicIPv6

func (r *Client) ZosHasPublicIPv6(ctx context.Context, nodeID uint32) (bool, error)

type Credentials

type Credentials struct {
	Mnemonics string `json:"mnemonics"`
	Network   string `json:"network"`
}

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 DiscourseResult struct {
	Name         string `json:"name"`
	MachineYGGIP string `json:"ygg_ip"`
	MachineIPv6  string `json:"ipv6"`
	FQDN         string `json:"fqdn"`
}

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

func BuildFarmerBotAction(farmerTwinID uint32, sourceTwinID uint32, args []Args, params []Params, action string) FarmerBotAction

type FarmerBotArgs

type FarmerBotArgs struct {
	Args   []Args   `json:"args"`
	Params []Params `json:"params"`
}

type FilterOptions

type FilterOptions struct {
	FarmID         uint32 `json:"farm_id"`
	PublicConfig   bool   `json:"public_config"`
	PublicIpsCount uint64 `json:"public_ips_count"`
	Dedicated      bool   `json:"dedicated"`
	MRU            uint64 `json:"mru"`
	HRU            uint64 `json:"hru"`
	SRU            uint64 `json:"sru"`
}

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 FunkwhaleResult struct {
	Name         string `json:"name"`
	MachineYGGIP string `json:"ygg_ip"`
	MachineIPv6  string `json:"ipv6"`
	FQDN         string `json:"fqdn"`
}

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

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 GetClusterParams struct {
	ClusterName string `json:"cluster_name"`
	MasterName  string `json:"master_name"`
}

type Group

type Group struct {
	Backends Backends `json:"backends"`
}

Group is a zos group

type Groups

type Groups []Group

Groups is a list of groups

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 Network

type Network struct {
	AddWireguardAccess bool   `json:"add_wireguard_access"` // true to add access node
	IPRange            string `json:"ip_range"`

	// computed
	Name            string `json:"name"` // network name will be (projectname.network)
	WireguardConfig string `json:"wireguard_config"`
}

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 PeertubeResult struct {
	Name         string `json:"name"`
	MachineYGGIP string `json:"ygg_ip"`
	MachineIPv6  string `json:"ipv6"`
	FQDN         string `json:"fqdn"`
}

type PlannedReservation

type PlannedReservation struct {
	WorkloadName string
	NodeID       uint32
	FarmID       uint32
	MRU          uint64
	SRU          uint64
	HRU          uint64
	PublicIps    bool
}

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 PresearchResult struct {
	Name         string `json:"name"`
	MachineYGGIP string `json:"ygg_ip"`
	MachineIPv6  string `json:"ipv6"`
	MachineIPV4  string `json:"machine_ipv4"`
}

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 RemoveMachineParams struct {
	ModelName   string `json:"model_name"`
	MachineName string `json:"machine_name"`
}

type RemoveVM

type RemoveVM struct {
	Network string `json:"network"`
	VMName  string `json:"vm_name"`
}

type RemoveWorkerParams

type RemoveWorkerParams struct {
	ClusterName string `json:"cluster_name"`
	MasterName  string `json:"master_name"`
	WorkerName  string `json:"worker_name"`
}

type Reservations

type Reservations map[string]*PlannedReservation

type Statistics

type Statistics struct {
	Total gridtypes.Capacity `json:"total"`
	Used  gridtypes.Capacity `json:"used"`
}

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 TaigaResult struct {
	Name         string `json:"name"`
	MachineYGGIP string `json:"ygg_ip"`
	MachineIPv6  string `json:"ipv6"`
	FQDN         string `json:"fqdn"`
}

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

func ZDBToModel

func ZDBToModel(wl workloads.ZDB, nodeID uint32) ZDB

type Zlog

type Zlog struct {
	Output string `json:"output"`
}

Zlog logger struct

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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