models

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BacalhauNodeTypeCompute      = "compute"
	BacalhauNodeTypeOrchestrator = "requester"
)
View Source
const (
	DisplayTextSuccess    = "✔"
	DisplayTextFailed     = "✘"
	DisplayTextInProgress = "↻"
	DisplayTextWaiting    = "↻"
	DisplayTextCreating   = "⌃"
	DisplayTextUnknown    = "?"
	DisplayTextNotStarted = "┅"

	DisplayEmojiSuccess    = "✅"
	DisplayEmojiWaiting    = "⏳"
	DisplayEmojiCreating   = "⬆️"
	DisplayEmojiFailed     = "❌"
	DisplayEmojiQuestion   = "❓"
	DisplayEmojiNotStarted = "⬛️"

	DisplayEmojiOrchestratorNode = "🌕"
	DisplayEmojiWorkerNode       = "⚫️"

	DisplayTextOrchestratorNode = "⏼"
	DisplayTextWorkerNode       = " "

	DisplayEmojiOrchestrator = "🤖"
	DisplayEmojiSSH          = "🔑"
	DisplayEmojiDocker       = "🐳"
	DisplayEmojiBacalhau     = "🐟"

	DisplayTextOrchestrator = "O"
	DisplayTextSSH          = "S"
	DisplayTextDocker       = "D"
	DisplayTextBacalhau     = "B"
	DisplayTextCustomScript = "X"
)
View Source
const (
	MachineResourceTypeComputeInstance = "compute_instance"
)
View Source
const (
	MachineResourceTypeEC2Instance = "ec2_instance"
)
View Source
const MaximumGCPProjectIDLength = 18

GCP constants

View Source
const MaximumGCPUniqueProjectIDLength = 26
View Source
const NumberOfSimultaneousProvisionings = 5

Variables

View Source
var (
	ServiceTypeSSH          = ServiceType{Name: "SSH", State: ServiceStateNotStarted}
	ServiceTypeDocker       = ServiceType{Name: "Docker", State: ServiceStateNotStarted}
	ServiceTypeBacalhau     = ServiceType{Name: "Bacalhau", State: ServiceStateNotStarted}
	ServiceTypeCorePackages = ServiceType{Name: "CorePackages", State: ServiceStateNotStarted}
	ServiceTypeScript       = ServiceType{Name: "Script", State: ServiceStateNotStarted}
)
View Source
var AWSResourceTypeInstance = ResourceType{
	ResourceString:    "aws:ec2:instance",
	ShortResourceName: "EC2 ",
}
View Source
var AWSResourceTypeSecurityGroup = ResourceType{
	ResourceString:    "aws:ec2:security-group",
	ShortResourceName: "SG  ",
}
View Source
var AWSResourceTypeSubnet = ResourceType{
	ResourceString:    "aws:ec2:subnet",
	ShortResourceName: "SNET",
}
View Source
var AWSResourceTypeVPC = ResourceType{
	ResourceString:    "aws:ec2:vpc",
	ShortResourceName: "VPC ",
}
View Source
var AWSResourceTypeVolume = ResourceType{
	ResourceString:    "aws:ec2:volume",
	ShortResourceName: "VOL ",
}
View Source
var AzureResourceTypeDISK = ResourceType{
	ResourceString:    "Microsoft.Compute/disks",
	ShortResourceName: "DISK",
}
View Source
var AzureResourceTypeGuestAttestation = ResourceType{
	ResourceString:    "Microsoft.Compute/virtualMachines/extensions/GuestAttestation",
	ShortResourceName: "GATT",
}
View Source
var AzureResourceTypeIP = ResourceType{
	ResourceString:    "Microsoft.Network/publicIPAddresses",
	ShortResourceName: "IP  ",
}
View Source
var AzureResourceTypeNIC = ResourceType{
	ResourceString:    "Microsoft.Network/networkInterfaces",
	ShortResourceName: "NIC ",
}
View Source
var AzureResourceTypeNSG = ResourceType{
	ResourceString:    "Microsoft.Network/networkSecurityGroups",
	ShortResourceName: "NSG ",
}
View Source
var AzureResourceTypeSNET = ResourceType{
	ResourceString:    "Microsoft.Network/subnets",
	ShortResourceName: "SNET",
}
View Source
var AzureResourceTypeVM = ResourceType{
	ResourceString:    "Microsoft.Compute/virtualMachines",
	ShortResourceName: "VM  ",
}
View Source
var AzureResourceTypeVNET = ResourceType{
	ResourceString:    "Microsoft.Network/virtualNetworks",
	ShortResourceName: "VNET",
}
View Source
var AzureSkippedResourceTypes = []string{
	"Microsoft.Compute/virtualMachines/extensions",
}
View Source
var GCPResourceTypeDisk = ResourceType{
	ResourceString:    "compute.googleapis.com/Disk",
	ShortResourceName: "DISK",
}
View Source
var GCPResourceTypeFirewall = ResourceType{
	ResourceString:    "compute.googleapis.com/Firewall",
	ShortResourceName: "FW  ",
}
View Source
var GCPResourceTypeIAMPolicy = ResourceType{
	ResourceString:    "cloudresourcemanager.googleapis.com/IAMPolicy",
	ShortResourceName: "IAM ",
}
View Source
var GCPResourceTypeInstance = ResourceType{
	ResourceString:    "compute.googleapis.com/Instance",
	ShortResourceName: "VM  ",
}
View Source
var GCPResourceTypeProject = ResourceType{
	ResourceString:    "cloudresourcemanager.googleapis.com/Project",
	ShortResourceName: "PRJ ",
}
View Source
var GCPResourceTypeServiceAccount = ResourceType{
	ResourceString:    "iam.googleapis.com/ServiceAccount",
	ShortResourceName: "SA  ",
}
View Source
var GCPResourceTypeVPC = ResourceType{
	ResourceString:    "compute.googleapis.com/Network",
	ShortResourceName: "VPC ",
}
View Source
var SkippedResourceTypes = []string{

	"microsoft.compute/virtualmachines/extensions",

	"compute.v1.instanceGroupManager",
}

