runtimeapi

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: EPL-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuntimeClassStageWriteConfig     = "write_config"
	RuntimeClassStageStopRuntime     = "stop_runtime"
	RuntimeClassStageStartRuntime    = "start_runtime"
	RuntimeClassStageWaitCRIReady    = "wait_cri_ready"
	RuntimeClassStageVerifyStability = "verify_stability"
	RuntimeClassStageRollbackConfig  = "rollback_config"
	RuntimeClassStageEscalateRestart = "escalate_restart"
	RuntimeClassStageDone            = "done"
)
View Source
const (
	PruneModeDangling   = "dangling"
	PruneModeContainers = "containers"
	PruneModeVolumes    = "volumes"
	PruneModeAll        = "all"
)
View Source
const (
	DeployStageParsing    = "parsing"
	DeployStagePulling    = "pulling"
	DeployStageCreating   = "creating"
	DeployStageStarting   = "starting"
	DeployStagePersisting = "persisting"
	DeployStageDone       = "done"
)

Variables

View Source
var (
	ErrControlPlaneNotFound       = errors.New("control plane deployment not found")
	ErrControlPlaneRestartBlocked = errors.New("control plane restart blocked: apply in progress")
)
View Source
var ErrRuntimeClassUnsupported = errors.New("runtimeclass is supported only when containerEngine=edgelet")
View Source
var ErrSystemPruneVolumes = errors.New("system prune volumes does not destroy persistent VOLUME data; use edgelet volume prune")

ErrSystemPruneVolumes is returned when system prune volumes is asked to destroy persistent VOLUME data. Callers should use volume prune instead.

Functions

func ControlPlaneStatusMap

func ControlPlaneStatusMap(item *models.ControlPlaneDeployment) map[string]any

ControlPlaneStatusMap builds the GET /v1/system/controlplane response body.

func IsControlPlaneDeleteBlocked

func IsControlPlaneDeleteBlocked(err error) bool

IsControlPlaneDeleteBlocked reports whether err blocks control-plane delete while provisioned.

func IsControlPlaneLifecycleBlocked

func IsControlPlaneLifecycleBlocked(err error) bool

IsControlPlaneLifecycleBlocked reports whether err blocks control-plane ms lifecycle.

func IsControlPlaneRestartBlocked

func IsControlPlaneRestartBlocked(err error) bool

IsControlPlaneRestartBlocked reports whether err blocks operator control-plane restart.

func NormalizeRuntimeClassOperationStage

func NormalizeRuntimeClassOperationStage(stage string) string

Types

type ControlPlaneApplyResult

type ControlPlaneApplyResult struct {
	Mode           string
	ControllerUUID string
	Namespace      string
	Name           string
	Image          string
	State          string
	RuntimeState   string
	ContainerID    string
	Generation     int64
}

ControlPlaneApplyResult is the control plane apply outcome.

type DeployProgressCallback

type DeployProgressCallback func(stage string, message string)

DeployProgressCallback reports deploy stage transitions from runtime flow.

type ErrAmbiguousImageSelector added in v1.0.1

type ErrAmbiguousImageSelector struct {
	Selector string
	Matches  []string
}

ErrAmbiguousImageSelector indicates an image selector matched multiple images.

func (*ErrAmbiguousImageSelector) Error added in v1.0.1

func (e *ErrAmbiguousImageSelector) Error() string

type ErrAmbiguousMicroserviceSelector

type ErrAmbiguousMicroserviceSelector struct {
	Matches []string
}

ErrAmbiguousMicroserviceSelector indicates selector matched multiple targets.

func (*ErrAmbiguousMicroserviceSelector) Error

type ErrControlPlaneDeleteBlocked

type ErrControlPlaneDeleteBlocked struct{}

ErrControlPlaneDeleteBlocked indicates DELETE /v1/system/controlplane is forbidden while provisioned.

func (*ErrControlPlaneDeleteBlocked) Error

type ErrControlPlaneIdentityImmutable

type ErrControlPlaneIdentityImmutable struct {
	ExistingNamespace string
	ExistingName      string
	NewNamespace      string
	NewName           string
}

ErrControlPlaneIdentityImmutable indicates metadata.name or metadata.namespace changed on patch.

func (*ErrControlPlaneIdentityImmutable) Error

type ErrControlPlaneLifecycleBlocked

type ErrControlPlaneLifecycleBlocked struct {
	Operation string
}

