cellprovider

package
v0.0.0-...-9c41032 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: AGPL-3.0 Imports: 53 Imported by: 0

Documentation

Overview

package cellprovider contains logic to create and manage groups of servers

Index

Constants

This section is empty.

Variables

View Source
var ErrDeploymentIdMismatch = errors.New("deployment id mismatch")

Functions

This section is empty.

Types

type AdvanceDeploymentResult

type AdvanceDeploymentResult struct {
	Status       store.DeploymentStatus
	StatusReason string
}

type CellProvider

type CellProvider interface {
	CreateCell(ctx context.Context, opts CreateCellOptions) (*store.Cell, error)
	ServerStats(ctx context.Context, cellId string) ([]ServerStats, error)
	ServerStatsStream(ctx context.Context, cellId string, interval time.Duration) <-chan ServerStatsResult
	AdvanceDeployment(ctx context.Context, cellId string, deployment *store.Deployment) (*AdvanceDeploymentResult, error)
	DestroyDeployments(ctx context.Context, cellId string, deployments []store.Deployment) error
	DeploymentLogs(ctx context.Context, cellId string, deployment *store.Deployment, opts ...DeploymentLogsOption) ([]LogEntry, error)
	DeploymentLogsStream(ctx context.Context, cellId string, deployment *store.Deployment, opts ...DeploymentLogsOption) <-chan DeploymentLogsResult
}

type CreateCellOptions

type CreateCellOptions struct {
	Name              string       `valid:"required, matches(^[a-z-]+$)"`
	TeamId            string       `valid:"required"`
	TeamName          string       `valid:"required"`
	TeamAgePrivateKey string       `valid:"required, matches(^AGE-SECRET-KEY.*$)"`
	DnsZoneId         string       `valid:"required"`
	FirstServer       store.Server `valid:"required"`
}

type DeploymentLogsOption

type DeploymentLogsOption func(*DeploymentLogsOptions)

DeploymentLogsOption is a function that modifies DeploymentLogsOptions

func WithSince

func WithSince(duration time.Duration) DeploymentLogsOption

WithSince sets the Since option for deployment logs

type DeploymentLogsOptions

type DeploymentLogsOptions struct {
	Since *time.Duration
}

DeploymentLogsOptions defines options for fetching deployment logs

type DeploymentLogsResult

type DeploymentLogsResult struct {
	Logs  []LogEntry
	Error error
}

type LogEntry

type LogEntry struct {
	Timestamp time.Time
	Message   string
}

type NodeInfo

type NodeInfo struct {
	Ipv4 string
	NodeLabelInfo
}

NodeInfo represents the information of a node including its external IP and labels.

type NodeLabelInfo

type NodeLabelInfo struct {
	ServerId     string
	CellName     string
	ProviderSlug string
}

type ServerStats

type ServerStats struct {
	ServerId          string
	ServerIpv4        string
	CpuUtilization    float64
	MemoryUtilization float64
}

type ServerStatsResult

type ServerStatsResult struct {
	Stats []ServerStats
	Error error
}

type TalosClusterCellProvider

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

TalosClusterCellProvider creates a talos k8s cluster using cloudflare for DNS

func (*TalosClusterCellProvider) AdvanceDeployment

func (p *TalosClusterCellProvider) AdvanceDeployment(ctx context.Context, cellId string, deployment *store.Deployment) (*AdvanceDeploymentResult, error)

func (*TalosClusterCellProvider) CreateCell

CreateCell for a talos cluster creates a single-node talos cluster.

func (*TalosClusterCellProvider) DeploymentLogs

func (p *TalosClusterCellProvider) DeploymentLogs(ctx context.Context, cellId string, deployment *store.Deployment, opts ...DeploymentLogsOption) ([]LogEntry, error)

func (*TalosClusterCellProvider) DeploymentLogsStream

func (p *TalosClusterCellProvider) DeploymentLogsStream(ctx context.Context, cellId string, deployment *store.Deployment, opts ...DeploymentLogsOption) <-chan DeploymentLogsResult

func (*TalosClusterCellProvider) DestroyDeployments

func (p *TalosClusterCellProvider) DestroyDeployments(ctx context.Context, cellId string, deployments []store.Deployment) error

func (*TalosClusterCellProvider) ServerStats

func (p *TalosClusterCellProvider) ServerStats(ctx context.Context, cellId string) ([]ServerStats, error)

func (*TalosClusterCellProvider) ServerStatsStream

func (p *TalosClusterCellProvider) ServerStatsStream(ctx context.Context, cellId string, interval time.Duration) <-chan ServerStatsResult

ServerStatsStream streams ServerStats at the specified interval

type TalosClusterCellProviderOption

type TalosClusterCellProviderOption func(*TalosClusterCellProvider)

func WithCellStore

func WithCellStore(cellStore store.CellStore) TalosClusterCellProviderOption

func WithLogger

func WithLogger(logger *slog.Logger) TalosClusterCellProviderOption

func WithServerStore

func WithServerStore(serverStore store.ServerStore) TalosClusterCellProviderOption

func WithTmpDirRoot

func WithTmpDirRoot(tmpDirRoot string) TalosClusterCellProviderOption

Jump to

Keyboard shortcuts

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