types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 13 Imported by: 39

Documentation

Index

Constants

View Source
const (
	Etcd  = "etcd"
	Redis = "redis"
)

Variables

View Source
var (
	ErrInsufficientCapacity  = errors.New("cannot alloc a plan, not enough nodes capacity")
	ErrInsufficientResource  = errors.New("cannot alloc a plan, not enough resource")
	ErrAlreadyFilled         = errors.New("cannot alloc a fill node plan, each node has enough workloads")
	ErrInvaildDeployStrategy = errors.New("deploy strategy not supported yet")

	ErrNodeExists = errors.New("node already exists")

	ErrInvaildNodeEndpoint  = errors.New("invalid node endpoint")
	ErrNodeNotEmpty         = errors.New("node not empty, still has workloads associated")
	ErrNodeNotExists        = errors.New("node not exists")
	ErrInvaildNodeStatusTTL = errors.New("invalid TTL for node status, should be > 0")

	ErrLockKeyInvaild  = errors.New("lock key is invalid")
	ErrLockSessionDone = errors.New("lock session done")

	ErrInvaildEruIPAddress = errors.New("invalid eru address")

	ErrInvaildSCMType          = errors.New("scm type not supported yet")
	ErrDownloadArtifactsFailed = errors.New("download artifacts failed")

	ErrInvaildIPAddress     = errors.New("invalid IP address")
	ErrInvaildIPWithPort    = errors.New("invalid IP with port")
	ErrAllConnectionsFailed = errors.New("all connections failed")
	ErrUnexpectedRedirect   = errors.New("unexpected redirect")

	ErrInvaildMemory         = errors.New("invalid memory value")
	ErrNilEngine             = errors.New("engine is nil")
	ErrInvaildRefs           = errors.New("invalid image refs")
	ErrNoImage               = errors.New("no image")
	ErrNoImageUser           = errors.New("no image user")
	ErrInvaildRemoteDigest   = errors.New("got invalid digest")
	ErrInvaildEngineEndpoint = errors.New("unsupported engine endpoint")
	ErrEngineNotImplemented  = errors.New("not implemented")
	ErrInvalidEngineArgs     = errors.New("invalid engine args")

	ErrInvaildWorkloadStatus = errors.New("status has no appname / entrypoint / nodename")
	ErrInvaildWorkloadMeta   = errors.New("invalid workload meta")
	ErrInvaildWorkloadOps    = errors.New("invalid workload ops")
	ErrInvalidWorkloadName   = errors.New("invalid workload name")
	ErrWorkloadIgnored       = errors.New("ignore this workload")
	ErrWorkloadNotExists     = errors.New("workload not exists")

	ErrPodHasNodes = errors.New("pod has nodes")
	ErrPodNoNodes  = errors.New("pod has no nodes")
	ErrPodNotFound = errors.New("pod not found")

	ErrInvaildGRPCRequestMeta = errors.New("invalid grpc request meta")
	ErrInvaildGRPCPassword    = errors.New("invalid grpc password")
	ErrInvaildGRPCUsername    = errors.New("invalid grpc username")

	ErrNoBuildPod                  = errors.New("no build pod set in config")
	ErrNoBuildsInSpec              = errors.New("no builds in spec")
	ErrNoBuildSpec                 = errors.New("no build spec")
	ErrNoEntryInSpec               = errors.New("no entry in spec")
	ErrNoDeployOpts                = errors.New("no deploy options")
	ErrNoWorkloadIDs               = errors.New("no workload IDs given")
	ErrNoSCMSetting                = errors.New("scm not set")
	ErrRunAndWaitCountOneWithStdin = errors.New("count must be 1 if OpenStdin is true")
	ErrInvaildControlType          = errors.New("unknown control type")
	ErrInvaildBuildType            = errors.New("unknown build type")
	ErrInvalidGitURL               = errors.New("invalid git url format")
	ErrInvalidVolumeBind           = errors.New("invalid volume bind value")
	ErrEmptyNodeName               = errors.New("node name is empty")
	ErrEmptyNodeMap                = errors.New("node map is empty")
	ErrEmptyAppName                = errors.New("app name is empty")
	ErrEmptyPodName                = errors.New("pod name is empty")
	ErrEmptyImage                  = errors.New("image is empty")
	ErrEmptyCount                  = errors.New("count is 0")
	ErrEmptyWorkloadID             = errors.New("workload ID is empty")
	ErrEmptyEntrypointName         = errors.New("entrypoint name is empty")
	ErrUnderlineInEntrypointName   = errors.New("entrypoint name has '_' character")
	ErrEmptyRawEngineOp            = errors.New("raw engine op is empty")

	ErrKeyNotExists       = errors.New("key not exists")
	ErrKeyExists          = errors.New("key exists")
	ErrNoOps              = errors.New("no txn ops")
	ErrTxnConditionFailed = errors.New("etcd txn condition failed")
	ErrInvaildCount       = errors.New("bad `Count` value, entity count invalid")

	ErrInvaildWALEventType = errors.New("invalid WAL event type")
	ErrInvaildWALEvent     = errors.New("encode WAL event failed")
	ErrInvalidWALBucket    = errors.New("invalid WAL bucket")
	ErrInvalidWALDataType  = errors.New("invalid WAL data type")

	ErrInvaildDeployCount    = errors.New("invalid deploy count")
	ErrRollbackMapIsNotEmpty = errors.New("rollback map is not empty")
	ErrGetMostIdleNodeFailed = errors.New("get most idle node failed")

	ErrMessageChanClosed = errors.New("message chan closed")

	ErrNoFilesToSend = errors.New("no files to send")
	ErrNoFilesToCopy = errors.New("no files to copy")

	ErrMockError = errors.New("mock error")

	ErrMetricsTypeNotSupport = errors.New("metrics type not support")

	ErrConfigInvaild = errors.New("config invalid")
)

