clabernetes

package
v0.83.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: BSD-3-Clause Imports: 65 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New returns the c9s lab runtime. It does not load the kubeconfig: the Kubernetes clients are created on the first operation that needs the cluster.

Types

type Runtime

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

func (*Runtime) Attach added in v0.83.0

Attach runs an interactive command in a node's device container, or in the container the request names, with stdin, an optional TTY and terminal resizing.

func (*Runtime) Capture added in v0.83.0

func (r *Runtime) Capture(
	ctx context.Context,
	req clablabruntime.CaptureRequest,
	w io.Writer,
) error

Capture streams pcapng from lab link interfaces to w: one section, one Interface Description Block per target in request order named <node>:<interface>, then the packets of every target.

Each node's interfaces are captured by one clabwire process in the node's pod. clabwire limits a capture to one hour, so a longer capture (or one without Duration) chains captures: the next one starts before the current one ends, and the stream switches at a cut in the overlap. See captureChain for how packets of the overlap are kept once.

Packets go out in timestamp order across nodes, through a reorder buffer (captureReorder).

Every clabwire process runs with stdin attached and --stop-on-stdin-close: a Kubernetes exec does not stop its process when the stream closes, so containerlab closes stdin whenever a segment ends (the capture ends, fails, its output fails, or a newer segment took over) and clabwire ends the capture itself.

Capture returns when Duration has passed, PacketLimit packets were written, or ctx ends; an ended ctx is not an error. Every block reaches w in one write, so the stream is a valid capture whenever it stops. A clabwire Denied or Failed audit record is returned as an error.

func (*Runtime) CaptureInterfaces added in v0.83.0

func (r *Runtime) CaptureInterfaces(
	ctx context.Context,
	req clablabruntime.NodeRequest,
) ([]clablabruntime.CaptureInterface, error)

CaptureInterfaces lists the capturable lab link interfaces of the requested nodes, or of every node, as clabwire reports them, with their peers. Node names are reported as the topology spells them.

func (*Runtime) CheckSupport added in v0.83.0

func (r *Runtime) CheckSupport(ctx context.Context, identity clablabruntime.Identity) error

CheckSupport checks that the cluster runs a clabernetes release with the contract the c9s runtime needs, and returns an error wrapping labruntime.ErrUnsupportedRuntimeVersion that names the required release when it does not. Every cluster operation runs the same check once per runtime instance; servers call it at startup to fail early.

func (*Runtime) Deploy

func (*Runtime) Destroy

func (*Runtime) DialPort added in v0.83.0

func (r *Runtime) DialPort(
	ctx context.Context,
	req clablabruntime.NodeRequest,
	port int,
) (net.Conn, error)

DialPort opens a connection to a TCP port of a node's pod through the Kubernetes port-forward subresource.

func (*Runtime) Exec

func (*Runtime) Inspect

func (*Runtime) InspectInterfaces added in v0.83.0

func (r *Runtime) InspectInterfaces(
	ctx context.Context,
	req clablabruntime.NodeRequest,
) ([]*clabtypes.ContainerInterfaces, error)

InspectInterfaces lists the interfaces of the requested nodes, or of every running node, in the shape of `inspect interfaces`, with the interfaces the interface events report: the lab link interfaces and their aliases as clabwire lists them, the management interface and loopback. Per node (named <lab>-<node> like in inspect) it reports the MAC address, index, MTU and operational state read from sysfs in the device container. A node whose device container has no shell reports its link interfaces without these attributes.

func (*Runtime) LabExists

func (r *Runtime) LabExists(
	ctx context.Context,
	req clablabruntime.InspectRequest,
) (bool, error)

func (*Runtime) List

func (*Runtime) LocateNode added in v0.83.0

LocateNode reports the pod, primary device container, Node UID and exposed ports of the requested nodes, or of every node of the lab when the request names none. Node names are accepted as the topology or as the cluster spells them.

func (*Runtime) Manifests

Manifests renders the resources a deploy would create for the topology, in the order the runtime applies them, without contacting the cluster. The bundle is the managed lab Namespace when containerlab would create one, the staged ConfigMaps every node file mounts from, and then either the Topology resource or, for a lab deployed without one, the NodeProfile, Link, and Node resources compiled client-side. Every object carries the labels the runtime relies on to discover the lab later, so a bundle applied by hand stays manageable with inspect, destroy, and the node lifecycle commands.

func (*Runtime) Plan

Plan compiles the c9s topology and returns the complete primitive/configuration diff against the running cluster without changing any resource.

func (*Runtime) Restart

func (r *Runtime) Restart(ctx context.Context, req clablabruntime.NodeRequest) error

Restart replaces the Pod of every requested node once, through a new restart token on its primary Node. A stopped node is started with the same patch.

func (*Runtime) SampleStats added in v0.83.0

SampleStats reports the CPU and memory usage of every running node of a lab from the resource metrics API, summing the node's device containers.

func (*Runtime) Save

func (*Runtime) Start

func (*Runtime) Stop

func (*Runtime) StreamEvents

func (r *Runtime) StreamEvents(
	ctx context.Context,
	req clablabruntime.EventStreamRequest,
) (<-chan clablabruntime.Event, <-chan error, error)

func (*Runtime) StreamLogs added in v0.83.0

func (r *Runtime) StreamLogs(
	ctx context.Context,
	req clablabruntime.LogRequest,
	w io.Writer,
) error

StreamLogs writes the log of a node's device container, or of the container the request names, to w.

func (*Runtime) Validate

func (r *Runtime) Validate(ctx context.Context, req clablabruntime.DeployRequest) error

Validate compiles the containerlab/c9s subset and stages all local-path inputs in memory. Lossy-but-deployable fields produce warnings; structurally impossible constructs remain errors. Validation deliberately performs no Kubernetes reads or writes.

Jump to

Keyboard shortcuts

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