Documentation
¶
Overview ¶
Package kata provides a backend that executes code in Kata Containers. Provides VM-level isolation stronger than plain containers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKataNotAvailable is returned when Kata Containers is not available. ErrKataNotAvailable = errors.New("kata containers not available") // ErrVMCreationFailed is returned when VM creation fails. ErrVMCreationFailed = errors.New("vm creation failed") // ErrVMExecutionFailed is returned when VM execution fails. ErrVMExecutionFailed = errors.New("vm execution failed") // ErrClientNotConfigured is returned when no SandboxRunner is configured. ErrClientNotConfigured = errors.New("kata runner not configured") ErrDaemonUnavailable = errors.New("kata runtime unavailable") // ErrSecurityViolation is returned when a security policy is violated. ErrSecurityViolation = errors.New("security policy violation") )
Errors for Kata backend operations.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend executes code in Kata Containers for VM-level isolation.
func (*Backend) Execute ¶
func (b *Backend) Execute(ctx context.Context, req runtime.ExecuteRequest) (runtime.ExecuteResult, error)
Execute runs code in a Kata Container with VM-level isolation.
func (*Backend) Kind ¶
func (b *Backend) Kind() runtime.BackendKind
Kind returns the backend kind identifier.
type Config ¶
type Config struct {
// RuntimePath is the path to the kata-runtime binary.
// Default: kata-runtime (uses PATH)
RuntimePath string
// Image is the container image to use for execution.
// Default: toolruntime-sandbox:latest
Image string
// Hypervisor specifies the hypervisor to use.
// Options: qemu, cloud-hypervisor, firecracker
// Default: qemu
Hypervisor string
// KernelPath is the path to the guest kernel.
KernelPath string
// ImagePath is the path to the guest image/rootfs.
ImagePath string
// Client executes sandbox specs.
// If nil, Execute() returns ErrClientNotConfigured.
Client SandboxRunner
// ImageResolver optionally resolves/pulls images before execution.
ImageResolver ImageResolver
// HealthChecker optionally verifies kata availability.
HealthChecker HealthChecker
// Logger is an optional logger for backend events.
Logger Logger
}
Config configures a Kata backend.
type HealthChecker ¶ added in v0.2.0
HealthChecker can verify kata-runtime availability.
type ImageResolver ¶ added in v0.2.0
ImageResolver resolves/pulls images before execution.
type Logger ¶
type Logger interface {
Info(msg string, args ...any)
Warn(msg string, args ...any)
Error(msg string, args ...any)
}
Logger is the interface for logging.
Contract: - Concurrency: implementations must be safe for concurrent use. - Errors: logging must be best-effort and must not panic.
type ResourceSpec ¶ added in v0.2.0
ResourceSpec defines Kata resource limits.
func (ResourceSpec) Validate ¶ added in v0.2.0
func (r ResourceSpec) Validate() error
Validate checks ResourceSpec for invalid values.
type SandboxResult ¶ added in v0.2.0
SandboxResult captures the output of a Kata execution.
type SandboxRunner ¶ added in v0.2.0
type SandboxRunner interface {
Run(ctx context.Context, spec SandboxSpec) (SandboxResult, error)
}
SandboxRunner executes Kata containers for a given spec.
Contract: - Concurrency: Implementations must be safe for concurrent use. - Context: Run must honor cancellation and deadlines. - Ownership: Implementations must not mutate the provided spec.
type SandboxSpec ¶ added in v0.2.0
type SandboxSpec struct {
Image string
Runtime string
Hypervisor string
KernelPath string
ImagePath string
Command []string
WorkingDir string
Env []string
Resources ResourceSpec
Security SecuritySpec
Timeout time.Duration
Labels map[string]string
}
SandboxSpec defines what to run inside Kata Containers.
func (SandboxSpec) Validate ¶ added in v0.2.0
func (s SandboxSpec) Validate() error
Validate checks SandboxSpec for errors before execution.
type SecuritySpec ¶ added in v0.2.0
type SecuritySpec struct {
User string
ReadOnlyRootfs bool
NetworkMode string
SeccompProfile string
Privileged bool
}
SecuritySpec defines Kata security settings.
func (SecuritySpec) Validate ¶ added in v0.2.0
func (s SecuritySpec) Validate() error
Validate checks SecuritySpec for policy violations.