Functions

This section is empty.

Types

type AddNodeOptions

type AddNodeOptions struct {
	Nodename  string
	Endpoint  string
	Podname   string
	Ca        string
	Cert      string
	Key       string
	Labels    map[string]string
	Resources resourcetypes.Resources
	Test      bool
}

func (*AddNodeOptions) Validate

func (o *AddNodeOptions) Validate() error

type AttachWorkloadMessage

type AttachWorkloadMessage struct {
	WorkloadID string
	Data       []byte
	StdStreamType
}

AttachWorkloadMessage carries RunAndWait output.

type AuthConfig

type AuthConfig struct {
	Username string `yaml:"username,omitempty" json:"username,omitempty"`
	Password string `yaml:"password,omitempty" json:"password,omitempty"`
}

AuthConfig holds registry credentials, also reused for grpc basic auth.

type Build

type Build = enginetypes.Build

type BuildImageMessage

type BuildImageMessage struct {
	ID          string      `json:"id,omitempty"`
	Status      string      `json:"status,omitempty"`
	Progress    string      `json:"progress,omitempty"`
	Error       string      `json:"error,omitempty"`
	Stream      string      `json:"stream,omitempty"`
	ErrorDetail errorDetail `json:"errorDetail,omitzero"`
}

type BuildMethod

type BuildMethod int
const (
	// BuildFromSCM stays the zero value for wire compatibility.
	BuildFromSCM BuildMethod = iota
	BuildFromUnknown
	BuildFromRaw
	BuildFromExist
)

type BuildOptions

type BuildOptions struct {
	Name string
	User string
	UID  int
	Tags []string
	BuildMethod
	*Builds
	Tar      io.Reader
	ExistID  string
	Platform string
}

type Builds

type Builds = enginetypes.Builds

type CacheImageMessage

type CacheImageMessage struct {
	Image    string
	Success  bool
	Nodename string
	Message  string
}