ErrControlPlaneLifecycleBlocked indicates ms rm/stop/kill/start/restart on the controller UUID is forbidden.

func (*ErrControlPlaneLifecycleBlocked) Error

type ErrReservedRuntimeClassDelete

type ErrReservedRuntimeClassDelete struct {
	Name string
}

func (*ErrReservedRuntimeClassDelete) Details

func (e *ErrReservedRuntimeClassDelete) Details() map[string]any

func (*ErrReservedRuntimeClassDelete) Error

type ErrRuntimeClassInUse

type ErrRuntimeClassInUse struct {
	Name                      string
	RuntimeNames              []string
	BlockingMicroserviceUuids []string
}

func (*ErrRuntimeClassInUse) Details

func (e *ErrRuntimeClassInUse) Details() map[string]any

func (*ErrRuntimeClassInUse) Error

func (e *ErrRuntimeClassInUse) Error() string

type ErrRuntimeClassManagedName added in v1.1.0

type ErrRuntimeClassManagedName struct {
	Name string
}

ErrRuntimeClassManagedName is returned when a local apply targets a name the controller currently manages on this provisioned node.

func (*ErrRuntimeClassManagedName) Details added in v1.1.0

func (e *ErrRuntimeClassManagedName) Details() map[string]any

func (*ErrRuntimeClassManagedName) Error added in v1.1.0

type ErrRuntimeClassOperation

type ErrRuntimeClassOperation struct {
	Stage string
	Err   error
}

func (*ErrRuntimeClassOperation) Details

func (e *ErrRuntimeClassOperation) Details() map[string]any

func (*ErrRuntimeClassOperation) Error

func (e *ErrRuntimeClassOperation) Error() string

func (*ErrRuntimeClassOperation) Unwrap

func (e *ErrRuntimeClassOperation) Unwrap() error

type Facade

type Facade struct {
	// contains filtered or unexported fields
}

Facade is a thin runtime adapter used by EdgeletAPI handlers. It intentionally delegates to existing modules to preserve daemon behavior.

func NewFacade

func NewFacade() *Facade

NewFacade returns a singleton-backed runtime facade.

func (*Facade) ApplyControlPlaneManifest

func (f *Facade) ApplyControlPlaneManifest(manifest, sourceName string, dryRun bool, progress DeployProgressCallback) (*ControlPlaneApplyResult, error)

ApplyControlPlaneManifest validates, persists, and launches the controller.

func (*Facade) ApplyControllerRuntimeClasses added in v1.1.0

func (f *Facade) ApplyControllerRuntimeClasses(items []*models.ControllerRuntimeClass) error

ApplyControllerRuntimeClasses replaces the fleet-desired RuntimeClass snapshot and applies it on the edgelet engine. Catalog handlers stay on the existing metadata persist path and do not bounce the data plane.

func (*Facade) ApplyLocalKnowledgeManifests added in v1.1.0

func (f *Facade) ApplyLocalKnowledgeManifests(manifest string, dryRun bool) ([]*models.LocalKnowledge, error)

ApplyLocalKnowledgeManifests upserts each Knowledge document by metadata.name. Persist is synchronous. Artifact download is started by the apply handler (or POST /v1/knowledge:pull) after every document is written.

func (*Facade) ApplyLocalManifest

func (f *Facade) ApplyLocalManifest(manifest, sourceName string, dryRun bool, progress DeployProgressCallback) (string, *models.LocalDeployManifest, error)

ApplyLocalManifest validates and persists local deployment metadata.

func (*Facade) ApplyLocalModelManifests added in v1.1.0

func (f *Facade) ApplyLocalModelManifests(manifest string, dryRun bool) ([]*models.LocalModel, error)

ApplyLocalModelManifests upserts each Model document by metadata.name. Persist is synchronous. Artifact download is started by the apply handler (or POST /v1/models:pull) after every document is written.

func (*Facade) ApplyLocalRegistryManifest

func (f *Facade) ApplyLocalRegistryManifest(manifest string, dryRun bool) (*models.Registry, error)

ApplyLocalRegistryManifest validates and stores a registry manifest. spec.id set → upsert that id; omitted → NextLocalRegistryID(). Built-in ids cannot be edited. Collision on (type, url) for an existing id is a validate error.

func (*Facade) ApplyLocalRuntimeClassManifest

func (f *Facade) ApplyLocalRuntimeClassManifest(manifest string, dryRun bool) (*models.LocalRuntimeClass, error)