Functions

func CreateStateMessage

func CreateStateMessage(
	resource ResourceType,
	resourceState MachineResourceState,
	resourceName string,
) string

func CreateStateMessageWithText

func CreateStateMessageWithText(
	resource ResourceType,
	resourceState MachineResourceState,
	resourceName string,
	text string,
) string

func GetLocationFromResourceName

func GetLocationFromResourceName(id string) string

func GetMachineNameFromResourceName

func GetMachineNameFromResourceName(id string) string

Tests to see if the resource name is a machine ID. Returns the machine ID if it is.

func GetMachinesInLocation

func GetMachinesInLocation(resourceName string, machines map[string]Machiner) ([]string, error)

func GetProviderAbbreviation

func GetProviderAbbreviation(provider string) string

GetProviderAbbreviation returns the abbreviation for a given provider

func IsValidAWSResource added in v0.0.14

func IsValidAWSResource(resource string) bool

func IsValidAzureResource

func IsValidAzureResource(resource string) bool

func IsValidGCPResource

func IsValidGCPResource(resource string) bool

func IsValidLocation

func IsValidLocation(deploymentType DeploymentType, location string) bool

Add this new function

func MachineConfigToWrite

func MachineConfigToWrite(machine Machiner) map[string]interface{}

Types

type AWSConfig added in v0.0.20

type AWSConfig struct {
	Region                string
	VPCID                 string
	SubnetID              string
	DefaultRegion         string
	DefaultMachineType    string
	DefaultDiskSizeGB     int32
	DefaultCountPerRegion int
}

type AWSResourceState added in v0.0.14

type AWSResourceState int
const (
	AWSResourceStateUnknown AWSResourceState = iota
	AWSResourceStatePending
	AWSResourceStateRunning
	AWSResourceStateShuttingDown
	AWSResourceStateTerminated
	AWSResourceStateStopping
	AWSResourceStateStopped
)

func ConvertFromStringToAWSResourceState added in v0.0.14

func ConvertFromStringToAWSResourceState(s string) AWSResourceState

type AzureConfig

type AzureConfig struct {
	ResourceGroupName     string
	ResourceGroupLocation string
	SubscriptionID        string
	DefaultVMSize         string
	DefaultDiskSizeGB     int32
	DefaultLocation       string
	Tags                  map[string]string
	DefaultCountPerZone   int
}

type AzureEvent

type AzureEvent struct {
	Type       string
	ResourceID string
	Message    string
}

type BacalhauSettings

type BacalhauSettings struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}

