fleet

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fleet reconciles admitted Workspace demand with a bounded cloud fleet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AWSFleetIdentityEndpoint

func AWSFleetIdentityEndpoint(region string) (endpointURL, partition string, err error)

AWSFleetIdentityEndpoint keeps proof signing and verification on the same regional STS endpoint and ARN partition from the SDK's endpoint metadata.

func EnrollmentBinding

func EnrollmentBinding(request EnrollmentRequest) string

func LoadEnrollmentSigner

func LoadEnrollmentSigner(certificatePEM, keyPEM []byte) (*x509.Certificate, crypto.Signer, error)

func ValidEnrollmentEndpoint

func ValidEnrollmentEndpoint(raw string) bool

Types

type AWSCloud

type AWSCloud struct {
	AutoScaling  AutoScalingAPI
	EC2          EC2API
	GroupName    string
	MaximumNodes int
	FleetRef     string
	Database     *pgxpool.Pool
	Pool         string
}

func (AWSCloud) CleanupRetiredVolumes

func (cloud AWSCloud) CleanupRetiredVolumes(ctx context.Context) error

func (AWSCloud) ListNodes

func (cloud AWSCloud) ListNodes(ctx context.Context) ([]Node, error)

func (AWSCloud) SetDesired

func (cloud AWSCloud) SetDesired(ctx context.Context, count int) error

func (AWSCloud) Terminate

func (cloud AWSCloud) Terminate(ctx context.Context, node Node) error

type AWSIdentityVerifier

type AWSIdentityVerifier struct {
	AccountID        string
	RoleName         string
	Region           string
	Cloud            Cloud
	Client           *http.Client
	Now              func() time.Time
	EnrollmentWindow time.Duration
}

func (AWSIdentityVerifier) Verify

func (verifier AWSIdentityVerifier) Verify(ctx context.Context, enrollment EnrollmentRequest, binding string, existingKeyBound bool) error

existingKeyBound is supplied only after the authority has verified the instance's stored key binding. A request's renewal flag alone grants nothing.

type Cloud

type Cloud interface {
	ListNodes(context.Context) ([]Node, error)
	SetDesired(context.Context, int) error
	Terminate(context.Context, Node) error
}

type EC2API

type EC2API interface {
	DescribeInstances(context.Context, *ec2.DescribeInstancesInput, ...func(*ec2.Options)) (*ec2.DescribeInstancesOutput, error)
	DescribeVolumes(context.Context, *ec2.DescribeVolumesInput, ...func(*ec2.Options)) (*ec2.DescribeVolumesOutput, error)
	DeleteVolume(context.Context, *ec2.DeleteVolumeInput, ...func(*ec2.Options)) (*ec2.DeleteVolumeOutput, error)
}

type EnrollmentAuthority

type EnrollmentAuthority struct {
	Database           *pgxpool.Pool
	Pool               string
	Verifier           EnrollmentVerifier
	Gateway            GatewayIssuer
	CACertificate      *x509.Certificate
	CAKey              crypto.Signer
	CAPEM              string
	Lifetime           time.Duration
	RunnerEnvironment  string
	GatewayEnvironment string
	EgressContexts     string
	RegistryFiles      map[string]string
	Now                func() time.Time
}

func (EnrollmentAuthority) Enroll

func (EnrollmentAuthority) ServeHTTP

func (authority EnrollmentAuthority) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type EnrollmentRequest

type EnrollmentRequest struct {
	InstanceID       string `json:"instanceId"`
	Nonce            string `json:"nonce"`
	RunnerCSR        string `json:"runnerCsrPem"`
	GatewayCSR       string `json:"gatewayCsrPem"`
	IdentityProofURL string `json:"identityProofUrl"`
	Renew            bool   `json:"renew,omitempty"`
}

type EnrollmentResponse

type EnrollmentResponse struct {
	RunnerID           string            `json:"runnerId"`
	RunnerCertificate  string            `json:"runnerCertificatePem"`
	RunnerCA           string            `json:"runnerCertificateAuthorityPem"`
	GatewayCertificate string            `json:"gatewayCertificatePem"`
	GatewayCA          string            `json:"gatewayCertificateAuthorityPem"`
	ExpiresAt          time.Time         `json:"expiresAt"`
	RunnerEnvironment  string            `json:"runnerEnvironment"`
	GatewayEnvironment string            `json:"gatewayEnvironment"`
	EgressContexts     string            `json:"egressContexts"`
	RegistryFiles      map[string]string `json:"registryFiles"`
}

type EnrollmentVerifier

type EnrollmentVerifier interface {
	Verify(ctx context.Context, request EnrollmentRequest, binding string, existingKeyBound bool) error
}

type GatewayIssuer

type GatewayIssuer interface {
	Issue(context.Context, string, string, time.Duration) (string, string, error)
	Retire(context.Context, string) error
}

type HTTPControlPlane

type HTTPControlPlane struct {
	BaseURL string
	Token   string
	Pool    string
	Client  *http.Client
	Gateway GatewayIssuer
}

func (HTTPControlPlane) Archive

func (control HTTPControlPlane) Archive(ctx context.Context, workspace contracts.FleetWorkspace) error

func (HTTPControlPlane) Evacuate

func (control HTTPControlPlane) Evacuate(ctx context.Context, runner contracts.FleetRunner) error

func (HTTPControlPlane) Observe

func (HTTPControlPlane) Retire

func (control HTTPControlPlane) Retire(ctx context.Context, runner contracts.FleetRunner) error

type HTTPGatewayIssuer

type HTTPGatewayIssuer struct {
	BaseURL string
	Client  *http.Client
}

func (HTTPGatewayIssuer) Issue

func (issuer HTTPGatewayIssuer) Issue(ctx context.Context, id, csr string, lifetime time.Duration) (string, string, error)

func (HTTPGatewayIssuer) Retire

func (issuer HTTPGatewayIssuer) Retire(ctx context.Context, id string) error

type Manager

type Manager struct {
	Config  ManagerConfig
	Cloud   Cloud
	Control ControlPlane
}

func (Manager) Reconcile

func (manager Manager) Reconcile(ctx context.Context, now time.Time) (result ReconcileResult, reconcileErr error)

func (Manager) Validate

func (manager Manager) Validate() error

type ManagerConfig

type ManagerConfig struct {
	MinimumNodes           int
	MaximumNodes           int
	NodeVCPUCount          int64
	NodeMemoryBytes        int64
	NodeInstances          int64
	NodeWorkspaceBytes     int64
	ScaleInAfter           time.Duration
	MaximumArchivesPerPass int
	BootstrapTimeout       time.Duration
}

type Node

type Node struct {
	InstanceID string
	RunnerID   string
	CreatedAt  time.Time
	State      string
}

type ReconcileResult

type ReconcileResult struct {
	ObservedNodes int    `json:"observedNodes"`
	DesiredNodes  int    `json:"desiredNodes"`
	Action        string `json:"action"`
	RunnerID      string `json:"runnerId,omitempty"`
}

Jump to

Keyboard shortcuts

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