type CapacityMessage

type CapacityMessage struct {
	Total          int
	NodeCapacities map[string]int
}

CapacityMessage carries CalculateCapacity output.

type Config

type Config struct {
	Bind                string        `yaml:"bind" required:"true" default:"5001"`
	LockTimeout         time.Duration `yaml:"lock_timeout" required:"true" default:"30s"`
	GlobalTimeout       time.Duration `yaml:"global_timeout" required:"true" default:"300s"` // timeout for remove, run_and_wait and build
	ConnectionTimeout   time.Duration `yaml:"connection_timeout" required:"true" default:"10s"`
	HAKeepaliveInterval time.Duration `yaml:"ha_keepalive_interval" required:"true" default:"16s"` // interval for node status watcher
	Statsd              string        `yaml:"statsd"`                                              // statsd host:port
	Profile             string        `yaml:"profile"`                                             // profile ip:port
	CertPath            string        `yaml:"cert_path"`                                           // docker cert files path
	MaxConcurrency      int           `yaml:"max_concurrency" default:"100000"`                    // max concurrent calls to one runtime
	Store               string        `yaml:"store" default:"etcd"`
	SentryDSN           string        `yaml:"sentry_dsn"`
	ProbeTarget         string        `yaml:"probe_target" required:"false" default:"8.8.8.8:80"` // for getting outbound address

	WALFile        string        `yaml:"wal_file" required:"true" default:"core.wal"`
	WALOpenTimeout time.Duration `yaml:"wal_open_timeout" required:"true" default:"8s"`

	Auth           AuthConfig           `yaml:"auth"` // grpc auth
	GRPCConfig     GRPCConfig           `yaml:"grpc"`
	Git            GitConfig            `yaml:"git"`
	Etcd           EtcdConfig           `yaml:"etcd"`
	Redis          RedisConfig          `yaml:"redis"`
	Docker         DockerConfig         `yaml:"docker"`
	Virt           VirtConfig           `yaml:"virt"`
	Systemd        SystemdConfig        `yaml:"systemd"`
	Scheduler      SchedulerConfig      `yaml:"scheduler"`
	ResourcePlugin ResourcePluginConfig `yaml:"resource_plugin"`
	Log            ServerLogConfig      `yaml:"log"`
}

func (Config) Identifier

func (c Config) Identifier() (string, error)

Identifier returns a sha256 over the fields that identify the backing store.

type ContextValueKey

type ContextValueKey int
const TracingID ContextValueKey = iota

type ControlWorkloadMessage

type ControlWorkloadMessage struct {
	WorkloadID string
	Error      error
	Hook       []*bytes.Buffer
}

type CopyMessage

type CopyMessage struct {
	ID        string `json:"id,omitempty"`
	Path      string `json:"path,omitempty"`
	Error     error  `json:"error,omitempty"`
	LinuxFile `json:"-"`
}

type CopyOptions

type CopyOptions struct {
	Targets map[string][]string
}

func (*CopyOptions) Validate

func (o *CopyOptions) Validate() error

type CreateWorkloadMessage

type CreateWorkloadMessage struct {
	EngineParams resourcetypes.Resources
	Resources    resourcetypes.Resources
	Podname      string
	Nodename     string
	WorkloadID   string
	WorkloadName string
	Error        error
	Publish      map[string][]string
	Hook         []*bytes.Buffer
}

type DeployOptions

type DeployOptions struct {
	Resources      resourcetypes.Resources
	Name           string
	Entrypoint     *Entrypoint
	Podname        string
	NodeFilter     *NodeFilter
	Image          string
	ExtraArgs      string // appended to the entrypoint command
	Count          int
	Env            []string
	DNS            []string
	ExtraHosts     []string
	Networks       map[string]string // network name to specified IP
	User           string
	Debug          bool // use syslog as log driver
	OpenStdin      bool
	Labels         map[string]string
	DeployStrategy string
	Files          []LinuxFile
	NodesLimit     int
	ProcessIdent   string
	IgnoreHook     bool
	AfterCreate    []string
	RawArgs        RawArgs
	Lambda         bool
	IgnorePull     bool
}