func ReadBacalhauSettingsFromViper

func ReadBacalhauSettingsFromViper() ([]BacalhauSettings, error)

type CloudSpecificInfo

type CloudSpecificInfo struct {
	// Azure specific
	ResourceGroupName string

	// GCP specific
	Zone string

	// Both GCP and AWS
	Region string

	// AWS specific
	SpotMarketOptions *ec2Types.InstanceMarketOptionsRequest
}

type ClusterDetails

type ClusterDetails struct {
	Name              string
	DeploymentType    DeploymentType
	KubernetesVersion string
	NodeCount         int
	NodeTypes         []string
}

ClusterDetails represents the details of a cluster

type Deployment

type Deployment struct {
	Name           string
	ViperPath      string
	DeploymentType DeploymentType
	Azure          *AzureConfig
	GCP            *GCPConfig
	AWS            *AWSConfig
	Machines       map[string]Machiner
	UniqueID       string
	StartTime      time.Time
	EndTime        time.Time

	Locations              []string
	AllowedPorts           []int
	SSHUser                string
	SSHPort                int
	SSHPublicKeyPath       string
	SSHPublicKeyMaterial   string
	SSHPrivateKeyPath      string
	SSHPrivateKeyMaterial  string
	OrchestratorIP         string
	Tags                   map[string]string
	ProjectServiceAccounts map[string]ServiceAccountInfo

	BacalhauSettings []BacalhauSettings
	CustomScriptPath string
	// contains filtered or unexported fields
}

func NewDeployment

func NewDeployment() (*Deployment, error)

func (*Deployment) CreateMachine

func (d *Deployment) CreateMachine(name string, machine Machiner)

func (*Deployment) GetCloudConfig

func (d *Deployment) GetCloudConfig(cloudType DeploymentType) interface{}

func (*Deployment) GetCloudResources

func (d *Deployment) GetCloudResources(cloudType DeploymentType) interface{}

func (*Deployment) GetMachine

func (d *Deployment) GetMachine(name string) Machiner

func (*Deployment) GetMachines

func (d *Deployment) GetMachines() map[string]Machiner

func (*Deployment) GetProjectID

func (d *Deployment) GetProjectID() string

func (*Deployment) SetLocations

func (d *Deployment) SetLocations(locations map[string]bool)

func (*Deployment) SetMachine

func (d *Deployment) SetMachine(name string, machine Machiner)

func (*Deployment) SetMachines

func (d *Deployment) SetMachines(machines map[string]Machiner)

func (*Deployment) SetProjectID

func (d *Deployment) SetProjectID(projectID string)

func (*Deployment) ToMap

func (d *Deployment) ToMap() map[string]interface{}

func (*Deployment) UpdateMachine

func (d *Deployment) UpdateMachine(name string, updater func(Machiner)) error

func (*Deployment) UpdateViperConfig

func (d *Deployment) UpdateViperConfig() error

type DeploymentStatus

type DeploymentStatus string
const (
	DeploymentStatusUnknown    DeploymentStatus = "Unknown"
	DeploymentStatusNotStarted DeploymentStatus = "NotStarted"
	DeploymentStatusInProgress DeploymentStatus = "InProgress"
	DeploymentStatusSucceeded  DeploymentStatus = "Succeeded"
	DeploymentStatusFailed     DeploymentStatus = "Failed"
)

type DeploymentType

type DeploymentType string
const (
	DeploymentTypeUnknown DeploymentType = "Unknown"
	DeploymentTypeAzure   DeploymentType = "Azure"
	DeploymentTypeAWS     DeploymentType = "AWS"
	DeploymentTypeGCP     DeploymentType = "GCP"
)

type Disk

type Disk struct {
	Name   string
	ID     string
	SizeGB int32
	State  armcompute.DiskState
}

type DisplayStatus

type DisplayStatus struct {
	ID              string
	Type            ResourceType
	Location        string
	StatusMessage   string
	DetailedStatus  string
	ElapsedTime     time.Duration
	StartTime       time.Time
	InstanceID      string
	PublicIP        string
	PrivateIP       string
	HighlightCycles int
	Name            string
	Progress        int
	Orchestrator    bool
	SSH             ServiceState
	Docker          ServiceState
	CorePackages    ServiceState
	Bacalhau        ServiceState
	CustomScript    ServiceState
	StageComplete   bool
}

