source

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownWorkload = errors.New("no runtime on this node knows this workload")

Functions

func ActionOf

func ActionOf(running bool) string

ActionOf turns a runtime's liveness answer into the event action the manager handles.

func Addr

func Addr(networks map[string]string) string

Addr returns the workload's own address, empty when the runtime has given it none.

func PipeEvents

func PipeEvents(ctx context.Context, reporter *Reporter, watchers ...WatchFunc) (<-chan *types.WorkloadEventMessage, <-chan error)

Types

type EmitFunc

type EmitFunc func(ID, action string)

EmitFunc hands one workload's state change to the manager.

type Log

type Log struct {
	JournalUnit   string
	ConsoleSocket string
}

Log locates a workload's output: a journal unit or a vm console.

type Meta

type Meta struct {
	Appname     string
	Entrypoint  string
	Ident       string
	Podname     string
	Nodename    string
	CoreID      string
	Labels      map[string]string
	HealthCheck *coretypes.HealthCheck
	Networks    map[string]string
}

Meta is the workload metadata core wrote when it created the workload.

type Multi

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

Multi presents every runtime a node hosts as one source.

func (*Multi) Alive

func (m *Multi) Alive(ctx context.Context) bool

Alive reports whether every runtime the node hosts is up.

func (*Multi) Events

func (m *Multi) Events(ctx context.Context) (<-chan *types.WorkloadEventMessage, <-chan error)

func (*Multi) Get

func (m *Multi) Get(ctx context.Context, ID string) (*Workload, error)

Get asks every runtime in turn, since a workload id says nothing about which one runs it.

func (*Multi) List

func (m *Multi) List(ctx context.Context) ([]*Workload, error)

func (*Multi) Refresh

func (m *Multi) Refresh(ID string) (*Workload, error)

type Refresher

type Refresher interface {
	Refresh(ID string) (*Workload, error)
}

type Reporter

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

Reporter drops the state changes that repeat what a source last said about a workload.

func NewReporter

func NewReporter() *Reporter

func (*Reporter) Attach

func (r *Reporter) Attach(emit EmitFunc) func()

func (*Reporter) Gone

func (r *Reporter) Gone(ID string)

func (*Reporter) Known

func (r *Reporter) Known(ID string) bool

func (*Reporter) Note

func (r *Reporter) Note(ID, action string)

Note records what a listing found: news about a workload already tracked, and a starting point for one that is not.

func (*Reporter) Report

func (r *Reporter) Report(ID, action string)

Report emits action unless it is what this workload was last reported as.

type Source

type Source interface {
	List(ctx context.Context) ([]*Workload, error)
	Get(ctx context.Context, ID string) (*Workload, error)
	Events(ctx context.Context) (<-chan *types.WorkloadEventMessage, <-chan error)
	Alive(ctx context.Context) bool
}

Source is one runtime's view of the workloads this node runs.

func NewMulti

func NewMulti(sources ...Source) Source

NewMulti fans out over the runtimes a node hosts; a node with one runtime needs no fan-out.

type WatchFunc

type WatchFunc func(ctx context.Context) error

type Workload

type Workload struct {
	ID   string
	Meta Meta
	Log  Log

	CgroupPath        string
	NetnsPID          int
	HostIface         string
	HostIfaceMirrored bool

	LocalIP string
	Running bool
}

Workload is everything a source knows about one workload.

func (*Workload) LogFields

func (w *Workload) LogFields() map[string]string

LogFields returns the extra fields every log record of this workload carries.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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