cluster

package
v0.0.0-...-e391bab Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const HostnameSeparator = '.'

Variables

View Source
var (

	// Errors types returned by the Exec function on the client interface
	ErrExec                        = errors.New("remote command execute error")
	ErrExecNoServiceWithName       = fmt.Errorf("%w: no such service exists with that name", ErrExec)
	ErrExecServiceNotRunning       = fmt.Errorf("%w: service with that name is not running", ErrExec)
	ErrExecCommandExecutionFailed  = fmt.Errorf("%w: command execution failed", ErrExec)
	ErrExecCommandDoesNotExist     = fmt.Errorf("%w: command could not be executed because it does not exist", ErrExec)
	ErrExecDeploymentNotYetRunning = fmt.Errorf("%w: deployment is not yet active", ErrExec)
	ErrExecMultiplePods            = fmt.Errorf("%w: cannot execute without specifying a pod explicitly", ErrExec)
	ErrExecPodIndexOutOfRange      = fmt.Errorf("%w: pod index out of range", ErrExec)
)
View Source
var (

	// ErrInsufficientCapacity is the new error when capacity is insufficient
	ErrInsufficientCapacity = errors.New("insufficient capacity")
)
View Source
var ErrNotRunning = errors.New("not running")

ErrNotRunning is the error when service is not running

Functions

func ErrorIsOkToSendToClient

func ErrorIsOkToSendToClient(err error) bool

func NewNode

func NewNode(id string, allocateable atypes.ResourceUnits, available atypes.ResourceUnits) ctypes.Node

NewNode returns new Node instance with provided details

func NewServiceLog

func NewServiceLog(name string, stream io.ReadCloser) *ctypes.ServiceLog

NewServiceLog creates and returns a service log with provided details

Types

type Client

type Client interface {
	ReadClient
	Deploy(context.Context, mtypes.LeaseID, *manifest.Group) error
	TeardownLease(context.Context, mtypes.LeaseID) error
	Deployments(context.Context) ([]ctypes.Deployment, error)
	Inventory(context.Context) ([]ctypes.Node, error)
	Exec(ctx context.Context,
		lID mtypes.LeaseID,
		service string,
		podIndex uint,
		cmd []string,
		stdin io.Reader,
		stdout io.Writer,
		stderr io.Writer,
		tty bool,
		tsq remotecommand.TerminalSizeQueue) (ctypes.ExecResult, error)
}

Client interface lease and deployment methods

func NullClient

func NullClient() Client

NullClient returns nullClient instance

type Cluster

type Cluster interface {
	Reserve(mtypes.OrderID, atypes.ResourceGroup) (ctypes.Reservation, error)
	Unreserve(mtypes.OrderID) error
}

Cluster is the interface that wraps Reserve and Unreserve methods

type Config

type Config struct {
	InventoryResourcePollPeriod     time.Duration
	InventoryResourceDebugFrequency uint
	InventoryExternalPortQuantity   uint
	CPUCommitLevel                  float64
	MemoryCommitLevel               float64
	StorageCommitLevel              float64
	BlockedHostnames                []string
}

func NewDefaultConfig

func NewDefaultConfig() Config

type HostnameServiceClient

type HostnameServiceClient interface {
	ReserveHostnames(hostnames []string, did dtypes.DeploymentID) <-chan error
	ReleaseHostnames(hostnames []string)
	CanReserveHostnames(hostnames []string, did dtypes.DeploymentID) <-chan error
}

type Service

type Service interface {
	StatusClient
	Cluster
	Close() error
	Ready() <-chan struct{}
	Done() <-chan struct{}
	HostnameService() HostnameServiceClient
}

Service manage compute cluster for the provider. Will eventually integrate with kubernetes, etc...

func NewService

func NewService(ctx context.Context, session session.Session, bus pubsub.Bus, client Client, cfg Config) (Service, error)

NewService returns new Service instance

type SimpleHostnames

type SimpleHostnames struct {
	Hostnames map[string]dtypes.DeploymentID
	// contains filtered or unexported fields

} /* Used in test code */

func (*SimpleHostnames) CanReserveHostnames

func (sh *SimpleHostnames) CanReserveHostnames(hostnames []string, did dtypes.DeploymentID) <-chan error

func (*SimpleHostnames) ReleaseHostnames

func (sh *SimpleHostnames) ReleaseHostnames(hostnames []string)

func (*SimpleHostnames) ReserveHostnames

func (sh *SimpleHostnames) ReserveHostnames(hostnames []string, did dtypes.DeploymentID) <-chan error

type StatusClient

type StatusClient interface {
	Status(context.Context) (*ctypes.Status, error)
}

StatusClient is the interface which includes status of service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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