func ConvertFromRawResourceToStatus

func ConvertFromRawResourceToStatus(
	resourceMap map[string]interface{},
	deployment *Deployment,
) ([]DisplayStatus, error)

func NewDisplayStatus

func NewDisplayStatus(
	machineName string,
	resourceID string,
	resourceType ResourceType,
	state MachineResourceState,
) *DisplayStatus

NewDisplayStatus creates a new DisplayStatus - machineName is the name of the machine (the start of the row - should be unique, something like ABCDEF-vm) - resourceID is the name of the resource (the end of the row - should be unique, something like ABCDEF-vm-nic or centralus-vnet) - resourceType is the type of the resource (e.g. AzureResourceTypeNIC) - state is the state of the resource (e.g. AzureResourceStateSucceeded)

func NewDisplayStatusWithText

func NewDisplayStatusWithText(
	resourceID string,
	resourceType ResourceType,
	state MachineResourceState,
	text string,
) *DisplayStatus

func NewDisplayVMStatus

func NewDisplayVMStatus(
	machineName string,
	state MachineResourceState,
) *DisplayStatus

NewDisplayVMStatus creates a new DisplayStatus for a VM - machineName is the name of the machine (the start of the row - should be unique, something like ABCDEF-vm) - resourceType is the type of the resource (e.g. AzureResourceTypeNIC) - state is the state of the resource (e.g. AzureResourceStateSucceeded)

func UpdateOnlyChangedStatus

func UpdateOnlyChangedStatus(
	status *DisplayStatus,
	newStatus *DisplayStatus,
) *DisplayStatus

type GCPConfig

type GCPConfig struct {
	ProjectID              string
	OrganizationID         string
	DefaultRegion          string
	DefaultZone            string
	DefaultMachineType     string
	DefaultDiskSizeGB      int32
	BillingAccountID       string
	ServiceAccountEmail    string
	ProjectServiceAccounts map[string]ServiceAccountInfo
	Tags                   map[string]string
	DefaultCountPerZone    int
}

type GCPResourceState

type GCPResourceState int
const (
	GCPResourceStateUnknown GCPResourceState = iota
	GCPResourceStateProvisioning
	GCPResourceStateRunning
	GCPResourceStateStopping
	GCPResourceStateRepairing
	GCPResourceStateTerminated
	GCPResourceStateSuspended
)

func ConvertFromStringToGCPResourceState

func ConvertFromStringToGCPResourceState(s string) GCPResourceState

type Machine

type Machine struct {
	ID       string
	Name     string
	Type     ResourceType
	Location string
	Region   string
	Zone     string
	NodeType string

	StatusMessage string
	Parameters    Parameters
	PublicIP      string
	PrivateIP     string
	StartTime     time.Time
	Failed        bool

	VMSize          string
	DiskSizeGB      int
	DiskImageFamily string
	DiskImageURL    string
	ImageID         string
	ElapsedTime     time.Duration
	Orchestrator    bool
	OrchestratorIP  string

	SSHUser               string
	SSHPrivateKeyMaterial []byte
	SSHPrivateKeyPath     string
	SSHPublicKeyMaterial  []byte
	SSHPublicKeyPath      string
	SSHPort               int

	CreationStartTime time.Time
	CreationEndTime   time.Time
	SSHStartTime      time.Time
	SSHEndTime        time.Time
	DockerStartTime   time.Time
	DockerEndTime     time.Time
	BacalhauStartTime time.Time
	BacalhauEndTime   time.Time
	DeploymentEndTime time.Time

	CustomScriptExecuted bool

	DeploymentType DeploymentType
	CloudProvider  DeploymentType
	CloudSpecific  CloudSpecificInfo
	// contains filtered or unexported fields
}

func (*Machine) BacalhauEnabled

func (mach *Machine) BacalhauEnabled() bool

func (*Machine) CloudType

func (mach *Machine) CloudType() DeploymentType

CloudType returns the cloud provider type for this machine

func (*Machine) Complete

func (mach *Machine) Complete() bool

func (*Machine) CustomScriptEnabled

func (mach *Machine) CustomScriptEnabled() bool

func (*Machine) DockerEnabled

func (mach *Machine) DockerEnabled() bool

func (*Machine) EnsureMachineServices

func (mach *Machine) EnsureMachineServices() error

