local

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package local provides an in-process kukeonv1.Client backed by a controller.Exec. Used by the CLI in --no-daemon mode and by the daemon itself when servicing RPC calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is an in-process kukeonv1.Client.

func New

func New(ctx context.Context, logger *slog.Logger, opts controller.Options) *Client

New returns a Client that owns its controller.Exec. Close releases it.

func NewFromExec

func NewFromExec(ctrl *controller.Exec) *Client

NewFromExec wraps an already-constructed controller.Exec. The caller retains ownership of ctrl; Close is a no-op in this mode.

func (*Client) ApplyDocuments

func (c *Client) ApplyDocuments(_ context.Context, rawYAML []byte) (kukeonv1.ApplyDocumentsResult, error)

func (*Client) AttachContainer added in v0.2.0

AttachContainer enforces the Attachable gate and resolves the host-side sbsh control-socket path. Bytes never traverse this RPC — the caller (`kuke attach`) opens HostSocketPath directly and runs the sbsh client loop against it.

func (*Client) Close

func (c *Client) Close() error

Close releases the underlying controller if this Client owns it.

func (*Client) CreateCell

CreateCell normalizes the external doc, delegates to the controller, and reshapes the result back into external v1beta1 types.

func (*Client) CreateContainer

CreateContainer normalizes the external doc, delegates to the controller, and reshapes the result back into external v1beta1 types.

func (*Client) CreateRealm

CreateRealm normalizes the external doc, delegates to the controller, and reshapes the result back into external v1beta1 types.

func (*Client) CreateSpace

CreateSpace normalizes the external doc, delegates to the controller, and reshapes the result back into external v1beta1 types.

func (*Client) CreateStack

CreateStack normalizes the external doc, delegates to the controller, and reshapes the result back into external v1beta1 types.

func (*Client) DeleteCell

func (*Client) DeleteContainer

func (*Client) DeleteImage added in v0.3.0

func (c *Client) DeleteImage(_ context.Context, realm, ref string) (kukeonv1.DeleteImageResult, error)

DeleteImage removes the named image ref from the realm's containerd namespace. errdefs.ErrImageNotFound is propagated unchanged so the wire layer can emit the matching APIError Kind.

func (*Client) DeleteRealm

func (c *Client) DeleteRealm(
	_ context.Context,
	doc v1beta1.RealmDoc,
	force, cascade bool,
) (kukeonv1.DeleteRealmResult, error)

func (*Client) DeleteSpace

func (c *Client) DeleteSpace(
	_ context.Context,
	doc v1beta1.SpaceDoc,
	force, cascade bool,
) (kukeonv1.DeleteSpaceResult, error)

func (*Client) DeleteStack

func (c *Client) DeleteStack(
	_ context.Context,
	doc v1beta1.StackDoc,
	force, cascade bool,
) (kukeonv1.DeleteStackResult, error)

func (*Client) GetCell

func (*Client) GetContainer

func (*Client) GetImage added in v0.3.0

func (c *Client) GetImage(_ context.Context, realm, ref string) (kukeonv1.GetImageResult, error)

GetImage returns metadata for the named image ref in the realm. errdefs.ErrImageNotFound is propagated unchanged so the wire layer can emit the matching APIError Kind.

func (*Client) GetRealm

func (*Client) GetSpace

func (*Client) GetStack

func (*Client) KillCell

func (*Client) KillContainer

func (*Client) ListCells

func (c *Client) ListCells(_ context.Context, realmName, spaceName, stackName string) ([]v1beta1.CellDoc, error)

func (*Client) ListContainers

func (c *Client) ListContainers(
	_ context.Context,
	realmName, spaceName, stackName, cellName string,
) ([]v1beta1.ContainerSpec, error)

func (*Client) ListImages added in v0.3.0

func (c *Client) ListImages(_ context.Context, realm string) (kukeonv1.ListImagesResult, error)

ListImages enumerates images in the realm's containerd namespace. The realm is validated by the controller layer; this wrapper only re-encodes the controller's ImageInfo onto the wire type so callers never import the controller package.

func (*Client) ListRealms

func (c *Client) ListRealms(_ context.Context) ([]v1beta1.RealmDoc, error)

func (*Client) ListSpaces

func (c *Client) ListSpaces(_ context.Context, realmName string) ([]v1beta1.SpaceDoc, error)

func (*Client) ListStacks

func (c *Client) ListStacks(_ context.Context, realmName, spaceName string) ([]v1beta1.StackDoc, error)

func (*Client) LoadImage added in v0.3.0

func (c *Client) LoadImage(_ context.Context, realm string, tarball []byte) (kukeonv1.LoadImageResult, error)

LoadImage imports an OCI/docker image tarball into the realm's containerd namespace. The byte slice is wrapped in a bytes.Reader so the controller can stream it through to containerd's Import API.

func (*Client) LogContainer added in v0.3.0

LogContainer enforces the Attachable gate and resolves the host-side path of the per-container sbsh capture file. The Attachable gate is the same invariant AttachContainer uses: only sbsh-wrapped containers have a capture file. Bytes never traverse this RPC — the caller (`kuke log`) opens HostCapturePath directly.

func (*Client) Ping

func (c *Client) Ping(_ context.Context) error

Ping is a no-op in the in-process client: the controller is alive if this method can run. Implemented so *local.Client satisfies kukeonv1.Client.

func (*Client) PurgeCell

func (c *Client) PurgeCell(
	_ context.Context,
	doc v1beta1.CellDoc,
	force, cascade bool,
) (kukeonv1.PurgeCellResult, error)

func (*Client) PurgeContainer

func (*Client) PurgeRealm

func (c *Client) PurgeRealm(
	_ context.Context,
	doc v1beta1.RealmDoc,
	force, cascade bool,
) (kukeonv1.PurgeRealmResult, error)

func (*Client) PurgeSpace

func (c *Client) PurgeSpace(
	_ context.Context,
	doc v1beta1.SpaceDoc,
	force, cascade bool,
) (kukeonv1.PurgeSpaceResult, error)

func (*Client) PurgeStack

func (c *Client) PurgeStack(
	_ context.Context,
	doc v1beta1.StackDoc,
	force, cascade bool,
) (kukeonv1.PurgeStackResult, error)

func (*Client) RefreshAll

func (c *Client) RefreshAll(_ context.Context) (kukeonv1.RefreshAllResult, error)

func (*Client) StartCell

func (*Client) StartContainer

func (*Client) StopCell

func (*Client) StopContainer

func (*Client) WatchCellAutoDelete added in v0.3.0

func (c *Client) WatchCellAutoDelete(
	bgCtx context.Context,
	logger *slog.Logger,
	doc v1beta1.CellDoc,
) error

WatchCellAutoDelete spawns a background goroutine that waits for the cell's root containerd task to exit, then best-effort kills and deletes the cell. Returns immediately — the wait happens in the goroutine.

Cleanup is scoped to the cell only; it never cascades to stack/space/realm. Best-effort: if any step (Wait, Kill, Delete) fails it is logged and the goroutine exits, leaving the cell behind for the operator (or the future reconciliation loop in #161) to sweep up.

Lifetime is bound to bgCtx — when bgCtx is cancelled (daemon shutdown), the wait is abandoned and no cleanup runs. The caller (the daemon) owns passing a long-lived context; the CLI's --no-daemon path would tie the watcher to a short-lived process, so `--rm --no-daemon` is rejected at the flag layer.

Jump to

Keyboard shortcuts

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