Documentation
¶
Index ¶
- Constants
- Variables
- func CleanupRuntimeArtifacts() error
- func CleanupStaleRuntimeTasks() error
- func CleanupStaleRuntimeTasksWithRetry() error
- func ClearDrainVerifiedMarker() error
- func DrainVerifiedMarkerPath() string
- func FindEmbeddedContainerdChildPIDs() ([]int, error)
- func HasDrainVerifiedMarker() bool
- func IsDataPlaneProtectedPID(pid int) bool
- func MaybeRunChildProcess(args []string) (bool, error)
- func PrepareEmbeddedContainerdBootstrap()
- func ReapManagedShimsForSocket(socketPath string, remainingBudget time.Duration) error
- func ReapManagedShimsUntilClear(socketPath string, remainingBudget time.Duration) error
- func ReapShimsForStaleTask(socketPath, taskID string, remainingBudget time.Duration) error
- func RemainingStopBudget(stopStarted time.Time, totalBudget time.Duration) time.Duration
- func ResetShimReapRemainingBudget()
- func SetDrainVerifiedMarkerPath(path string)
- func SetShimReapRemainingBudget(remaining time.Duration)
- func StopOrphanedEmbeddedContainerd() error
- func UseWasmShimLogDir() error
- func WriteDrainVerifiedMarker() error
- type ErrContainerdReconfigureOperation
- type ErrRuntimeHandlerUnavailable
- type RuntimeCatalogEntry
- type RuntimeFamily
- type Service
- func (s *Service) IsAttachOnly() bool
- func (s *Service) IsHealthy() bool
- func (s *Service) Ready() <-chan struct{}
- func (s *Service) Reap() error
- func (s *Service) Reconfigure() error
- func (s *Service) Run() error
- func (s *Service) SetUnexpectedExitHandler(handler func(error))
- func (s *Service) Start() error
- func (s *Service) Stop()
- func (s *Service) StopForce() error
- func (s *Service) StopGraceful() error
- func (s *Service) WaitReady(timeout time.Duration) error
Constants ¶
const ( // DefaultDataPlaneStopBudget is the aligned systemd TimeoutStopSec budget for data-plane stop. DefaultDataPlaneStopBudget = 120 * time.Second // DefaultShimReapBudgetCap is the maximum time spent reaping managed shims during stop/bootstrap. DefaultShimReapBudgetCap = 30 * time.Second // DefaultPostStopShimVerifyCap is the maximum verify reap after containerd stop when primary reap failed. DefaultPostStopShimVerifyCap = 10 * time.Second )
Variables ¶
var ( ErrContainerdSpawnFailure = errors.New("containerd spawn failure") ErrContainerdReadiness = errors.New("containerd readiness failure") ErrContainerdExitedEarly = errors.New("containerd exited before ready") ErrContainerdStopTimeout = errors.New("containerd stop timeout") ErrContainerdUnexpectedExit = errors.New("containerd unexpected exit") ErrContainerdReconfigure = errors.New("containerd reconfigure failure") )
Functions ¶
func CleanupRuntimeArtifacts ¶
func CleanupRuntimeArtifacts() error
CleanupRuntimeArtifacts removes stale runtime artifacts used by embedded containerd. It intentionally preserves persistent image/layer data under EdgeletContainerdRootDir.
func CleanupStaleRuntimeTasks ¶
func CleanupStaleRuntimeTasks() error
CleanupStaleRuntimeTasks removes orphaned runtime task directories under EdgeletContainerdStateDir. Preserves EdgeletContainerdRootDir (images/layers).
func CleanupStaleRuntimeTasksWithRetry ¶ added in v1.0.1
func CleanupStaleRuntimeTasksWithRetry() error
CleanupStaleRuntimeTasksWithRetry removes stale runtime task directories with bounded EBUSY retries after shim reap. Bootstrap continues when dirs remain busy.
func ClearDrainVerifiedMarker ¶ added in v1.1.0
func ClearDrainVerifiedMarker() error
ClearDrainVerifiedMarker removes a stale drain-verified receipt.
func DrainVerifiedMarkerPath ¶ added in v1.1.0
func DrainVerifiedMarkerPath() string
DrainVerifiedMarkerPath is the ExecStopPost receipt written after a verified drain.
func FindEmbeddedContainerdChildPIDs ¶
FindEmbeddedContainerdChildPIDs returns PIDs whose cmdline includes --edgelet-containerd-child.
func HasDrainVerifiedMarker ¶ added in v1.1.0
func HasDrainVerifiedMarker() bool
HasDrainVerifiedMarker reports whether ExecStopPost may reap shims/children.
func IsDataPlaneProtectedPID ¶ added in v1.1.0
IsDataPlaneProtectedPID reports processes force-kill must leave alone: the data-plane parent, the live containerd child, and shims still attached to the edgelet containerd socket.
func MaybeRunChildProcess ¶
MaybeRunChildProcess runs containerd in child mode when the daemon is invoked with the dedicated internal child argument.
func PrepareEmbeddedContainerdBootstrap ¶ added in v1.0.1
func PrepareEmbeddedContainerdBootstrap()
PrepareEmbeddedContainerdBootstrap stops orphans, reaps shims, and cleans stale tasks before embedded containerd start or retry.
func ReapManagedShimsForSocket ¶ added in v1.0.1
ReapManagedShimsForSocket terminates containerd-shim processes bound to socketPath and stops orphaned --edgelet-containerd-child processes for the edgelet socket scope.
func ReapManagedShimsUntilClear ¶ added in v1.0.1
ReapManagedShimsUntilClear retries managed shim/child teardown until processes are gone or remainingBudget is exhausted.
func ReapShimsForStaleTask ¶ added in v1.0.1
ReapShimsForStaleTask terminates managed shims bound to a stale runtime task ID.
func RemainingStopBudget ¶ added in v1.0.1
RemainingStopBudget returns the stop time left from totalBudget since stopStarted.
func ResetShimReapRemainingBudget ¶ added in v1.0.1
func ResetShimReapRemainingBudget()
ResetShimReapRemainingBudget restores the default shim-reap budget cap.
func SetDrainVerifiedMarkerPath ¶ added in v1.1.0
func SetDrainVerifiedMarkerPath(path string)
SetDrainVerifiedMarkerPath overrides the receipt path (tests only).
func SetShimReapRemainingBudget ¶ added in v1.0.1
SetShimReapRemainingBudget configures the shim-reap slice for the next Stop/reap call.
func StopOrphanedEmbeddedContainerd ¶ added in v1.0.1
func StopOrphanedEmbeddedContainerd() error
StopOrphanedEmbeddedContainerd stops leftover embedded containerd children from /proc.
func UseWasmShimLogDir ¶ added in v1.1.0
func UseWasmShimLogDir() error
UseWasmShimLogDir creates the shim log directory and makes it the working directory before the first wasm shim -info.
func WriteDrainVerifiedMarker ¶ added in v1.1.0
func WriteDrainVerifiedMarker() error
WriteDrainVerifiedMarker records that grace → force → verify passed.
Types ¶
type ErrContainerdReconfigureOperation ¶
func (*ErrContainerdReconfigureOperation) Details ¶
func (e *ErrContainerdReconfigureOperation) Details() map[string]any
func (*ErrContainerdReconfigureOperation) Error ¶
func (e *ErrContainerdReconfigureOperation) Error() string
func (*ErrContainerdReconfigureOperation) Unwrap ¶
func (e *ErrContainerdReconfigureOperation) Unwrap() error
type ErrRuntimeHandlerUnavailable ¶
type ErrRuntimeHandlerUnavailable struct {
}
ErrRuntimeHandlerUnavailable indicates a requested handler is missing or not eligible.
func (*ErrRuntimeHandlerUnavailable) Error ¶
func (e *ErrRuntimeHandlerUnavailable) Error() string
func (*ErrRuntimeHandlerUnavailable) Unwrap ¶
func (e *ErrRuntimeHandlerUnavailable) Unwrap() error
type RuntimeCatalogEntry ¶
type RuntimeCatalogEntry struct {
Handler string
Binary string
Path string
RuntimeType string
Family RuntimeFamily
}
RuntimeCatalogEntry is one runtime handler detection result.
func BuildRuntimeCatalog ¶
func BuildRuntimeCatalog() []RuntimeCatalogEntry
BuildRuntimeCatalog discovers supported runtimes from PATH. Only discovered handlers are returned.
func ValidateRuntimeHandlerEligibility ¶
func ValidateRuntimeHandlerEligibility(handler string, catalog []RuntimeCatalogEntry) (RuntimeCatalogEntry, error)
ValidateRuntimeHandlerEligibility returns a runtime entry only when handler exists in catalog and is eligible.
type RuntimeFamily ¶
type RuntimeFamily string
const ( RuntimeFamilyRunc RuntimeFamily = "runc" RuntimeFamilyShim RuntimeFamily = "shim" )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages the embedded containerd child-process lifecycle.
func NewAttachedService ¶
func NewAttachedService() *Service
NewAttachedService monitors an externally managed containerd (Plan 11 data-plane unit).
func NewService ¶
func NewService() *Service
NewService creates an uninitialized containerd service.
func (*Service) IsAttachOnly ¶
IsAttachOnly reports whether this service only monitors an external containerd process.
func (*Service) IsHealthy ¶
IsHealthy returns true when containerd is reachable and the CRI runtime plugin is usable.
func (*Service) Ready ¶
func (s *Service) Ready() <-chan struct{}
Ready returns a channel that closes when containerd is ready to accept requests.
func (*Service) Reconfigure ¶
Reconfigure rewrites containerd config and performs a controlled restart.
func (*Service) SetUnexpectedExitHandler ¶
func (*Service) Stop ¶
func (s *Service) Stop()
Stop keeps backward-compatible behavior while enforcing escalation.
func (*Service) StopGraceful ¶
StopGraceful requests a graceful shutdown and waits for completion.