func (*Machine) GetDeploymentEndTime

func (mach *Machine) GetDeploymentEndTime() time.Time

func (*Machine) GetDiskImageFamily

func (mach *Machine) GetDiskImageFamily() string

func (*Machine) GetDiskImageURL

func (mach *Machine) GetDiskImageURL() string

func (*Machine) GetDiskSizeGB

func (mach *Machine) GetDiskSizeGB() int

func (*Machine) GetElapsedTime

func (mach *Machine) GetElapsedTime() time.Duration

func (*Machine) GetID

func (mach *Machine) GetID() string

func (*Machine) GetImageID added in v0.0.20

func (mach *Machine) GetImageID() string

func (*Machine) GetLocation

func (mach *Machine) GetLocation() string

func (*Machine) GetMachineResource

func (mach *Machine) GetMachineResource(resourceType string) MachineResource

func (*Machine) GetMachineResourceState

func (mach *Machine) GetMachineResourceState(resourceName string) MachineResourceState

func (*Machine) GetMachineResources

func (mach *Machine) GetMachineResources() map[string]MachineResource

func (*Machine) GetMachineServices

func (mach *Machine) GetMachineServices() map[string]ServiceType

Machine Services

func (*Machine) GetName

func (mach *Machine) GetName() string

func (*Machine) GetNodeType added in v0.0.5

func (mach *Machine) GetNodeType() string

func (*Machine) GetOrchestratorIP

func (mach *Machine) GetOrchestratorIP() string

func (*Machine) GetPrivateIP

func (mach *Machine) GetPrivateIP() string

func (*Machine) GetPublicIP

func (mach *Machine) GetPublicIP() string

func (*Machine) GetRegion

func (mach *Machine) GetRegion() string

func (*Machine) GetSSHPort

func (mach *Machine) GetSSHPort() int

func (*Machine) GetSSHPrivateKeyMaterial

func (mach *Machine) GetSSHPrivateKeyMaterial() []byte

func (*Machine) GetSSHPrivateKeyPath

func (mach *Machine) GetSSHPrivateKeyPath() string

func (*Machine) GetSSHPublicKeyMaterial

func (mach *Machine) GetSSHPublicKeyMaterial() []byte

func (*Machine) GetSSHPublicKeyPath

func (mach *Machine) GetSSHPublicKeyPath() string

func (*Machine) GetSSHUser

func (mach *Machine) GetSSHUser() string

func (*Machine) GetServiceState

func (mach *Machine) GetServiceState(serviceName string) ServiceState

func (*Machine) GetServices

func (mach *Machine) GetServices() map[string]ServiceType

Service management methods

func (*Machine) GetSpotMarketOptions added in v0.0.20

func (mach *Machine) GetSpotMarketOptions() *ec2Types.InstanceMarketOptionsRequest

func (*Machine) GetStartTime

func (mach *Machine) GetStartTime() time.Time

func (*Machine) GetStatusMessage

func (mach *Machine) GetStatusMessage() string

func (*Machine) GetType

func (mach *Machine) GetType() ResourceType

func (*Machine) GetVMCount

func (mach *Machine) GetVMCount() int

func (*Machine) GetVMSize

func (mach *Machine) GetVMSize() string

func (*Machine) GetZone

func (mach *Machine) GetZone() string

func (*Machine) InstallDockerAndCorePackages

func (mach *Machine) InstallDockerAndCorePackages(ctx context.Context) error

func (*Machine) IsComplete

func (mach *Machine) IsComplete() bool

func (*Machine) IsCustomScriptExecuted

func (mach *Machine) IsCustomScriptExecuted() bool

func (*Machine) IsFailed added in v0.0.20

func (mach *Machine) IsFailed() bool

func (*Machine) IsOrchestrator

func (mach *Machine) IsOrchestrator() bool

func (*Machine) LogTimingInfo

func (mach *Machine) LogTimingInfo(logger logger.Logger)

func (*Machine) ResourcesComplete

func (mach *Machine) ResourcesComplete() (int, int)

func (*Machine) SSHEnabled

func (mach *Machine) SSHEnabled() bool

func (*Machine) ServicesComplete

func (mach *Machine) ServicesComplete() (int, int)

func (*Machine) SetComplete

func (mach *Machine) SetComplete()

func (*Machine) SetCustomScriptExecuted

