Documentation
¶
Overview ¶
Package local provides an in-process kukeonv1.Client backed by a controller.Exec. Used by the CLI in --no-daemon mode (init, uninstall, purge *, get *, plus log/refresh/start/stop/doctor-cgroups via the `--run-path` promotion — workload commands routed through here pre-#566 were moved off to shared.DaemonClientFromCmd in phase 3), by the `kuke image *` subcommands as the always-in-process path (#226), and by the daemon itself when servicing RPC calls.
Index ¶
- type Client
- func (c *Client) ApplyDocuments(ctx context.Context, rawYAML []byte) (kukeonv1.ApplyDocumentsResult, error)
- func (c *Client) ApplyDocumentsForTeam(ctx context.Context, rawYAML []byte, team string) (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) CreateConfig(_ context.Context, doc v1beta1.CellConfigDoc) (kukeonv1.CreateConfigResult, error)
- func (c *Client) CreateRealm(_ context.Context, doc v1beta1.RealmDoc) (kukeonv1.CreateRealmResult, error)
- func (c *Client) CreateSecret(_ context.Context, doc v1beta1.SecretDoc) (kukeonv1.CreateSecretResult, 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) DeleteBlueprint(_ context.Context, doc v1beta1.CellBlueprintDoc) (kukeonv1.DeleteBlueprintResult, error)
- func (c *Client) DeleteCell(_ context.Context, doc v1beta1.CellDoc) (kukeonv1.DeleteCellResult, error)
- func (c *Client) DeleteConfig(_ context.Context, doc v1beta1.CellConfigDoc) (kukeonv1.DeleteConfigResult, error)
- func (c *Client) DeleteDocuments(_ context.Context, rawYAML []byte, cascade, force bool) (kukeonv1.DeleteDocumentsResult, 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) DeleteSecret(_ context.Context, doc v1beta1.SecretDoc) (kukeonv1.DeleteSecretResult, 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) GetBlueprint(_ context.Context, doc v1beta1.CellBlueprintDoc) (kukeonv1.GetBlueprintResult, error)
- func (c *Client) GetCell(_ context.Context, doc v1beta1.CellDoc) (kukeonv1.GetCellResult, error)
- func (c *Client) GetConfig(_ context.Context, doc v1beta1.CellConfigDoc) (kukeonv1.GetConfigResult, 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) GetSecret(_ context.Context, doc v1beta1.SecretDoc) (kukeonv1.GetSecretResult, 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) ListBlueprints(_ context.Context, realmName, spaceName, stackName string) ([]v1beta1.CellBlueprintDoc, error)
- func (c *Client) ListCells(_ context.Context, realmName, spaceName, stackName string) ([]v1beta1.CellDoc, error)
- func (c *Client) ListConfigs(_ context.Context, realmName, spaceName, stackName string) ([]v1beta1.CellConfigDoc, 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) ListSecrets(_ context.Context, realmName, spaceName, stackName, cellName string) ([]v1beta1.SecretDoc, 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) MaterializeCell(_ context.Context, doc v1beta1.CellDoc) (kukeonv1.CreateCellResult, error)
- func (c *Client) Ping(_ context.Context) error
- func (c *Client) PingVersion(_ context.Context) (string, error)
- func (c *Client) PruneImages(_ context.Context, realm string) (kukeonv1.PruneImagesResult, error)
- func (c *Client) PurgeCell(_ context.Context, doc v1beta1.CellDoc, force, cascade bool) (kukeonv1.PurgeCellResult, 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) ReconcileCells() (controller.ReconcileResult, 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) StopCell(_ context.Context, doc v1beta1.CellDoc) (kukeonv1.StopCellResult, 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) ApplyDocumentsForTeam ¶ added in v0.6.0
func (c *Client) ApplyDocumentsForTeam( ctx context.Context, rawYAML []byte, team string, ) (kukeonv1.ApplyDocumentsResult, error)
ApplyDocumentsForTeam runs the in-process equivalent of the wire RPC per-team prune-apply path (issue #1027). Empty team rejected at the boundary so a caller cannot accidentally degrade into the historical no-prune apply by passing "".
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, the server-side task- liveness 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.
Returns the SUN_PATH-safe symlink path (fs.ContainerSocketSymlinkPath) rather than the deep socket inode path so `connect(2)` never sees a sun_path longer than 107 bytes regardless of how deep the resolved metadata layout is (issue #521). The runner stages the symlink at provision time so a re-derived path on a freshly-spawned `kuke attach` is always pre-materialised.
Task-liveness gate (#852): the in-CLI cmd/kuke/shared.GuardCellTaskLiveness catches the common case, but any consumer that bypasses the CLI (raw RPC clients, scripts, in-process callers in alternative branches) would otherwise receive a socket path backed by nothing whenever the target container's task is not Running. Refuse with ErrAttachTaskNotRunning instead, mirroring the client-side guard's predicate at the server boundary so every caller — CLI or not — gets the same typed refusal.
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. Starts the cell's containers after creation; see MaterializeCell for the don't-start variant.
func (*Client) CreateConfig ¶ added in v0.6.0
func (c *Client) CreateConfig( _ context.Context, doc v1beta1.CellConfigDoc, ) (kukeonv1.CreateConfigResult, error)
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) CreateSecret ¶ added in v0.6.0
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) DeleteBlueprint ¶ added in v0.6.0
func (c *Client) DeleteBlueprint( _ context.Context, doc v1beta1.CellBlueprintDoc, ) (kukeonv1.DeleteBlueprintResult, error)
func (*Client) DeleteCell ¶
func (*Client) DeleteConfig ¶ added in v0.6.0
func (c *Client) DeleteConfig( _ context.Context, doc v1beta1.CellConfigDoc, ) (kukeonv1.DeleteConfigResult, error)
func (*Client) DeleteDocuments ¶ added in v0.6.0
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) DeleteSecret ¶ added in v0.6.0
func (*Client) DeleteSpace ¶
func (*Client) DeleteStack ¶
func (*Client) GetBlueprint ¶ added in v0.6.0
func (c *Client) GetBlueprint( _ context.Context, doc v1beta1.CellBlueprintDoc, ) (kukeonv1.GetBlueprintResult, error)
func (*Client) GetConfig ¶ added in v0.6.0
func (c *Client) GetConfig( _ context.Context, doc v1beta1.CellConfigDoc, ) (kukeonv1.GetConfigResult, error)
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) ListBlueprints ¶ added in v0.6.0
func (*Client) ListConfigs ¶ added in v0.6.0
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) ListSecrets ¶ added in v0.6.0
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 resolves the host-side path of the per-container output stream and returns it via LogContainerResult. The path varies by IO model:
- Attachable containers are sbsh-wrapped, so stdout/stderr land in the sbsh capture file at HostCapturePath (current behavior).
- Non-Attachable containers (including kukeond) have the runtime shim write stdout/stderr to HostLogPath via cio.LogFile. The file is shim-owned; kuke just hands the path back so `kuke log` can read it.
Bytes never traverse this RPC — the caller opens the returned path.
func (*Client) MaterializeCell ¶ added in v0.6.0
func (c *Client) MaterializeCell(_ context.Context, doc v1beta1.CellDoc) (kukeonv1.CreateCellResult, error)
MaterializeCell normalizes the external doc, delegates to the controller's MaterializeCell (which skips the StartCell step), and reshapes the result back into external v1beta1 types. See kukeonv1.Client.MaterializeCell for the contract.
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) PingVersion ¶ added in v0.6.0
PingVersion returns the empty string for the in-process branch: there is no separate daemon to interrogate, and pulling the running binary's version here would force this package to import cmd/config, reintroducing the autocomplete cycle (cmd/config → internal/client/local). `kuke status` only calls PingVersion on the daemon-RPC client; the in-process branch implements it just to satisfy the interface.
func (*Client) PruneImages ¶ added in v0.6.0
PruneImages reclaims dangling image layers and the orphaned leases pinning them in the realm's containerd namespace. The realm is validated by the controller layer; this wrapper only re-encodes the controller result onto the wire type.
func (*Client) PurgeRealm ¶
func (*Client) PurgeSpace ¶
func (*Client) PurgeStack ¶
func (*Client) ReconcileCells ¶ added in v0.4.0
func (c *Client) ReconcileCells() (controller.ReconcileResult, error)
ReconcileCells runs one pass of the daemon-side cell reconciliation loop. Daemon-internal: not surfaced over the kukeonv1 wire — `kuke refresh` is the on-demand, all-resources counterpart that clients use.