Documentation
¶
Index ¶
- Constants
- Variables
- type Orchestrator
- func (o *Orchestrator) AdminNodeDetail(clusterID uuid.UUID, nodeID string) (*api.NodeDetail, error)
- func (o *Orchestrator) AdminNodes(clusterID uuid.UUID) ([]*api.Node, error)
- func (o *Orchestrator) CheckpointSandbox(ctx context.Context, teamID uuid.UUID, sandboxID string) error
- func (o *Orchestrator) Close(ctx context.Context) error
- func (o *Orchestrator) CreateSandbox(ctx context.Context, sandboxID, executionID string, team *teamtypes.Team, ...) (sbx sandbox.Sandbox, apiErr *api.APIError)
- func (o *Orchestrator) CreateSnapshotTemplate(ctx context.Context, teamID uuid.UUID, sandboxID string, ...) (result SnapshotTemplateResult, e error)
- func (o *Orchestrator) GetClusterNodes(clusterID uuid.UUID) []*nodemanager.Node
- func (o *Orchestrator) GetNode(clusterID uuid.UUID, nodeID string) *nodemanager.Node
- func (o *Orchestrator) GetNodeByWorkloadID(id string) *nodemanager.Nodedeprecated
- func (o *Orchestrator) GetNodeRouteIPAddress(clusterID uuid.UUID, nodeID string) string
- func (o *Orchestrator) GetSandbox(ctx context.Context, teamID uuid.UUID, sandboxID string) (sandbox.Sandbox, error)
- func (o *Orchestrator) GetSandboxes(ctx context.Context, teamID uuid.UUID, states []sandbox.State) ([]sandbox.Sandbox, error)
- func (o *Orchestrator) HandleExistingSandboxAutoResume(ctx context.Context, teamID uuid.UUID, sandboxID string, ...) (string, bool, error)
- func (o *Orchestrator) KeepAliveFor(ctx context.Context, teamID uuid.UUID, sandboxID string, ...) (*sandbox.Sandbox, *api.APIError)
- func (o *Orchestrator) NodeCount() int
- func (o *Orchestrator) RemoveSandbox(ctx context.Context, teamID uuid.UUID, sandboxID string, ...) error
- func (o *Orchestrator) TeamRunningSandboxCounts(ctx context.Context) (map[uuid.UUID]int64, error)
- func (o *Orchestrator) UpdateSandbox(ctx context.Context, sandboxID string, endTime time.Time, clusterID uuid.UUID, ...) error
- func (o *Orchestrator) UpdateSandboxNetworkConfig(ctx context.Context, teamID uuid.UUID, sandboxID string, ...) *api.APIError
- func (o *Orchestrator) WaitForStateChange(ctx context.Context, teamID uuid.UUID, sandboxID string) error
- type PauseQueueExhaustedError
- type SandboxDataFetcher
- type SandboxMetadata
- type SnapshotCacheInvalidator
- type SnapshotTemplateOpts
- type SnapshotTemplateResult
Constants ¶
const ( ErrCodeStartInFlight = "sandbox_start_in_flight" ErrCodeFilesystemBootUnconfirmed = "sandbox_filesystem_boot_unconfirmed" )
Semantic error codes for the explicit filesystem-boot (memory:false) path, emitted in APIError.ErrorCode so callers and metrics can distinguish these from ambient 4xx/5xx on the same routes.
const MaxAutoResumeTransitionRetries = 3
Variables ¶
var ( ErrSandboxNotFound = errors.New("sandbox not found") ErrAccessForbidden = errors.New("access forbidden") ErrSandboxOperationFailed = errors.New("sandbox operation failed") // ErrRefusedRouteLost: the node refused the pause retryably but the edge // could not put the sandbox's route back, so the sandbox cannot be kept. ErrRefusedRouteLost = errors.New("pause refused by the node and the edge could not restore its route") )
var ErrNodeNotFound = errors.New("node not found")
var ErrSandboxStillTransitioning = errors.New(sharedproxygrpc.SandboxStillTransitioningMessage)
var PlacementErrorCodes = []string{
errCodePlacementTimeout,
errCodeCapacityUnavailable,
errCodeNoCompatibleNode,
errCodeFeatureUnsupported,
errCodeSandboxCreateFailed,
errCodeInternalServer,
}
PlacementErrorCodes is every semantic error code placementAPIError can return.
Functions ¶
This section is empty.
Types ¶
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
func New ¶
func New( ctx context.Context, config cfg.Config, tel *telemetry.Client, nodeDiscovery servicediscovery.Discoverer, localRegistryOwnsOrchestrators bool, posthogClient *analyticscollector.PosthogClient, redisClient redis.UniversalClient, sqlcDB *sqlcdb.Client, clusters *clusters.Pool, featureFlags *featureflags.Client, accessTokenGenerator *sandbox.AccessTokenGenerator, snapshotCache SnapshotCacheInvalidator, snapshotUpsertSem *utils.AdjustableSemaphore, ) (*Orchestrator, error)
func (*Orchestrator) AdminNodeDetail ¶
func (o *Orchestrator) AdminNodeDetail(clusterID uuid.UUID, nodeID string) (*api.NodeDetail, error)
func (*Orchestrator) AdminNodes ¶
func (*Orchestrator) CheckpointSandbox ¶
func (o *Orchestrator) CheckpointSandbox(ctx context.Context, teamID uuid.UUID, sandboxID string) error
CheckpointSandbox snapshots a running sandbox in place: the sandbox is briefly paused on its node, snapshotted, and resumed under the same execution ID, so it keeps running with its ID, expiration, and reservation untouched. The snapshot is written to the sandbox's own snapshots row, so it can immediately be resumed or forked from.
func (*Orchestrator) CreateSandbox ¶
func (o *Orchestrator) CreateSandbox( ctx context.Context, sandboxID, executionID string, team *teamtypes.Team, getSandboxData SandboxDataFetcher, startTime time.Time, endTime time.Time, timeout time.Duration, isResume bool, demandFilesystemBoot bool, creationMeta sandbox.CreationMetadata, ) (sbx sandbox.Sandbox, apiErr *api.APIError)
func (*Orchestrator) CreateSnapshotTemplate ¶
func (o *Orchestrator) CreateSnapshotTemplate(ctx context.Context, teamID uuid.UUID, sandboxID string, opts SnapshotTemplateOpts) (result SnapshotTemplateResult, e error)
CreateSnapshotTemplate creates a persistent snapshot template from a running sandbox and immediately resumes it. The handler is responsible for parsing the name, resolving aliases via the cache, and populating opts.
func (*Orchestrator) GetClusterNodes ¶
func (o *Orchestrator) GetClusterNodes(clusterID uuid.UUID) []*nodemanager.Node
func (*Orchestrator) GetNode ¶
func (o *Orchestrator) GetNode(clusterID uuid.UUID, nodeID string) *nodemanager.Node
func (*Orchestrator) GetNodeByWorkloadID
deprecated
func (o *Orchestrator) GetNodeByWorkloadID(id string) *nodemanager.Node
Deprecated: use GetNode instead
func (*Orchestrator) GetNodeRouteIPAddress ¶
func (o *Orchestrator) GetNodeRouteIPAddress(clusterID uuid.UUID, nodeID string) string
func (*Orchestrator) GetSandbox ¶
func (*Orchestrator) GetSandboxes ¶
func (o *Orchestrator) GetSandboxes(ctx context.Context, teamID uuid.UUID, states []sandbox.State) ([]sandbox.Sandbox, error)
GetSandboxes returns instances for a given team.
func (*Orchestrator) HandleExistingSandboxAutoResume ¶
func (*Orchestrator) KeepAliveFor ¶
func (*Orchestrator) NodeCount ¶
func (o *Orchestrator) NodeCount() int
func (*Orchestrator) RemoveSandbox ¶
func (o *Orchestrator) RemoveSandbox(ctx context.Context, teamID uuid.UUID, sandboxID string, opts sandbox.RemoveOpts) error
func (*Orchestrator) TeamRunningSandboxCounts ¶
func (*Orchestrator) UpdateSandbox ¶
func (*Orchestrator) UpdateSandboxNetworkConfig ¶
func (o *Orchestrator) UpdateSandboxNetworkConfig( ctx context.Context, teamID uuid.UUID, sandboxID string, allowedEntries []string, deniedEntries []string, rules map[string][]types.SandboxNetworkRule, allowInternetAccess *bool, egressProxy *sandbox_network.EgressProxyConfig, ) *api.APIError
func (*Orchestrator) WaitForStateChange ¶
type PauseQueueExhaustedError ¶
type PauseQueueExhaustedError = sandbox.PauseQueueExhaustedError
Defined in the sandbox package so the evictor can classify it without an import cycle.
type SandboxDataFetcher ¶
type SandboxDataFetcher func(ctx context.Context) (SandboxMetadata, *api.APIError)
SandboxDataFetcher is a callback that fetches sandbox metadata. It is called after the concurrency lock is acquired to ensure fresh data.
type SandboxMetadata ¶
type SandboxMetadata struct {
Metadata map[string]string
EnvVars map[string]string
Build queries.EnvBuild
AllowInternetAccess *bool
Network *types.SandboxNetworkConfig
Alias string
TemplateID string
BaseTemplateID string
AutoPause bool
// AutoPauseFilesystemOnly makes a timeout auto-pause take a filesystem-only
// snapshot instead of a full memory one. Only meaningful when AutoPause.
AutoPauseFilesystemOnly bool
AutoResume *types.SandboxAutoResumeConfig
VolumeMounts []*orchestrator.SandboxVolumeMount
EnvdAccessToken *string
// Iam records the sandbox workload identity configuration requested at create
// time. Nil means workload identity is disabled.
Iam *types.SandboxIam
NodeID *string
// SnapshotSandboxID is the sandbox ID the resume snapshot is stored under.
// It differs from the ID of the sandbox being started when forking.
SnapshotSandboxID string
// FilesystemBoot demands a cold boot of a memory-inclusive snapshot
// (explicit memory:false resume). Set only by the resume data fetchers;
// template creates and auto-resume never set it.
FilesystemBoot bool
// FilesystemOnlySnapshot marks a resume whose snapshot persists only the
// rootfs. Unlike FilesystemBoot it describes the stored artifact rather than
// the request, so every path that resumes such a snapshot sets it.
FilesystemOnlySnapshot bool
}
type SnapshotCacheInvalidator ¶
SnapshotCacheInvalidator invalidates cached snapshot entries.
type SnapshotTemplateOpts ¶
type SnapshotTemplateOpts struct {
// ExistingTemplateID is set when the alias resolved to an existing template owned by the team.
ExistingTemplateID *string
// Alias is the parsed alias name (without namespace). Set when a name was provided.
Alias *string
// Namespace is the team slug used for alias scoping. Set when a name was provided.
Namespace *string
// Tag is the build tag parsed from the name, defaults to "default".
Tag string
}