func (mach *Machine) SetCustomScriptExecuted(executed bool)

func (*Machine) SetDeploymentEndTime

func (mach *Machine) SetDeploymentEndTime(endTime time.Time)

func (*Machine) SetDiskImageFamily

func (mach *Machine) SetDiskImageFamily(family string)

func (*Machine) SetDiskImageURL

func (mach *Machine) SetDiskImageURL(url string)

func (*Machine) SetDiskSizeGB

func (mach *Machine) SetDiskSizeGB(size int)

func (*Machine) SetElapsedTime

func (mach *Machine) SetElapsedTime(elapsedTime time.Duration)

func (*Machine) SetFailed added in v0.0.20

func (mach *Machine) SetFailed(failed bool)

func (*Machine) SetImageID added in v0.0.20

func (mach *Machine) SetImageID(imageID string)

func (*Machine) SetLocation

func (mach *Machine) SetLocation(location string) error

func (*Machine) SetMachineResource

func (mach *Machine) SetMachineResource(resourceType string, resourceState MachineResourceState)

func (*Machine) SetMachineResourceState

func (mach *Machine) SetMachineResourceState(resourceName string, state MachineResourceState)

func (*Machine) SetMachineServices

func (mach *Machine) SetMachineServices(services map[string]ServiceType)

func (*Machine) SetName

func (mach *Machine) SetName(name string)

func (*Machine) SetNodeType added in v0.0.5

func (mach *Machine) SetNodeType(nodeType string)

func (*Machine) SetOrchestrator

func (mach *Machine) SetOrchestrator(orchestrator bool)

func (*Machine) SetOrchestratorIP

func (mach *Machine) SetOrchestratorIP(ip string)

func (*Machine) SetPrivateIP

func (mach *Machine) SetPrivateIP(ip string)

func (*Machine) SetPublicIP

func (mach *Machine) SetPublicIP(ip string)

func (*Machine) SetSSHPort

func (mach *Machine) SetSSHPort(port int)

func (*Machine) SetSSHPrivateKeyMaterial

func (mach *Machine) SetSSHPrivateKeyMaterial(key []byte)

func (*Machine) SetSSHPrivateKeyPath

func (mach *Machine) SetSSHPrivateKeyPath(path string)

func (*Machine) SetSSHPublicKeyMaterial

func (mach *Machine) SetSSHPublicKeyMaterial(key []byte)

func (*Machine) SetSSHPublicKeyPath

func (mach *Machine) SetSSHPublicKeyPath(path string)

func (*Machine) SetSSHUser

func (mach *Machine) SetSSHUser(user string)

func (*Machine) SetServiceState

func (mach *Machine) SetServiceState(serviceName string, state ServiceState)

func (*Machine) SetSpotMarketOptions added in v0.0.20

func (mach *Machine) SetSpotMarketOptions(options *ec2Types.InstanceMarketOptionsRequest)

func (*Machine) SetStartTime

func (mach *Machine) SetStartTime(startTime time.Time)

func (*Machine) SetStatusMessage

func (mach *Machine) SetStatusMessage(message string)

type MachineResource

type MachineResource struct {
	ResourceName  string
	ResourceType  ResourceType
	ResourceState MachineResourceState
	ResourceValue string
}

type MachineResourceState

type MachineResourceState int
const (
	ResourceStateUnknown MachineResourceState = iota
	ResourceStateNotStarted
	ResourceStatePending
	ResourceStateRunning
	ResourceStateSucceeded
	ResourceStateStopping
	ResourceStateFailed
	ResourceStateTerminated
)

func ConvertFromAzureStringToResourceState

func ConvertFromAzureStringToResourceState(s string) MachineResourceState

type Machiner