ApplyLocalRuntimeClassManifest validates and stores a RuntimeClass manifest.

func (*Facade) DeleteControlPlane

func (f *Facade) DeleteControlPlane() error

DeleteControlPlane removes the controller deployment, container, and volumes.

func (*Facade) DeleteLocalDeployment

func (f *Facade) DeleteLocalDeployment(id string) error

DeleteLocalDeployment removes local deployment by id.

func (*Facade) DeleteRegistry

func (f *Facade) DeleteRegistry(id int) error

DeleteRegistry removes one local registry entry.

func (*Facade) DeleteRuntimeClass

func (f *Facade) DeleteRuntimeClass(name string) error

DeleteRuntimeClass removes one RuntimeClass entry by name.

func (*Facade) Deprovision

func (f *Facade) Deprovision(scope string, purgeVolumes bool) error

Deprovision deprovisions the agent. purgeVolumes destroys workload persistent VOLUME claims; control-plane volumes are never purged. Shared names stay while any consumer remains.

func (*Facade) GetControlPlaneDeployment

func (f *Facade) GetControlPlaneDeployment() (*models.ControlPlaneDeployment, error)

GetControlPlaneDeployment returns the singleton control plane row.

func (*Facade) GetControlPlaneManifestMasked

func (f *Facade) GetControlPlaneManifestMasked() (string, error)

GetControlPlaneManifestMasked returns secrets-redacted manifest YAML.

func (*Facade) GetKnowledge added in v1.1.0

func (f *Facade) GetKnowledge(name string) (map[string]any, error)

GetKnowledge returns one local Knowledge by metadata.name.

func (*Facade) GetKnowledgePull added in v1.1.0

func (f *Facade) GetKnowledgePull(operationID string) (*knowledgemanager.PullOperation, bool)

GetKnowledgePull returns one async Knowledge pull operation.

func (*Facade) GetLocalDeployment

func (f *Facade) GetLocalDeployment(id string) (*models.LocalDeployedMicroservice, error)

GetLocalDeployment gets local deployment by id.

func (*Facade) GetModel added in v1.1.0

func (f *Facade) GetModel(name string) (map[string]any, error)

GetModel returns one local Model by metadata.name.

func (*Facade) GetModelPull added in v1.1.0

func (f *Facade) GetModelPull(operationID string) (*modelmanager.PullOperation, bool)

GetModelPull returns one async model pull operation.

func (*Facade) GetRegistry

func (f *Facade) GetRegistry(id int) (*models.Registry, error)

GetRegistry returns one local registry entry.

func (*Facade) GetRuntimeClass

func (f *Facade) GetRuntimeClass(name string) (*models.LocalRuntimeClass, error)

GetRuntimeClass returns one RuntimeClass entry by name.

func (*Facade) GetRuntimeMicroservice

func (f *Facade) GetRuntimeMicroservice(id string) (map[string]any, error)

GetRuntimeMicroservice returns one process-manager tracked microservice.

func (*Facade) GetRuntimeMicroserviceLogs

func (f *Facade) GetRuntimeMicroserviceLogs(selector string, tailLines int, since, until string) (string, []map[string]any, error)

func (*Facade) GetSharedVolumeClaim added in v1.1.0

func (f *Facade) GetSharedVolumeClaim(name string) (map[string]any, error)

GetSharedVolumeClaim inspects one shared persistent VOLUME claim by name.

func (*Facade) KillRuntimeMicroservice

func (f *Facade) KillRuntimeMicroservice(selector string) (string, error)

func (*Facade) ListImages

func (f *Facade) ListImages() ([]map[string]any, error)

ListImages returns normalized image list for local runtime engine.

func (*Facade) ListKnowledge added in v1.1.0

func (f *Facade) ListKnowledge() ([]map[string]any, error)

ListKnowledge returns local Knowledge rows as API maps.

func (*Facade) ListLocalDeployments

func (f *Facade) ListLocalDeployments() ([]*models.LocalDeployedMicroservice, error)

ListLocalDeployments lists local deployment records.

func (*Facade) ListModels added in v1.1.0

func (f *Facade) ListModels() ([]map[string]any, error)

ListModels returns local Model rows as API maps.

func (*Facade) ListRegistries

func (f *Facade) ListRegistries() ([]*models.Registry, error)

ListRegistries returns persisted registry entries with defaults guaranteed.

func (*Facade) ListRuntimeClasses

func (f *Facade) ListRuntimeClasses() ([]*models.LocalRuntimeClass, error)

