Documentation
¶
Index ¶
- Variables
- func CSIMount(ctx context.Context, sbx *agentsv1alpha1.Sandbox, driver string, ...) error
- func GetAccessToken(sbx metav1.Object) string
- func GetCsiMountExtensionRequest(s metav1.Object) ([]v1alpha1.CSIMountConfig, error)
- func GetInitRuntimeRequest(s metav1.Object) (*config.InitRuntimeOptions, error)
- func GetRuntimeURL(sbx *agentsv1alpha1.Sandbox) string
- func InitRuntime(ctx context.Context, sbx *agentsv1alpha1.Sandbox, ...) (time.Duration, error)
- func ProcessCSIMounts(ctx context.Context, sbx *agentsv1alpha1.Sandbox, opts config.CSIMountOptions) (time.Duration, error)
- func ResolveCSIMountFromAnnotation(ctx context.Context, obj metav1.Object, client client.Client, ...) (*config.CSIMountOptions, error)
- type RefreshFunc
- type RunCmdFuncArgs
- type RunCommandResult
Constants ¶
This section is empty.
Variables ¶
var AccessToken = "access-token"
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 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)