func (DeployOptions) GetProcessing

func (o DeployOptions) GetProcessing(nodename string) *Processing

func (*DeployOptions) Validate

func (o *DeployOptions) Validate() error

type DissociateWorkloadMessage

type DissociateWorkloadMessage struct {
	WorkloadID string
	Error      error
}

type DockerConfig

type DockerConfig struct {
	APIVersion  string    `yaml:"version" required:"true" default:"1.40"`
	NetworkMode string    `yaml:"network_mode" required:"true" default:"host"`
	UseLocalDNS bool      `yaml:"use_local_dns"` // use node IP as dns
	Log         LogConfig `yaml:"log"`           // docker log driver

	Hub         string                `yaml:"hub"`
	Namespace   string                `yaml:"namespace"` // image path becomes $Hub/$Namespace/$appname
	BuildPod    string                `yaml:"build_pod"` // podname used to build
	AuthConfigs map[string]AuthConfig `yaml:"auths"`     // docker registry credentials
}

type Entrypoint

type Entrypoint struct {
	Name        string            `yaml:"name,omitempty"`
	Commands    []string          `yaml:"commands,omitempty"`
	Privileged  bool              `yaml:"privileged,omitempty"`
	Dir         string            `yaml:"dir,omitempty"`
	Log         *LogConfig        `yaml:"log,omitempty"`
	Publish     []string          `yaml:"publish,omitempty,flow"`
	HealthCheck *HealthCheck      `yaml:"healthcheck,omitempty,flow"`
	Hook        *Hook             `yaml:"hook,omitempty,flow"`
	Restart     string            `yaml:"restart,omitempty"`
	Sysctls     map[string]string `yaml:"sysctls,omitempty,flow"`
}

func (*Entrypoint) Validate

func (e *Entrypoint) Validate() error

type EtcdConfig

type EtcdConfig struct {
	Machines   []string   `yaml:"machines" required:"true"`
	Prefix     string     `yaml:"prefix" required:"true" default:"/eru"` // key prefix for core data
	LockPrefix string     `yaml:"lock_prefix" required:"true" default:"__lock__/eru"`
	Ca         string     `yaml:"ca"`
	Key        string     `yaml:"key"`
	Cert       string     `yaml:"cert"`
	Auth       AuthConfig `yaml:"auth"`
}

type ExecuteWorkloadOptions

type ExecuteWorkloadOptions struct {
	WorkloadID string
	Commands   []string
	Envs       []string
	Workdir    string
	OpenStdin  bool
	ReplCmd    []byte
}

type GRPCConfig

type GRPCConfig struct {
	MaxConcurrentStreams         uint32        `yaml:"max_concurrent_streams,omitempty" json:"max_concurrent_streams,omitempty" required:"true" default:"100"`
	MaxRecvMsgSize               int           `yaml:"max_recv_msg_size,omitempty" json:"max_recv_msg_size,omitempty" required:"true" default:"20971520"`
	ServiceDiscoveryPushInterval time.Duration `yaml:"service_discovery_interval" required:"true" default:"15s"`
	ServiceHeartbeatInterval     time.Duration `yaml:"service_heartbeat_interval" required:"true" default:"15s"`
}

type GitConfig

type GitConfig struct {
	SCMType      string        `yaml:"scm_type"`    // source code manager type [gitlab/github]
	PrivateKey   string        `yaml:"private_key"` // private key to clone code
	Token        string        `yaml:"token"`       // token to call SCM API
	CloneTimeout time.Duration `yaml:"clone_timeout" default:"300s"`
}

type HealthCheck