ListRuntimeClasses returns persisted RuntimeClass entries.

func (*Facade) ListRuntimeMicroservices

func (f *Facade) ListRuntimeMicroservices() []map[string]any

ListRuntimeMicroservices returns process-manager tracked microservices.

func (*Facade) ListVolumeClaims added in v1.1.0

func (f *Facade) ListVolumeClaims() ([]map[string]any, error)

ListVolumeClaims returns one row per persistent VOLUME claim. Private claims set uuid; shared claims list every local and controller consumer.

func (*Facade) LoadImageFromPath

func (f *Facade) LoadImageFromPath(path string) ([]engine.LoadedImage, error)

LoadImageFromPath imports a daemon-local image archive path.

func (*Facade) ParseAndValidateControlPlaneManifest

func (f *Facade) ParseAndValidateControlPlaneManifest(manifest string) (*models.ControlPlaneManifest, error)

ParseAndValidateControlPlaneManifest validates ControlPlane YAML.

func (*Facade) ParseAndValidateLocalKnowledgeManifests added in v1.1.0

func (f *Facade) ParseAndValidateLocalKnowledgeManifests(manifest string) ([]*models.LocalKnowledgeManifest, error)

ParseAndValidateLocalKnowledgeManifests decodes one or more Knowledge documents and validates each.

func (*Facade) ParseAndValidateLocalManifest

func (f *Facade) ParseAndValidateLocalManifest(manifest string) (*models.LocalDeployManifest, error)

ParseAndValidateLocalManifest validates a local deploy manifest.

func (*Facade) ParseAndValidateLocalModelManifests added in v1.1.0

func (f *Facade) ParseAndValidateLocalModelManifests(manifest string) ([]*models.LocalModelManifest, error)

ParseAndValidateLocalModelManifests decodes one or more Model documents and validates each.

func (*Facade) ParseAndValidateLocalRegistryManifest

func (f *Facade) ParseAndValidateLocalRegistryManifest(manifest string) (*models.LocalRegistryManifest, error)

ParseAndValidateLocalRegistryManifest validates a local registry manifest.

func (*Facade) ParseAndValidateLocalRuntimeClassManifest

func (f *Facade) ParseAndValidateLocalRuntimeClassManifest(manifest string) (*models.LocalRuntimeClassManifest, error)

ParseAndValidateLocalRuntimeClassManifest validates a RuntimeClass manifest.

func (*Facade) Provision

func (f *Facade) Provision(provisioningKey string) error

Provision provisions the agent.

func (*Facade) Prune

func (f *Facade) Prune(mode string) (map[string]any, error)

Prune triggers runtime prune for the requested mode.

func (*Facade) PruneKnowledge added in v1.1.0

func (f *Facade) PruneKnowledge(mode string) (*knowledgemanager.PruneReport, error)

PruneKnowledge removes unreferenced Knowledge artifacts.

func (*Facade) PruneModels added in v1.1.0

func (f *Facade) PruneModels(mode string) (*modelmanager.PruneReport, error)

PruneModels removes unreferenced model artifacts.

func (*Facade) PruneVolumeOrphans added in v1.1.0

func (f *Facade) PruneVolumeOrphans(req VolumePruneRequest) (map[string]any, error)

PruneVolumeOrphans lists or destroys unreferenced persistent VOLUME claims. Dry-run is the default; Yes is required to destroy.

func (*Facade) PullImage

func (f *Facade) PullImage(imageRef string, registryID *int, platform string) (string, error)

PullImage pulls an image with optional registry id and platform selector.

func (*Facade) PullImageWithProgress

func (f *Facade) PullImageWithProgress(imageRef string, registryID *int, platform string, onProgress func(float32)) (string, error)

PullImageWithProgress pulls an image while reporting progress updates.

func (*Facade) RemoveImage

func (f *Facade) RemoveImage(selector string) (string, error)

RemoveImage removes an image by selector (id, id prefix, name:tag, or digest).

func (*Facade) RemoveKnowledge added in v1.1.0

func (f *Facade) RemoveKnowledge(name string) error

RemoveKnowledge deletes one local Knowledge and its on-disk artifacts.

func (*Facade) RemoveModel added in v1.1.0

func (f *Facade) RemoveModel(name string) error

RemoveModel deletes one local Model and its on-disk artifacts.

func (*Facade) RemovePrivateVolume added in v1.1.0

func (f *Facade) RemovePrivateVolume(uuid, name string, force bool) error

