cellprovider

package
v0.0.0-...-aa36cb2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: AGPL-3.0 Imports: 79 Imported by: 0

Documentation

Overview

package cellprovider contains logic to create and manage groups of servers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvanceDeploymentResult

type AdvanceDeploymentResult struct {
	Status       store.DeploymentStatus
	StatusReason string
}

type BuildImageOptions

type BuildImageOptions struct {
	// CellId is the id of the cell to build the image on.
	CellId string `validate:"required"`
	// BuildDir is the directory containing the build context. This is where docker commands will be run.
	BuildDir string `validate:"required"`
	// AppName is the name of the application to build
	AppName string `validate:"required"`
	// BuildId is the id of the build
	BuildId string `validate:"required"`
	// Stderr is the writer to write stderr output to (the build process will exec some docker commands).
	Stderr io.Writer
	// Stdout is the writer to write stdout output to (the build process will exec some docker commands).
	Stdout io.Writer
}

type BuildxBuilder

type BuildxBuilder struct {
	Name         string
	Driver       string
	LastActivity time.Time `json:",omitempty"`
	Dynamic      bool
	Nodes        []BuildxNode
}

BuildxBuilder is the output of docker buildx ls --format json. If the Builder type in github.com/docker/buildx/builder adds an unmarshaljson method, we can remove this.

type BuildxNode

type BuildxNode struct {
	Name      string
	Endpoint  string
	Status    string
	Version   string
	Platforms []string
}

type CellProvider

type CellProvider interface {
	CreateCell(ctx context.Context, opts CreateCellOptions) (*store.Cell, error)
	Janitor(ctx context.Context, cellId string) 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
	BuildImage(ctx context.Context, opts BuildImageOptions) (*store.ImageArtifact, error)
}

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 {
	Annotations map[string]string
	Logs        []LogEntry
	Error       error
}

type ErrDeploymentIdMismatch

type ErrDeploymentIdMismatch struct {
	ExpectedId uint
	FoundId    uint
}

func (ErrDeploymentIdMismatch) Error

func (e ErrDeploymentIdMismatch) Error() string

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

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

func (p *TalosClusterCellProvider) Janitor(ctx context.Context, cellId string) 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 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