type HealthCheck struct {
	TCPPorts []string `yaml:"tcp_ports,omitempty,flow"`
	HTTPPort string   `yaml:"http_port"`
	HTTPURL  string   `yaml:"url,omitempty"`
	HTTPCode int      `yaml:"code,omitempty"`
}

type Hook

type Hook struct {
	AfterStart    []string `yaml:"after_start,omitempty"`
	BeforeStop    []string `yaml:"before_stop,omitempty"`
	AfterResume   []string `yaml:"after_resume,omitempty"`
	BeforeSuspend []string `yaml:"before_suspend,omitempty"`
	Force         bool     `yaml:"force,omitempty"`
}

type Image

type Image struct {
	ID   string
	Tags []string
}

type ImageOptions

type ImageOptions struct {
	Podname   string
	Nodenames []string
	Images    []string
	Prune     bool
	Filter    string
}

ImageOptions carries image op options; Prune applies to remove only.

func (*ImageOptions) Validate

func (o *ImageOptions) Validate() error

type LabelMeta

type LabelMeta struct {
	Publish     []string
	HealthCheck *HealthCheck
}

type LinuxFile

type LinuxFile struct {
	Content  []byte
	Filename string
	UID      int
	GID      int
	Mode     int64
}

func (LinuxFile) Clone

func (f LinuxFile) Clone() LinuxFile

Clone deep-copies Content.

func (LinuxFile) LitterDump

func (f LinuxFile) LitterDump(w io.Writer)

LitterDump renders the file for litter.Sdump.

func (LinuxFile) String

func (f LinuxFile) String() string

type ListImageMessage

type ListImageMessage struct {
	Images   []*Image
	Nodename string
	Error    error
}

type ListNodesOptions

type ListNodesOptions struct {
	Podname  string
	Labels   map[string]string
	All      bool
	CallInfo bool
}

type ListWorkloadsOptions

type ListWorkloadsOptions struct {
	Appname    string
	Entrypoint string
	Nodename   string
	Limit      int64
	Labels     map[string]string
}

type LogConfig

type LogConfig struct {
	Type   string            `yaml:"type" required:"true" default:"journald"` // journald, json-file or none
	Config map[string]string `yaml:"config"`
}

type LogStreamMessage

type LogStreamMessage struct {
	ID    string
	Error error
	Data  []byte
	StdStreamType
}

type LogStreamOptions

type LogStreamOptions struct {
	ID     string
	Tail   string
	Since  string
	Until  string
	Follow bool
}

type Node

type Node struct {
	NodeMeta
	// Bypass excludes the node from future scheduling.
	Bypass bool `json:"bypass,omitempty"`
	// Test skips the node health check.
	Test bool `json:"test,omitempty"`

	ResourceInfo NodeResourceInfo `json:"-"`
	NodeInfo     string           `json:"-"`
	Available    bool             `json:"-"`
	Engine       engine.API       `json:"-"`
}

func (*Node) Info

func (n *Node) Info(ctx context.Context) (err error)

func (*Node) IsDown

func (n *Node) IsDown() bool

type NodeFilter

type NodeFilter struct {
	Podname  string
	Includes []string
	Excludes []string
	Labels   map[string]string
	All      bool
}

NodeFilter selects nodes in a pod by Includes, then drops Excludes.

type NodeMeta

type NodeMeta struct {
	Name     string            `json:"name"`
	Endpoint string            `json:"endpoint"`
	Podname  string            `json:"podname"`
	Labels   map[string]string `json:"labels"`

	Ca   string `json:"-"`
	Cert string `json:"-"`
	Key  string `json:"-"`
}

type NodeResourceInfo

type NodeResourceInfo struct {
	Name      string                  `json:"-"`
	Capacity  resourcetypes.Resources `json:"capacity,omitempty"`
	Usage     resourcetypes.Resources `json:"usage,omitempty"`
	Diffs     []string                `json:"diffs,omitempty"`
	Workloads []*Workload             `json:"-"`
}

type NodeStatus

