v1alpha1

package
v0.5.2-93-g5b9e673 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: BSD-3-Clause Imports: 8 Imported by: 1

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

View Source
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")
)
View Source
const Version = "v1alpha1"

Variables

View Source
var SchemeGroupVersion = schema.GroupVersion{
	Group:   machine.GroupName,
	Version: Version,
}

Functions

func AddToScheme

func AddToScheme(scheme *runtime.Scheme) error

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) Create

func (client *MachineServiceHandler) Create(ctx context.Context, req *Machine) (*Machine, error)

Create implements MachineService

func (*MachineServiceHandler) Delete

func (client *MachineServiceHandler) Delete(ctx context.Context, req *Machine) (*Machine, error)

Delete implements MachineService

func (*MachineServiceHandler) Get

func (client *MachineServiceHandler) Get(ctx context.Context, req *Machine) (*Machine, error)

Get implements MachineService

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

func (*MachineServiceHandler) Pause

func (client *MachineServiceHandler) Pause(ctx context.Context, req *Machine) (*Machine, error)

Pause implements MachineService

func (*MachineServiceHandler) Start

func (client *MachineServiceHandler) Start(ctx context.Context, req *Machine) (*Machine, error)

Start implements MachineService

func (*MachineServiceHandler) Stop

func (client *MachineServiceHandler) Stop(ctx context.Context, req *Machine) (*Machine, error)

Stop implements MachineService

func (*MachineServiceHandler) Update

func (client *MachineServiceHandler) Update(ctx context.Context, req *Machine) (*Machine, error)

Update implements MachineService

func (*MachineServiceHandler) Watch

func (client *MachineServiceHandler) Watch(ctx context.Context, req *Machine) (chan *Machine, chan error, error)

Watch 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 MachineState

type MachineState string

MachineState indicates the state of the machine.

func (MachineState) String

func (ms MachineState) String() string

String implements fmt.Stringer

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.

Jump to

Keyboard shortcuts

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