type Machiner interface {
	// Basic information
	GetID() string
	GetName() string
	SetName(string)
	GetType() ResourceType
	GetVMSize() string
	GetDiskSizeGB() int
	SetDiskSizeGB(size int)
	IsFailed() bool
	SetFailed(bool)
	GetDiskImageFamily() string
	SetDiskImageFamily(family string)
	GetDiskImageURL() string
	SetDiskImageURL(url string)
	GetImageID() string
	SetImageID(id string)
	GetLocation() string
	SetLocation(location string) error
	GetRegion() string
	GetZone() string
	GetPublicIP() string
	SetPublicIP(ip string)
	GetPrivateIP() string
	SetPrivateIP(ip string)

	// AWS Spot Market Options
	GetSpotMarketOptions() *ec2Types.InstanceMarketOptionsRequest
	SetSpotMarketOptions(options *ec2Types.InstanceMarketOptionsRequest)

	// SSH related
	GetSSHUser() string
	SetSSHUser(user string)
	GetSSHPublicKeyMaterial() []byte
	SetSSHPublicKeyMaterial([]byte)
	GetSSHPublicKeyPath() string
	SetSSHPublicKeyPath(path string)
	GetSSHPrivateKeyMaterial() []byte
	SetSSHPrivateKeyMaterial([]byte)
	GetSSHPrivateKeyPath() string
	SetSSHPrivateKeyPath(path string)
	GetSSHPort() int
	SetSSHPort(port int)

	// Status and state
	GetNodeType() string
	SetNodeType(nodeType string)
	IsOrchestrator() bool
	SetOrchestrator(orchestrator bool)
	IsComplete() bool
	SetComplete()
	GetOrchestratorIP() string
	SetOrchestratorIP(ip string)
	GetStatusMessage() string
	SetStatusMessage(message string)

	// Resource management
	GetMachineResource(resourceType string) MachineResource
	SetMachineResource(resourceType string, resourceState MachineResourceState)
	GetMachineResources() map[string]MachineResource
	GetMachineResourceState(resourceName string) MachineResourceState
	SetMachineResourceState(resourceName string, state MachineResourceState)
	ResourcesComplete() (int, int)

	// Service management
	GetServices() map[string]ServiceType
	GetServiceState(serviceName string) ServiceState
	SetServiceState(serviceName string, state ServiceState)
	SSHEnabled() bool
	DockerEnabled() bool
	BacalhauEnabled() bool
	CustomScriptEnabled() bool
	EnsureMachineServices() error
	ServicesComplete() (int, int)

	// Installation methods
	InstallDockerAndCorePackages(ctx context.Context) error

	// Cloud provider
	CloudType() DeploymentType

	// Timing information
	GetStartTime() time.Time
	SetStartTime(startTime time.Time)
	GetDeploymentEndTime() time.Time
	SetDeploymentEndTime(endTime time.Time)
	GetElapsedTime() time.Duration
	SetElapsedTime(elapsedTime time.Duration)

	// Logging
	LogTimingInfo(logger logger.Logger)
}

func NewMachine

func NewMachine(
	cloudProvider DeploymentType,
	location string,
	vmSize string,
	diskSizeGB int,
	cloudSpecificInfo CloudSpecificInfo,
) (Machiner, error)

type NodeInfo added in v0.0.20

type NodeInfo struct {
	Name              string `yaml:"name"`
	NodeIP            string `yaml:"node_ip"`
	OrchestratorIP    string `yaml:"orchestrator_ip,omitempty"`
	DockerInstalled   bool   `yaml:"docker_installed"`
	BacalhauInstalled bool   `yaml:"bacalhau_installed"`
	CustomScript      bool   `yaml:"custom_script_installed"`
	SSHUsername       string `yaml:"ssh_username"`
	SSHKeyPath        string `yaml:"ssh_key_path"`
}

NodeInfo represents the deployment information for a single node

func (*NodeInfo) Validate added in v0.0.20

func (n *NodeInfo) Validate() error

Validate checks if the node information is valid

type NodeInfoList added in v0.0.20

type NodeInfoList struct {
	Nodes []NodeInfo `yaml:"nodes"`
}

NodeInfoList represents a collection of node information

type NodeStore added in v0.0.20

type NodeStore struct {
	// contains filtered or unexported fields
}

NodeStore handles persistent storage of node information

func NewNodeStore added in v0.0.20

func NewNodeStore(filepath string) *NodeStore

NewNodeStore creates a new NodeStore instance

func (*NodeStore) AddNode added in v0.0.20

func (s *NodeStore) AddNode(node NodeInfo) error

AddNode adds a new node to the store

func (*NodeStore) GetNodes added in v0.0.20

func (s *NodeStore) GetNodes() ([]NodeInfo, error)

GetNodes returns all stored nodes

type Parameters

type Parameters struct {
	Count        int
	Type         string
	Orchestrator bool
}

type ProviderAbbreviation

