Documentation ¶
Overview ¶
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file expect in compliance with the License.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.
Index ¶
- Constants
- Variables
- func AddToScheme(scheme *runtime.Scheme) error
- func AddToSchemeWithGV(scheme *runtime.Scheme, schemeGroupVersion schema.GroupVersion) error
- type Machine
- type MachineList
- type MachineService
- type MachineServiceHandler
- func (client *MachineServiceHandler) Create(ctx context.Context, req *Machine) (*Machine, error)
- func (client *MachineServiceHandler) Delete(ctx context.Context, req *Machine) (*Machine, error)
- func (client *MachineServiceHandler) Get(ctx context.Context, req *Machine) (*Machine, error)
- func (client *MachineServiceHandler) List(ctx context.Context, req *MachineList) (*MachineList, error)
- func (client *MachineServiceHandler) Logs(ctx context.Context, req *Machine) (chan string, chan error, error)
- func (client *MachineServiceHandler) Pause(ctx context.Context, req *Machine) (*Machine, error)
- func (client *MachineServiceHandler) Start(ctx context.Context, req *Machine) (*Machine, error)
- func (client *MachineServiceHandler) Stop(ctx context.Context, req *Machine) (*Machine, error)
- func (client *MachineServiceHandler) Update(ctx context.Context, req *Machine) (*Machine, error)
- func (client *MachineServiceHandler) Watch(ctx context.Context, req *Machine) (chan *Machine, chan error, error)
- type MachineSpec
- type MachineState
- type MachineStatus
Constants ¶
const ( MachineStateUnknown = MachineState("unknown") MachineStateCreated = MachineState("created") MachineStateFailed = MachineState("failed") MachineStateRestarting = MachineState("restarting") MachineStateRunning = MachineState("running") MachineStatePaused = MachineState("paused") MachineStateSuspended = MachineState("suspended") MachineStateExited = MachineState("exited") )
const Version = "v1alpha1"
Variables ¶
var SchemeGroupVersion = schema.GroupVersion{ Group: machine.GroupName, Version: Version, }
Functions ¶
func AddToScheme ¶
func AddToSchemeWithGV ¶
func AddToSchemeWithGV(scheme *runtime.Scheme, schemeGroupVersion schema.GroupVersion) error
Types ¶
type Machine ¶
type Machine = zip.Object[MachineSpec, MachineStatus]
Machine is the mutable API object that represents a machine instance.
type MachineList ¶
type MachineList = zip.ObjectList[MachineSpec, MachineStatus]
MachineList is the mutable API object that represents a list of machine instances.
type MachineService ¶
type MachineService interface { Create(context.Context, *Machine) (*Machine, error) Start(context.Context, *Machine) (*Machine, error) Pause(context.Context, *Machine) (*Machine, error) Stop(context.Context, *Machine) (*Machine, error) Update(context.Context, *Machine) (*Machine, error) Delete(context.Context, *Machine) (*Machine, error) Get(context.Context, *Machine) (*Machine, error) List(context.Context, *MachineList) (*MachineList, error) Watch(context.Context, *Machine) (chan *Machine, chan error, error) Logs(context.Context, *Machine) (chan string, chan error, error) }
MachineService is the interface of available methods which can be performed by an implementing machine platform driver.
func NewMachineServiceHandler ¶
func NewMachineServiceHandler(ctx context.Context, impl MachineService, opts ...zip.ClientOption) (MachineService, error)
NewMachineServiceHandler returns a service based on an inline API client which essentially wraps the specific call, enabling pre- and post- call hooks. This is useful for wrapping the command with decorators, for example, a cache, error handlers, etc. Simultaneously, it enables access to the service via inline code without having to make invocations to an external handler.
type MachineServiceHandler ¶
type MachineServiceHandler struct {
// contains filtered or unexported fields
}
MachineServiceHandler provides a Zip API Object Framework service for the machine.
func (*MachineServiceHandler) List ¶
func (client *MachineServiceHandler) List(ctx context.Context, req *MachineList) (*MachineList, error)
List implements MachineService
func (*MachineServiceHandler) Logs ¶
func (client *MachineServiceHandler) Logs(ctx context.Context, req *Machine) (chan string, chan error, error)
Logs implements MachineService
type MachineSpec ¶
type MachineSpec struct { // Architecture of the machine instance. Architecture string `json:"arch,omitempty"` // Platform of the machine instance. Platform string `json:"plat,omitempty"` // Kernel represents the Kernel string `json:"kernel,omitempty"` // Rootfs the fully-qualified path to the target root file system. This can // be device path, a mount-path, initramdisk. Rootfs string `json:"rootfs,omitempty"` // Kernel arguments are runtime arguments which are provided directly to the // kernel and not for the application. KernelArgs []string `json:"kernelArgs,omitempty"` // Application arguments are runtime arguments provided to the application and // not the kernel. ApplicationArgs []string `json:"args,omitempty"` // Resources describes the compute resources (requests and limits) required by // this machine. Resources corev1.ResourceRequirements `json:"resources,omitempty"` // Emulation indicates whether to use VMM emulation. Emulation bool `json:"emulation,omitempty"` }
MachineSpec contains the desired behavior of the Machine.
type MachineStatus ¶
type MachineStatus struct { // State is the current state of the machine instance. State MachineState `json:"state"` // Pid of the machine instance (if applicable). Pid int32 `json:"pid,omitempty"` // The fully-qualified path to the kernel image of the machine instance. KernelPath string `json:"kernelPath,omitempty"` // ExitCode is the ... ExitCode int `json:"exitCode,omitempty"` // StartedAt represents when the machine was started. StartedAt time.Time `json:"startedAt,omitempty"` // ExitedAt represents when the machine fully shutdown ExitedAt time.Time `json:"exitedAt,omitempty"` // StateDir contains the path of the state of the machine. StateDir string `json:"stateDir,omitempty"` // LogFile is the in-host path to the log file of the machine. LogFile string `json:"logFile,omitempty"` // PlatformConfig is platform-specific attributes which are populated by the // underlying machine service implementation. PlatformConfig interface{} `json:"platformConfig,omitempty"` }
MachineStatus contains the complete status of the machine instance.