RemovePrivateVolume destroys private persistent VOLUME data under volumes/data/{uuid}.

func (*Facade) RemoveRuntimeMicroservice

func (f *Facade) RemoveRuntimeMicroservice(selector string) (string, error)

func (*Facade) RemoveRuntimeMicroserviceWithCleanup added in v1.1.0

func (f *Facade) RemoveRuntimeMicroserviceWithCleanup(selector string, cleanup bool) (string, error)

RemoveRuntimeMicroserviceWithCleanup removes a microservice. Persistent VOLUME data is retained. cleanup records a reserved bit for later explicit orphan prune and does not delete files or start a sweeper.

func (*Facade) RemoveSharedVolume added in v1.1.0

func (f *Facade) RemoveSharedVolume(name string, force bool) error

RemoveSharedVolume destroys a shared persistent VOLUME under volumes/shared/{name}.

func (*Facade) ResolveImageDeleteRef added in v1.0.1

func (f *Facade) ResolveImageDeleteRef(selector string) (string, error)

ResolveImageDeleteRef resolves a user selector to an engine delete reference.

func (*Facade) ResolveMicroserviceID

func (f *Facade) ResolveMicroserviceID(selector string) (string, error)

ResolveMicroserviceID resolves selectors in this order: exact UUID -> container ID prefix -> exact ApplicationName.MicroserviceName.

func (*Facade) RestartControlPlane

func (f *Facade) RestartControlPlane(pull bool) (*models.ControlPlaneDeployment, error)

RestartControlPlane bounces the singleton controller container without deprovisioning or deleting the system_control_plane row.

func (*Facade) RestartRuntimeMicroservice

func (f *Facade) RestartRuntimeMicroservice(selector string) (string, error)

func (*Facade) SetKnowledgeManager added in v1.1.0

func (f *Facade) SetKnowledgeManager(m *knowledgemanager.Manager)

SetKnowledgeManager replaces the Knowledge manager used by deploy and Knowledge routes (tests).

func (*Facade) SetModelManager added in v1.1.0

func (f *Facade) SetModelManager(m *modelmanager.Manager)

SetModelManager replaces the model manager used by deploy and model routes (tests).

func (*Facade) StartKnowledgePull added in v1.1.0

func (f *Facade) StartKnowledgePull(name string) (*knowledgemanager.PullOperation, error)

StartKnowledgePull begins an async artifact pull for a deployed Knowledge. Download is detached from the HTTP request so a 202 return cannot cancel it.

func (*Facade) StartModelPull added in v1.1.0

func (f *Facade) StartModelPull(name string) (*modelmanager.PullOperation, error)

StartModelPull begins an async artifact pull for a deployed Model. Download is detached from the HTTP request so a 202 return cannot cancel it.

func (*Facade) StartRuntimeMicroservice

func (f *Facade) StartRuntimeMicroservice(selector string) (string, error)

func (*Facade) StopRuntimeMicroservice

func (f *Facade) StopRuntimeMicroservice(selector string) (string, error)

func (*Facade) UpsertLocalDeployment

func (f *Facade) UpsertLocalDeployment(ms *models.LocalDeployedMicroservice) error

UpsertLocalDeployment upserts one local deployment record.

func (*Facade) UpsertLocalKnowledgeSpec added in v1.1.0

func (f *Facade) UpsertLocalKnowledgeSpec(name, repo, revision string, registryID int, files []string, format string) (*models.LocalKnowledge, error)

UpsertLocalKnowledgeSpec upserts one Knowledge from pull-request fields using the same validation as deploy apply.

func (*Facade) UpsertLocalModelSpec added in v1.1.0

func (f *Facade) UpsertLocalModelSpec(name, repo, revision string, registryID int, files []string, format string) (*models.LocalModel, error)

UpsertLocalModelSpec upserts one Model from pull-request fields using the same validation as deploy apply.

func (*Facade) ValidateRuntimeClassDelete

func (f *Facade) ValidateRuntimeClassDelete(name string) (*models.LocalRuntimeClass, error)

ValidateRuntimeClassDelete validates whether one RuntimeClass can be deleted.

type VolumePruneRequest added in v1.1.0

type VolumePruneRequest struct {
	Orphans bool
	Yes     bool
	Force   bool
	DryRun  bool
}

VolumePruneRequest controls explicit orphan prune of persistent VOLUME claims.

Jump to

Keyboard shortcuts

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