type ProviderAbbreviation string
const (
	ProviderAbbreviationAzure   ProviderAbbreviation = "AZU"
	ProviderAbbreviationAWS     ProviderAbbreviation = "AWS"
	ProviderAbbreviationGCP     ProviderAbbreviation = "GCP"
	ProviderAbbreviationVirtual ProviderAbbreviation = "VIR"
	ProviderAbbreviationUnknown ProviderAbbreviation = "UNK"
)

type ProvisionProgress added in v0.0.20

type ProvisionProgress struct {
	CurrentStep    *ProvisionStep
	CompletedSteps []*ProvisionStep
	TotalSteps     int
	// contains filtered or unexported fields
}

ProvisionProgress tracks the overall provisioning progress

func NewProvisionProgress added in v0.0.20

func NewProvisionProgress() *ProvisionProgress

NewProvisionProgress creates a new progress tracker

func (*ProvisionProgress) AddStep added in v0.0.20

func (p *ProvisionProgress) AddStep(step *ProvisionStep)

AddStep adds a completed step to the progress

func (*ProvisionProgress) GetProgress added in v0.0.20

func (p *ProvisionProgress) GetProgress() float64

func (*ProvisionProgress) SetCurrentStep added in v0.0.20

func (p *ProvisionProgress) SetCurrentStep(step *ProvisionStep)

SetCurrentStep updates the current step being executed

type ProvisionStep added in v0.0.20

type ProvisionStep struct {
	Name        string
	Description string
	Status      string
	Error       error
}

ProvisionStep represents a single step in the provisioning process

type ProvisionStepStatus added in v0.0.20

type ProvisionStepStatus string

ProvisionStepStatus represents the status of a provisioning step

const (
	ProvisionStepStatusPending   ProvisionStepStatus = "PENDING"
	ProvisionStepStatusRunning   ProvisionStepStatus = "RUNNING"
	ProvisionStepStatusCompleted ProvisionStepStatus = "COMPLETED"
	ProvisionStepStatusFailed    ProvisionStepStatus = "FAILED"
)

type ResourceType

type ResourceType struct {
	ResourceString    string
	ShortResourceName string
}

func GetAWSResourceType added in v0.0.14

func GetAWSResourceType(resource string) ResourceType

func GetAllAWSResources added in v0.0.14

func GetAllAWSResources() []ResourceType

func GetAllAzureResources

func GetAllAzureResources() []ResourceType

func GetAllGCPResources

func GetAllGCPResources() []ResourceType

func GetAzureResourceType

func GetAzureResourceType(resource string) ResourceType

func GetGCPResourceType

func GetGCPResourceType(resource string) ResourceType

func (*ResourceType) GetResourceLowerString

func (a *ResourceType) GetResourceLowerString() string

func (*ResourceType) GetResourceString

func (a *ResourceType) GetResourceString() string

func (*ResourceType) GetShortResourceName

func (a *ResourceType) GetShortResourceName() string

type ServiceAccountInfo

type ServiceAccountInfo struct {
	Email string
	Key   string
}

type ServiceState

type ServiceState int
const (
	ServiceStateNotStarted ServiceState = iota
	ServiceStateCreated
	ServiceStateUpdating
	ServiceStateSucceeded
	ServiceStateFailed
	ServiceStateUnknown
)

type ServiceType

type ServiceType struct {
	Name  string
	State ServiceState
}

type StatusCode

type StatusCode string

StatusCode represents the possible status codes

const (
	StatusSucceeded StatusCode = "✅"
	StatusFailed    StatusCode = "❌"
	StatusCreating  StatusCode = "🕕"
	StatusUpdating  StatusCode = "🆙"
	StatusDeleting  StatusCode = "␡"
	StatusUnknown   StatusCode = "❓"
)

Constants for each status code

const (
	StatusCodeNotStarted StatusCode = "NotStarted"
	StatusCodeSucceeded  StatusCode = "Succeeded"
	StatusCodeFailed     StatusCode = "Failed"
	StatusCodeInProgress StatusCode = "InProgress"
	StatusCodeUnknown    StatusCode = "Unknown"
)

type StatusUpdateMsg

type StatusUpdateMsg struct {
	Status *DisplayStatus
}

type TimeUpdateMsg

type TimeUpdateMsg struct{}

Directories

Path Synopsis
interfaces
aws
gcp

Jump to

Keyboard shortcuts

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