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 ¶
- type Client
- func (c *Client) ApplyDocuments(_ context.Context, rawYAML []byte) (kukeonv1.ApplyDocumentsResult, error)
- func (c *Client) AttachContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.AttachContainerResult, error)
- func (c *Client) Close() error
- func (c *Client) CreateCell(_ context.Context, doc v1beta1.CellDoc) (kukeonv1.CreateCellResult, error)
- func (c *Client) CreateContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.CreateContainerResult, error)
- func (c *Client) CreateRealm(_ context.Context, doc v1beta1.RealmDoc) (kukeonv1.CreateRealmResult, error)
- func (c *Client) CreateSpace(_ context.Context, doc v1beta1.SpaceDoc) (kukeonv1.CreateSpaceResult, error)
- func (c *Client) CreateStack(_ context.Context, doc v1beta1.StackDoc) (kukeonv1.CreateStackResult, error)
- func (c *Client) DeleteCell(_ context.Context, doc v1beta1.CellDoc) (kukeonv1.DeleteCellResult, error)
- func (c *Client) DeleteContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.DeleteContainerResult, error)
- func (c *Client) DeleteImage(_ context.Context, realm, ref string) (kukeonv1.DeleteImageResult, error)
- func (c *Client) DeleteRealm(_ context.Context, doc v1beta1.RealmDoc, force, cascade bool) (kukeonv1.DeleteRealmResult, error)
- func (c *Client) DeleteSpace(_ context.Context, doc v1beta1.SpaceDoc, force, cascade bool) (kukeonv1.DeleteSpaceResult, error)
- func (c *Client) DeleteStack(_ context.Context, doc v1beta1.StackDoc, force, cascade bool) (kukeonv1.DeleteStackResult, error)
- func (c *Client) GetCell(_ context.Context, doc v1beta1.CellDoc) (kukeonv1.GetCellResult, error)
- func (c *Client) GetContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.GetContainerResult, error)
- func (c *Client) GetImage(_ context.Context, realm, ref string) (kukeonv1.GetImageResult, error)
- func (c *Client) GetRealm(_ context.Context, doc v1beta1.RealmDoc) (kukeonv1.GetRealmResult, error)
- func (c *Client) GetSpace(_ context.Context, doc v1beta1.SpaceDoc) (kukeonv1.GetSpaceResult, error)
- func (c *Client) GetStack(_ context.Context, doc v1beta1.StackDoc) (kukeonv1.GetStackResult, error)
- func (c *Client) KillCell(_ context.Context, doc v1beta1.CellDoc) (kukeonv1.KillCellResult, error)
- func (c *Client) KillContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.KillContainerResult, error)
- func (c *Client) ListCells(_ context.Context, realmName, spaceName, stackName string) ([]v1beta1.CellDoc, error)
- func (c *Client) ListContainers(_ context.Context, realmName, spaceName, stackName, cellName string) ([]v1beta1.ContainerSpec, error)
- func (c *Client) ListImages(_ context.Context, realm string) (kukeonv1.ListImagesResult, error)
- func (c *Client) ListRealms(_ context.Context) ([]v1beta1.RealmDoc, error)
- func (c *Client) ListSpaces(_ context.Context, realmName string) ([]v1beta1.SpaceDoc, error)
- func (c *Client) ListStacks(_ context.Context, realmName, spaceName string) ([]v1beta1.StackDoc, error)
- func (c *Client) LoadImage(_ context.Context, realm string, tarball []byte) (kukeonv1.LoadImageResult, error)
- func (c *Client) LogContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.LogContainerResult, error)
- func (c *Client) Ping(_ context.Context) error
- func (c *Client) PurgeCell(_ context.Context, doc v1beta1.CellDoc, force, cascade bool) (kukeonv1.PurgeCellResult, error)
- func (c *Client) PurgeContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.PurgeContainerResult, error)
- func (c *Client) PurgeRealm(_ context.Context, doc v1beta1.RealmDoc, force, cascade bool) (kukeonv1.PurgeRealmResult, error)
- func (c *Client) PurgeSpace(_ context.Context, doc v1beta1.SpaceDoc, force, cascade bool) (kukeonv1.PurgeSpaceResult, error)
- func (c *Client) PurgeStack(_ context.Context, doc v1beta1.StackDoc, force, cascade bool) (kukeonv1.PurgeStackResult, error)
- func (c *Client) RefreshAll(_ context.Context) (kukeonv1.RefreshAllResult, error)
- func (c *Client) StartCell(_ context.Context, doc v1beta1.CellDoc) (kukeonv1.StartCellResult, error)
- func (c *Client) StartContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.StartContainerResult, error)
- func (c *Client) StopCell(_ context.Context, doc v1beta1.CellDoc) (kukeonv1.StopCellResult, error)
- func (c *Client) StopContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.StopContainerResult, error)
- func (c *Client) WatchCellAutoDelete(bgCtx context.Context, logger *slog.Logger, doc v1beta1.CellDoc) error
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 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 (*Client) AttachContainer ¶ added in v0.2.0
func (c *Client) AttachContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.AttachContainerResult, error)
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) CreateCell ¶
func (c *Client) CreateCell(_ context.Context, doc v1beta1.CellDoc) (kukeonv1.CreateCellResult, error)
CreateCell normalizes the external doc, delegates to the controller, and reshapes the result back into external v1beta1 types.
func (*Client) CreateContainer ¶
func (c *Client) CreateContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.CreateContainerResult, error)
CreateContainer normalizes the external doc, delegates to the controller, and reshapes the result back into external v1beta1 types.
func (*Client) CreateRealm ¶
func (c *Client) CreateRealm(_ context.Context, doc v1beta1.RealmDoc) (kukeonv1.CreateRealmResult, error)
CreateRealm normalizes the external doc, delegates to the controller, and reshapes the result back into external v1beta1 types.
func (*Client) CreateSpace ¶
func (c *Client) CreateSpace(_ context.Context, doc v1beta1.SpaceDoc) (kukeonv1.CreateSpaceResult, error)
CreateSpace normalizes the external doc, delegates to the controller, and reshapes the result back into external v1beta1 types.
func (*Client) CreateStack ¶
func (c *Client) CreateStack(_ context.Context, doc v1beta1.StackDoc) (kukeonv1.CreateStackResult, error)
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 (c *Client) DeleteContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.DeleteContainerResult, error)
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 (*Client) DeleteSpace ¶
func (*Client) DeleteStack ¶
func (*Client) GetContainer ¶
func (c *Client) GetContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.GetContainerResult, error)
func (*Client) GetImage ¶ added in v0.3.0
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) KillContainer ¶
func (c *Client) KillContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.KillContainerResult, error)
func (*Client) ListContainers ¶
func (*Client) ListImages ¶ added in v0.3.0
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 (*Client) ListSpaces ¶
func (*Client) ListStacks ¶
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
func (c *Client) LogContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.LogContainerResult, error)
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 ¶
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) PurgeContainer ¶
func (c *Client) PurgeContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.PurgeContainerResult, error)
func (*Client) PurgeRealm ¶
func (*Client) PurgeSpace ¶
func (*Client) PurgeStack ¶
func (*Client) RefreshAll ¶
func (*Client) StartContainer ¶
func (c *Client) StartContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.StartContainerResult, error)
func (*Client) StopContainer ¶
func (c *Client) StopContainer(_ context.Context, doc v1beta1.ContainerDoc) (kukeonv1.StopContainerResult, error)
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.