type NodeStatus struct {
	Nodename string
	Podname  string
	Alive    bool
	Error    error
}

NodeStatus carries one node status stream event.

type Pod

type Pod struct {
	Name string `json:"name"`
	Desc string `json:"desc"`
}

type Processing

type Processing struct {
	Appname   string
	Entryname string
	Nodename  string
	Ident     string
}

Processing tracks the unfinished workload count for one deploy.

type PullImageMessage

type PullImageMessage struct {
	BuildImageMessage
}

PullImageMessage carries CacheImage progress.

type RawArgs

type RawArgs []byte

func (RawArgs) LitterDump

func (r RawArgs) LitterDump(w io.Writer)

LitterDump renders the raw args for litter.Sdump.

func (RawArgs) String

func (r RawArgs) String() string

type RawEngineMessage

type RawEngineMessage struct {
	ID   string `json:"id,omitempty"`
	Data []byte `json:"data,omitempty"`
}

type RawEngineOptions

type RawEngineOptions struct {
	ID         string
	Op         string
	Params     []byte
	IgnoreLock bool
}

func (*RawEngineOptions) Validate

func (o *RawEngineOptions) Validate() error

type ReallocOptions

type ReallocOptions struct {
	ID        string
	Resources resourcetypes.Resources
}

type ReallocResourceMessage

type ReallocResourceMessage struct {
	WorkloadID string
}

type RedisConfig

type RedisConfig struct {
	Addr       string `yaml:"addr" default:"localhost:6379"`
	LockPrefix string `yaml:"lock_prefix" default:"/lock"`
	DB         int    `yaml:"db" default:"0"`
}

type RemoveImageMessage

type RemoveImageMessage struct {
	Image    string
	Success  bool
	Messages []string
}

type RemoveWorkloadMessage

type RemoveWorkloadMessage struct {
	WorkloadID string
	Success    bool
	Hook       []*bytes.Buffer
}

type ReplaceOptions

type ReplaceOptions struct {
	DeployOptions
	NetworkInherit bool
	FilterLabels   map[string]string
	Copy           map[string]string
	IDs            []string
}

func (*ReplaceOptions) Normalize

func (o *ReplaceOptions) Normalize()

Normalize defaults Count to 1.

func (*ReplaceOptions) Validate

func (o *ReplaceOptions) Validate() error

Validate skips Image; pullImage in cluster/calcium checks it.

type ReplaceWorkloadMessage

type ReplaceWorkloadMessage struct {
	Create *CreateWorkloadMessage
	Remove *RemoveWorkloadMessage
	Error  error
}

type ResourcePluginConfig

type ResourcePluginConfig struct {
	Dir         string        `yaml:"dir" default:""`
	CallTimeout time.Duration `yaml:"call_timeout" default:"30s"`
	Whitelist   []string      `yaml:"whitelist"`
}

type SchedulerConfig

type SchedulerConfig struct {
	MaxShare       int `yaml:"maxshare" required:"true" default:"-1"`
	ShareBase      int `yaml:"sharebase" required:"true" default:"100"` // how many pieces for one core
	MaxDeployCount int `yaml:"max_deploy_count" default:"10000"`
}

type SendLargeFileOptions

type SendLargeFileOptions struct {
	IDs   []string
	Dst   string
	Size  int64
	Mode  int64
	UID   int
	GID   int
	Chunk []byte
}

SendLargeFileOptions carries one chunk of a SendLargeFile stream.

func (*SendLargeFileOptions) Validate

func (o *SendLargeFileOptions) Validate() error

type SendMessage

type SendMessage struct {
	ID    string `json:"id,omitempty"`
	Path  string `json:"path,omitempty"`
	Error error  `json:"error,omitempty"`
}

type SendOptions

type SendOptions struct {
	IDs   []string
	Files []LinuxFile
}

func (*SendOptions) Validate

func (o *SendOptions) Validate() error

