runtime

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AccessToken = "access-token"
View Source
var MountCommand = "/mnt/envd/sandbox-runtime-storage"

Functions

func CSIMount

func CSIMount(ctx context.Context, sbx *agentsv1alpha1.Sandbox, driver string, request string) error

CSIMount creates a dynamic mount point in Sandbox with `sandbox-storage` cli. It accepts the raw Sandbox API object to avoid circular dependency on the sandboxcr package.

NOTE: `sandbox-storage` cli should be injected with `sandbox-runtime` and will be replaced by a built-in service of `sandbox-runtime`.

func GetAccessToken

func GetAccessToken(sbx metav1.Object) string

func GetCsiMountExtensionRequest

func GetCsiMountExtensionRequest(s metav1.Object) ([]v1alpha1.CSIMountConfig, error)

func GetInitRuntimeRequest

func GetInitRuntimeRequest(s metav1.Object) (*config.InitRuntimeOptions, error)

GetInitRuntimeRequest parses init runtime configuration from object annotations.

func GetRuntimeURL

func GetRuntimeURL(sbx *agentsv1alpha1.Sandbox) string

func InitRuntime

func InitRuntime(ctx context.Context, sbx *agentsv1alpha1.Sandbox, opts config.InitRuntimeOptions, refreshFn RefreshFunc) (time.Duration, error)

InitRuntime sends an init request to the sandbox runtime sidecar. The sbx parameter is the raw Sandbox API object. When opts.SkipRefresh is false and refreshFn is provided, it will be called to get the latest sandbox state before each retry attempt.

func ProcessCSIMounts

func ProcessCSIMounts(ctx context.Context, sbx *agentsv1alpha1.Sandbox, opts config.CSIMountOptions) (time.Duration, error)

ProcessCSIMounts performs CSI volume mounting operations for all mount configurations concurrently. It uses opts.Concurrency to limit the number of concurrent mount goroutines. If Concurrency is 0 or negative, it defaults to config.DefaultCSIMountConcurrency. Returns the total duration spent on all mount operations and all encountered errors (joined via errors.Join).

func ResolveCSIMountFromAnnotation

func ResolveCSIMountFromAnnotation(ctx context.Context, obj metav1.Object, client client.Client, cache cache.Provider, storageRegistry storages.VolumeMountProviderRegistry) (*config.CSIMountOptions, error)

ResolveCSIMountFromAnnotation parses CSI mount config from sandbox annotation and resolves it into MountOptionList. Returns nil if no CSI mount annotation is present.

Types

type RefreshFunc

type RefreshFunc func(ctx context.Context) (*agentsv1alpha1.Sandbox, error)

RefreshFunc is a callback that refreshes the sandbox object to its latest state. It returns the updated sandbox object, allowing InitRuntime to use the latest annotations (e.g., runtime URL) without depending on the sandboxcr package.

type RunCmdFuncArgs

type RunCmdFuncArgs struct {
	Sbx           *agentsv1alpha1.Sandbox
	ProcessConfig *process.ProcessConfig
	Timeout       time.Duration
}

type RunCommandResult

type RunCommandResult struct {
	PID      uint32
	Stdout   []string
	Stderr   []string
	ExitCode int32
	Exited   bool
	Error    error
}

func RunCommandWithRuntime

func RunCommandWithRuntime(ctx context.Context, args RunCmdFuncArgs) (RunCommandResult, error)

Jump to

Keyboard shortcuts

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