type ServerLogConfig

type ServerLogConfig struct {
	Level      string `yaml:"level" default:"info"`
	UseJSON    bool   `yaml:"use_json"`
	Filename   string `yaml:"filename"`
	MaxSize    int    `yaml:"maxsize" default:"500"`
	MaxAge     int    `yaml:"max_age" default:"28"`
	MaxBackups int    `yaml:"max_backups" default:"3"`
}

type ServiceStatus

type ServiceStatus struct {
	Addresses []string
	Interval  time.Duration // deadline for the next expected push
}

type SetNodeOptions

type SetNodeOptions struct {
	Nodename      string
	Endpoint      string
	WorkloadsDown bool
	Resources     resourcetypes.Resources
	Delta         bool
	Labels        map[string]string
	Bypass        TriOptions
	Ca            string
	Cert          string
	Key           string
}

func (*SetNodeOptions) Validate

func (o *SetNodeOptions) Validate() error

type StatusMeta

type StatusMeta struct {
	ID string `json:"id"`

	Networks  map[string]string `json:"networks,omitempty"`
	Running   bool              `json:"running,omitempty"`
	Healthy   bool              `json:"healthy,omitempty"`
	Extension []byte            `json:"extension,omitempty"`

	// set only when writing workload status
	Appname    string `json:"-"`
	Nodename   string `json:"-"`
	Entrypoint string `json:"-"`
}

type StdStreamMessage

type StdStreamMessage struct {
	Data []byte
	StdStreamType
}

type StdStreamType

type StdStreamType int
const (
	// EruError carries an eru error, not user program output.
	EruError StdStreamType = -1
	Stdout   StdStreamType = 0
	Stderr   StdStreamType = 1
	// TypeWorkloadID carries the workload ID, not stream data.
	TypeWorkloadID StdStreamType = 6
)

type SystemdConfig

type SystemdConfig struct {
	Runtime string `yaml:"runtime" default:"io.containerd.eru.v2"`
}

type TriOptions

type TriOptions int
const (
	TriKeep TriOptions = iota
	TriTrue
	TriFalse

	SendLargeFileChunkSize = 2 << 10
)

type VirtConfig

type VirtConfig struct {
	APIVersion string `yaml:"version" default:"v1"` // Yavirtd API version
}

type Workload

type Workload struct {
	Resources    resourcetypes.Resources `json:"resources"`
	EngineParams resourcetypes.Resources `json:"engine_params"`
	ID           string                  `json:"id"`
	Name         string                  `json:"name"`
	Podname      string                  `json:"podname"`
	Nodename     string                  `json:"nodename"`
	Hook         *Hook                   `json:"hook"`
	Privileged   bool                    `json:"privileged"`
	User         string                  `json:"user"`
	Env          []string                `json:"env"`
	Image        string                  `json:"image"`
	Labels       map[string]string       `json:"labels"`
	CreateTime   int64                   `json:"create_time"`
	StatusMeta   *StatusMeta             `json:"-"`
	Engine       engine.API              `json:"-"`
}

Workload is the stored pod/node relation; use Inspect for live state.

func (*Workload) Inspect

func (*Workload) RawEngine

func (w *Workload) RawEngine(ctx context.Context, opts *RawEngineOptions) (ans *RawEngineMessage, err error)

func (*Workload) Remove

func (w *Workload) Remove(ctx context.Context, force bool) (err error)

func (*Workload) Resume

func (w *Workload) Resume(ctx context.Context) error

func (*Workload) Start

func (w *Workload) Start(ctx context.Context) error

func (*Workload) Stop

func (w *Workload) Stop(ctx context.Context, force bool) error

func (*Workload) Suspend

func (w *Workload) Suspend(ctx context.Context) error

type WorkloadStatus

type WorkloadStatus struct {
	ID       string
	Workload *Workload
	Error    error
	Delete   bool
}

Jump to

Keyboard shortcuts

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