kukeonv1

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package kukeonv1 is the public client SDK for the kukeon daemon. It exposes a transport-agnostic Client interface; Dial picks a concrete implementation (unix socket JSON-RPC today, ssh tunnel in the future) based on the address scheme.

Index

Constants

View Source
const (
	MethodCreateRealm     = ServiceName + ".CreateRealm"
	MethodCreateSpace     = ServiceName + ".CreateSpace"
	MethodCreateStack     = ServiceName + ".CreateStack"
	MethodCreateCell      = ServiceName + ".CreateCell"
	MethodCreateContainer = ServiceName + ".CreateContainer"

	MethodGetRealm     = ServiceName + ".GetRealm"
	MethodGetSpace     = ServiceName + ".GetSpace"
	MethodGetStack     = ServiceName + ".GetStack"
	MethodGetCell      = ServiceName + ".GetCell"
	MethodGetContainer = ServiceName + ".GetContainer"

	MethodListRealms     = ServiceName + ".ListRealms"
	MethodListSpaces     = ServiceName + ".ListSpaces"
	MethodListStacks     = ServiceName + ".ListStacks"
	MethodListCells      = ServiceName + ".ListCells"
	MethodListContainers = ServiceName + ".ListContainers"

	MethodStartCell       = ServiceName + ".StartCell"
	MethodStartContainer  = ServiceName + ".StartContainer"
	MethodAttachContainer = ServiceName + ".AttachContainer"
	MethodLogContainer    = ServiceName + ".LogContainer"
	MethodStopCell        = ServiceName + ".StopCell"
	MethodStopContainer   = ServiceName + ".StopContainer"
	MethodKillCell        = ServiceName + ".KillCell"
	MethodKillContainer   = ServiceName + ".KillContainer"

	MethodDeleteRealm     = ServiceName + ".DeleteRealm"
	MethodDeleteSpace     = ServiceName + ".DeleteSpace"
	MethodDeleteStack     = ServiceName + ".DeleteStack"
	MethodDeleteCell      = ServiceName + ".DeleteCell"
	MethodDeleteContainer = ServiceName + ".DeleteContainer"

	MethodPurgeRealm     = ServiceName + ".PurgeRealm"
	MethodPurgeSpace     = ServiceName + ".PurgeSpace"
	MethodPurgeStack     = ServiceName + ".PurgeStack"
	MethodPurgeCell      = ServiceName + ".PurgeCell"
	MethodPurgeContainer = ServiceName + ".PurgeContainer"

	MethodRefreshAll     = ServiceName + ".RefreshAll"
	MethodApplyDocuments = ServiceName + ".ApplyDocuments"
	MethodLoadImage      = ServiceName + ".LoadImage"
	MethodListImages     = ServiceName + ".ListImages"
	MethodGetImage       = ServiceName + ".GetImage"
	MethodDeleteImage    = ServiceName + ".DeleteImage"

	MethodPing = ServiceName + ".Ping"
)

Fully-qualified method names used on the wire.

View Source
const ServiceName = "KukeonV1"

ServiceName is the net/rpc service name registered by the daemon. The "V1" suffix is the wire version prefix; breaking changes land on "KukeonV2".

Variables

View Source
var ErrUnexpectedCall = errors.New("unexpected kukeonv1 client call")

ErrUnexpectedCall is returned by FakeClient methods that have not been overridden by the test. Tests that want to assert "this method was not called" can match on errors.Is(err, ErrUnexpectedCall).

View Source
var ErrUnsupportedScheme = errors.New("unsupported kukeon host scheme")

ErrUnsupportedScheme is returned by Dial when the address scheme cannot be served by any compiled-in transport.

Functions

func FromAPIError

func FromAPIError(e *APIError) error

FromAPIError reconstructs a Go error that unwraps to the matching errdefs sentinel when the Kind is recognized, so callers can use errors.Is. The error's Error() returns the verbatim wire Message (no prefix added): the server already embeds the sentinel in the message via %w wrapping, and we don't want to stutter "failed to X: failed to X: ...".

func KindFromError

func KindFromError(err error) string

KindFromError inspects err and returns the best-matching wire Kind, falling back to "Unknown" when nothing registered matches.

Types

type APIError

type APIError struct {
	Kind    string
	Message string
}

APIError is a serializable error. Kind identifies the error class; client code maps it back to an errdefs.* sentinel so that errors.Is(err, errdefs.X) keeps working across the wire.

func ToAPIError

func ToAPIError(err error) *APIError

ToAPIError converts a Go error into a wire APIError. Returns nil for nil.

func (*APIError) Error

func (e *APIError) Error() string

type ApplyDocumentsArgs

type ApplyDocumentsArgs struct {
	RawYAML []byte
}

ApplyDocumentsArgs carries a raw multi-document YAML blob. The server parses and validates; validation errors are returned in the Reply.Err.

type ApplyDocumentsReply

type ApplyDocumentsReply struct {
	Result ApplyDocumentsResult
	Err    *APIError
}

type ApplyDocumentsResult

type ApplyDocumentsResult struct {
	Resources []ApplyResourceResult
}

type ApplyResourceResult

type ApplyResourceResult struct {
	Index   int
	Kind    string
	Name    string
	Action  string
	Error   string
	Changes []string
	Details map[string]string
}

type AttachContainerArgs added in v0.2.0

type AttachContainerArgs struct {
	Doc v1beta1.ContainerDoc
}

AttachContainerArgs identifies the target container for an attach request.

type AttachContainerReply added in v0.2.0

type AttachContainerReply struct {
	Result AttachContainerResult
	Err    *APIError
}

type AttachContainerResult added in v0.2.0

type AttachContainerResult struct {
	// HostSocketPath is the host path of the per-container sbsh terminal
	// socket. Inside the container the same inode is reachable at
	// /run/kukeon/tty/socket via the tty directory bind mount. Returned only
	// when the target container has Attachable=true; otherwise the daemon
	// errors with ErrAttachNotSupported.
	HostSocketPath string
}

AttachContainerResult carries the host-side coordinates the `kuke attach` client needs to drive the sbsh terminal. Bytes never traverse this RPC — the client opens HostSocketPath directly.

type Client

type Client interface {
	io.Closer

	CreateRealm(ctx context.Context, doc v1beta1.RealmDoc) (CreateRealmResult, error)
	CreateSpace(ctx context.Context, doc v1beta1.SpaceDoc) (CreateSpaceResult, error)
	CreateStack(ctx context.Context, doc v1beta1.StackDoc) (CreateStackResult, error)
	CreateCell(ctx context.Context, doc v1beta1.CellDoc) (CreateCellResult, error)
	CreateContainer(ctx context.Context, doc v1beta1.ContainerDoc) (CreateContainerResult, error)

	GetRealm(ctx context.Context, doc v1beta1.RealmDoc) (GetRealmResult, error)
	GetSpace(ctx context.Context, doc v1beta1.SpaceDoc) (GetSpaceResult, error)
	GetStack(ctx context.Context, doc v1beta1.StackDoc) (GetStackResult, error)
	GetCell(ctx context.Context, doc v1beta1.CellDoc) (GetCellResult, error)
	GetContainer(ctx context.Context, doc v1beta1.ContainerDoc) (GetContainerResult, error)

	ListRealms(ctx context.Context) ([]v1beta1.RealmDoc, error)
	ListSpaces(ctx context.Context, realmName string) ([]v1beta1.SpaceDoc, error)
	ListStacks(ctx context.Context, realmName, spaceName string) ([]v1beta1.StackDoc, error)
	ListCells(ctx context.Context, realmName, spaceName, stackName string) ([]v1beta1.CellDoc, error)
	ListContainers(
		ctx context.Context,
		realmName, spaceName, stackName, cellName string,
	) ([]v1beta1.ContainerSpec, error)

	StartCell(ctx context.Context, doc v1beta1.CellDoc) (StartCellResult, error)
	StartContainer(ctx context.Context, doc v1beta1.ContainerDoc) (StartContainerResult, error)
	// AttachContainer is the placeholder endpoint shipped in #57. It only
	// validates that the target container has Attachable=true; the
	// terminal-bridge client lands in #66.
	AttachContainer(ctx context.Context, doc v1beta1.ContainerDoc) (AttachContainerResult, error)
	// LogContainer validates that the target container has Attachable=true
	// and resolves the host-side path of the per-container sbsh capture
	// file. Bytes never traverse this RPC — the caller (`kuke log`) reads
	// the file directly. Same Attachable gate as AttachContainer: only
	// containers wrapped by sbsh have a capture file to surface.
	LogContainer(ctx context.Context, doc v1beta1.ContainerDoc) (LogContainerResult, error)
	StopCell(ctx context.Context, doc v1beta1.CellDoc) (StopCellResult, error)
	StopContainer(ctx context.Context, doc v1beta1.ContainerDoc) (StopContainerResult, error)
	KillCell(ctx context.Context, doc v1beta1.CellDoc) (KillCellResult, error)
	KillContainer(ctx context.Context, doc v1beta1.ContainerDoc) (KillContainerResult, error)

	DeleteRealm(ctx context.Context, doc v1beta1.RealmDoc, force, cascade bool) (DeleteRealmResult, error)
	DeleteSpace(ctx context.Context, doc v1beta1.SpaceDoc, force, cascade bool) (DeleteSpaceResult, error)
	DeleteStack(ctx context.Context, doc v1beta1.StackDoc, force, cascade bool) (DeleteStackResult, error)
	DeleteCell(ctx context.Context, doc v1beta1.CellDoc) (DeleteCellResult, error)
	DeleteContainer(ctx context.Context, doc v1beta1.ContainerDoc) (DeleteContainerResult, error)

	PurgeRealm(ctx context.Context, doc v1beta1.RealmDoc, force, cascade bool) (PurgeRealmResult, error)
	PurgeSpace(ctx context.Context, doc v1beta1.SpaceDoc, force, cascade bool) (PurgeSpaceResult, error)
	PurgeStack(ctx context.Context, doc v1beta1.StackDoc, force, cascade bool) (PurgeStackResult, error)
	PurgeCell(ctx context.Context, doc v1beta1.CellDoc, force, cascade bool) (PurgeCellResult, error)
	PurgeContainer(ctx context.Context, doc v1beta1.ContainerDoc) (PurgeContainerResult, error)

	RefreshAll(ctx context.Context) (RefreshAllResult, error)
	ApplyDocuments(ctx context.Context, rawYAML []byte) (ApplyDocumentsResult, error)

	// LoadImage imports an OCI/docker image tarball into the named realm's
	// containerd namespace. The tarball ships in-band; see LoadImageArgs.
	LoadImage(ctx context.Context, realm string, tarball []byte) (LoadImageResult, error)

	// ListImages enumerates images in the named realm's containerd
	// namespace.
	ListImages(ctx context.Context, realm string) (ListImagesResult, error)

	// GetImage returns metadata for the named image ref in the named
	// realm. errdefs.ErrImageNotFound is returned when the ref is absent.
	GetImage(ctx context.Context, realm, ref string) (GetImageResult, error)

	// DeleteImage removes the named image ref from the named realm's
	// containerd namespace. errdefs.ErrImageNotFound is returned when
	// the ref does not exist.
	DeleteImage(ctx context.Context, realm, ref string) (DeleteImageResult, error)

	Ping(ctx context.Context) error
}

Client is the transport-agnostic interface for programmatic access to kukeon primitives. All wire types are drawn from pkg/api/model/v1beta1.

func Dial

func Dial(_ context.Context, addr string) (Client, error)

Dial parses addr and returns a connected Client.

Supported schemes:

  • unix:///absolute/path/to/socket

Planned schemes:

  • ssh://user@host[:port] (tunnels to the remote unix socket)

type ContainerCreationOutcome

type ContainerCreationOutcome struct {
	Name       string
	ExistsPre  bool
	ExistsPost bool
	Created    bool
}

type CreateCellArgs

type CreateCellArgs struct {
	Doc v1beta1.CellDoc
}

CreateCellArgs is the wire request for CreateCell.

type CreateCellReply

type CreateCellReply struct {
	Result CreateCellResult
	Err    *APIError
}

CreateCellReply is the wire response for CreateCell. Err is non-nil on failure so structured errdefs.* sentinels survive the wire roundtrip.

type CreateCellResult

type CreateCellResult struct {
	Cell v1beta1.CellDoc

	MetadataExistsPre       bool
	MetadataExistsPost      bool
	CgroupExistsPre         bool
	CgroupExistsPost        bool
	CgroupCreated           bool
	RootContainerExistsPre  bool
	RootContainerExistsPost bool
	RootContainerCreated    bool
	StartedPre              bool
	StartedPost             bool
	Started                 bool
	Created                 bool

	Containers []ContainerCreationOutcome
}

CreateCellResult mirrors internal/controller.CreateCellResult using external v1beta1 types, so it is safe to serialize and return to non-privileged callers.

type CreateContainerArgs

type CreateContainerArgs struct {
	Doc v1beta1.ContainerDoc
}

type CreateContainerReply

type CreateContainerReply struct {
	Result CreateContainerResult
	Err    *APIError
}

type CreateContainerResult

type CreateContainerResult struct {
	Container v1beta1.ContainerDoc

	CellMetadataExistsPre  bool
	CellMetadataExistsPost bool
	ContainerExistsPre     bool
	ContainerExistsPost    bool
	ContainerCreated       bool
	Started                bool
}

type CreateRealmArgs

type CreateRealmArgs struct {
	Doc v1beta1.RealmDoc
}

type CreateRealmReply

type CreateRealmReply struct {
	Result CreateRealmResult
	Err    *APIError
}

type CreateRealmResult

type CreateRealmResult struct {
	Realm v1beta1.RealmDoc

	MetadataExistsPre             bool
	MetadataExistsPost            bool
	CgroupExistsPre               bool
	CgroupExistsPost              bool
	CgroupCreated                 bool
	ContainerdNamespaceExistsPre  bool
	ContainerdNamespaceExistsPost bool
	ContainerdNamespaceCreated    bool
	Created                       bool
}

type CreateSpaceArgs

type CreateSpaceArgs struct {
	Doc v1beta1.SpaceDoc
}

type CreateSpaceReply

type CreateSpaceReply struct {
	Result CreateSpaceResult
	Err    *APIError
}

type CreateSpaceResult

type CreateSpaceResult struct {
	Space v1beta1.SpaceDoc

	MetadataExistsPre    bool
	MetadataExistsPost   bool
	CgroupExistsPre      bool
	CgroupExistsPost     bool
	CgroupCreated        bool
	CNINetworkExistsPre  bool
	CNINetworkExistsPost bool
	CNINetworkCreated    bool
	Created              bool
}

type CreateStackArgs

type CreateStackArgs struct {
	Doc v1beta1.StackDoc
}

type CreateStackReply

type CreateStackReply struct {
	Result CreateStackResult
	Err    *APIError
}

type CreateStackResult

type CreateStackResult struct {
	Stack v1beta1.StackDoc

	MetadataExistsPre  bool
	MetadataExistsPost bool
	CgroupExistsPre    bool
	CgroupExistsPost   bool
	CgroupCreated      bool
	Created            bool
}

type DeleteCellArgs

type DeleteCellArgs struct {
	Doc v1beta1.CellDoc
}

type DeleteCellReply

type DeleteCellReply struct {
	Result DeleteCellResult
	Err    *APIError
}

type DeleteCellResult

type DeleteCellResult struct {
	Cell              v1beta1.CellDoc
	ContainersDeleted bool
	CgroupDeleted     bool
	MetadataDeleted   bool
}

type DeleteContainerArgs

type DeleteContainerArgs struct {
	Doc v1beta1.ContainerDoc
}

type DeleteContainerReply

type DeleteContainerReply struct {
	Result DeleteContainerResult
	Err    *APIError
}

type DeleteContainerResult

type DeleteContainerResult struct {
	Container          v1beta1.ContainerDoc
	CellMetadataExists bool
	ContainerExists    bool
	Deleted            []string
}

type DeleteImageArgs added in v0.3.0

type DeleteImageArgs struct {
	Realm string
	Ref   string
}

DeleteImageArgs is the wire request for DeleteImage.

type DeleteImageReply added in v0.3.0

type DeleteImageReply struct {
	Result DeleteImageResult
	Err    *APIError
}

DeleteImageReply is the wire response for DeleteImage.

type DeleteImageResult added in v0.3.0

type DeleteImageResult struct {
	Realm     string
	Namespace string
	Ref       string
}

DeleteImageResult reports the outcome of a `kuke image delete` removal.

type DeleteRealmArgs

type DeleteRealmArgs struct {
	Doc     v1beta1.RealmDoc
	Force   bool
	Cascade bool
}

type DeleteRealmReply

type DeleteRealmReply struct {
	Result DeleteRealmResult
	Err    *APIError
}

type DeleteRealmResult

type DeleteRealmResult struct {
	Realm                      v1beta1.RealmDoc
	Deleted                    []string
	MetadataDeleted            bool
	CgroupDeleted              bool
	ContainerdNamespaceDeleted bool
}

type DeleteSpaceArgs

type DeleteSpaceArgs struct {
	Doc     v1beta1.SpaceDoc
	Force   bool
	Cascade bool
}

type DeleteSpaceReply

type DeleteSpaceReply struct {
	Result DeleteSpaceResult
	Err    *APIError
}

type DeleteSpaceResult

type DeleteSpaceResult struct {
	Space             v1beta1.SpaceDoc
	SpaceName         string
	RealmName         string
	MetadataDeleted   bool
	CgroupDeleted     bool
	CNINetworkDeleted bool
	Deleted           []string
}

type DeleteStackArgs

type DeleteStackArgs struct {
	Doc     v1beta1.StackDoc
	Force   bool
	Cascade bool
}

type DeleteStackReply

type DeleteStackReply struct {
	Result DeleteStackResult
	Err    *APIError
}

type DeleteStackResult

type DeleteStackResult struct {
	Stack           v1beta1.StackDoc
	StackName       string
	RealmName       string
	SpaceName       string
	MetadataDeleted bool
	CgroupDeleted   bool
	Deleted         []string
}

type FakeClient

type FakeClient struct{}

FakeClient is a Client with every method returning ErrUnexpectedCall. Embed it into a per-test fake and override only the methods under test. Close() is a no-op so deferred client.Close() calls never fail.

func (FakeClient) ApplyDocuments

func (FakeClient) ApplyDocuments(context.Context, []byte) (ApplyDocumentsResult, error)

func (FakeClient) AttachContainer added in v0.2.0

func (FakeClient) Close

func (FakeClient) Close() error

func (FakeClient) CreateCell

func (FakeClient) CreateRealm

func (FakeClient) CreateSpace

func (FakeClient) CreateStack

func (FakeClient) DeleteCell

func (FakeClient) DeleteImage added in v0.3.0

func (FakeClient) DeleteRealm

func (FakeClient) DeleteSpace

func (FakeClient) DeleteStack

func (FakeClient) GetCell

func (FakeClient) GetImage added in v0.3.0

func (FakeClient) GetRealm

func (FakeClient) GetSpace

func (FakeClient) GetStack

func (FakeClient) KillCell

func (FakeClient) ListCells

func (FakeClient) ListContainers

func (FakeClient) ListImages added in v0.3.0

func (FakeClient) ListRealms

func (FakeClient) ListRealms(context.Context) ([]v1beta1.RealmDoc, error)

func (FakeClient) ListSpaces

func (FakeClient) ListStacks

func (FakeClient) LoadImage added in v0.3.0

func (FakeClient) LogContainer added in v0.3.0

func (FakeClient) Ping

func (FakeClient) PurgeCell

func (FakeClient) PurgeRealm

func (FakeClient) PurgeSpace

func (FakeClient) PurgeStack

func (FakeClient) RefreshAll

func (FakeClient) StartCell

func (FakeClient) StopCell

type GetCellArgs

type GetCellArgs struct {
	Doc v1beta1.CellDoc
}

type GetCellReply

type GetCellReply struct {
	Result GetCellResult
	Err    *APIError
}

type GetCellResult

type GetCellResult struct {
	Cell                v1beta1.CellDoc
	MetadataExists      bool
	CgroupExists        bool
	RootContainerExists bool
}

type GetContainerArgs

type GetContainerArgs struct {
	Doc v1beta1.ContainerDoc
}

type GetContainerReply

type GetContainerReply struct {
	Result GetContainerResult
	Err    *APIError
}

type GetContainerResult

type GetContainerResult struct {
	Container          v1beta1.ContainerDoc
	CellMetadataExists bool
	ContainerExists    bool
}

type GetImageArgs added in v0.3.0

type GetImageArgs struct {
	Realm string
	Ref   string
}

GetImageArgs is the wire request for GetImage.

type GetImageReply added in v0.3.0

type GetImageReply struct {
	Result GetImageResult
	Err    *APIError
}

GetImageReply is the wire response for GetImage.

type GetImageResult added in v0.3.0

type GetImageResult struct {
	Realm     string
	Namespace string
	Image     ImageInfo
}

GetImageResult carries the metadata of one named image in a realm.

type GetRealmArgs

type GetRealmArgs struct {
	Doc v1beta1.RealmDoc
}

type GetRealmReply

type GetRealmReply struct {
	Result GetRealmResult
	Err    *APIError
}

type GetRealmResult

type GetRealmResult struct {
	Realm                     v1beta1.RealmDoc
	MetadataExists            bool
	CgroupExists              bool
	ContainerdNamespaceExists bool
}

type GetSpaceArgs

type GetSpaceArgs struct {
	Doc v1beta1.SpaceDoc
}

type GetSpaceReply

type GetSpaceReply struct {
	Result GetSpaceResult
	Err    *APIError
}

type GetSpaceResult

type GetSpaceResult struct {
	Space            v1beta1.SpaceDoc
	MetadataExists   bool
	CgroupExists     bool
	CNINetworkExists bool
}

type GetStackArgs

type GetStackArgs struct {
	Doc v1beta1.StackDoc
}

type GetStackReply

type GetStackReply struct {
	Result GetStackResult
	Err    *APIError
}

type GetStackResult

type GetStackResult struct {
	Stack          v1beta1.StackDoc
	MetadataExists bool
	CgroupExists   bool
}

type ImageInfo added in v0.3.0

type ImageInfo struct {
	Name      string
	Size      int64
	CreatedAt time.Time
	Digest    string
	MediaType string
	Labels    map[string]string
}

ImageInfo is the wire view of one containerd image. Size is best-effort: the daemon emits -1 when containerd cannot resolve the size locally so the CLI can render "-" rather than "0 B".

type KillCellArgs

type KillCellArgs struct {
	Doc v1beta1.CellDoc
}

type KillCellReply

type KillCellReply struct {
	Result KillCellResult
	Err    *APIError
}

type KillCellResult

type KillCellResult struct {
	Cell   v1beta1.CellDoc
	Killed bool
}

type KillContainerArgs

type KillContainerArgs struct {
	Doc v1beta1.ContainerDoc
}

type KillContainerReply

type KillContainerReply struct {
	Result KillContainerResult
	Err    *APIError
}

type KillContainerResult

type KillContainerResult struct {
	Container v1beta1.ContainerDoc
	Killed    bool
}

type ListCellsArgs

type ListCellsArgs struct {
	RealmName string
	SpaceName string
	StackName string
}

type ListCellsReply

type ListCellsReply struct {
	Cells []v1beta1.CellDoc
	Err   *APIError
}

type ListContainersArgs

type ListContainersArgs struct {
	RealmName string
	SpaceName string
	StackName string
	CellName  string
}

type ListContainersReply

type ListContainersReply struct {
	Containers []v1beta1.ContainerSpec
	Err        *APIError
}

type ListImagesArgs added in v0.3.0

type ListImagesArgs struct {
	Realm string
}

ListImagesArgs is the wire request for ListImages.

type ListImagesReply added in v0.3.0

type ListImagesReply struct {
	Result ListImagesResult
	Err    *APIError
}

ListImagesReply is the wire response for ListImages.

type ListImagesResult added in v0.3.0

type ListImagesResult struct {
	Realm     string
	Namespace string
	Images    []ImageInfo
}

ListImagesResult lists the images present in a realm's containerd namespace.

type ListRealmsArgs

type ListRealmsArgs struct{}

type ListRealmsReply

type ListRealmsReply struct {
	Realms []v1beta1.RealmDoc
	Err    *APIError
}

type ListSpacesArgs

type ListSpacesArgs struct {
	RealmName string
}

type ListSpacesReply

type ListSpacesReply struct {
	Spaces []v1beta1.SpaceDoc
	Err    *APIError
}

type ListStacksArgs

type ListStacksArgs struct {
	RealmName string
	SpaceName string
}

type ListStacksReply

type ListStacksReply struct {
	Stacks []v1beta1.StackDoc
	Err    *APIError
}

type LoadImageArgs added in v0.3.0

type LoadImageArgs struct {
	Realm   string
	Tarball []byte
}

LoadImageArgs carries an OCI/docker image tarball plus the target realm. The tarball ships as a byte slice (mirroring ApplyDocumentsArgs.RawYAML); phase 1 sizes are bounded by the dev loop (≈100MB), so JSON-RPC roundtrip cost is acceptable. Larger payloads will move to a streaming endpoint when the multi-host story arrives.

type LoadImageReply added in v0.3.0

type LoadImageReply struct {
	Result LoadImageResult
	Err    *APIError
}

type LoadImageResult added in v0.3.0

type LoadImageResult struct {
	Realm     string
	Namespace string
	Images    []string
}

type LogContainerArgs added in v0.3.0

type LogContainerArgs struct {
	Doc v1beta1.ContainerDoc
}

LogContainerArgs identifies the target container for a log request.

type LogContainerReply added in v0.3.0

type LogContainerReply struct {
	Result LogContainerResult
	Err    *APIError
}

type LogContainerResult added in v0.3.0

type LogContainerResult struct {
	// HostCapturePath is the host path of the per-container sbsh capture
	// file. Inside the container the same inode is reachable at
	// /run/kukeon/tty/capture via the tty directory bind mount. Set only
	// when the target container has Attachable=true.
	HostCapturePath string

	// HostLogPath is the host path of the per-container log file written
	// by the containerd runtime shim (cio.LogFile mode). Set only for
	// non-Attachable containers; the file is shim-owned, kuke only reads.
	HostLogPath string
}

LogContainerResult carries the host-side coordinates the `kuke log` client needs to read the per-container output stream. Bytes never traverse this RPC — the client opens the returned host path directly.

Exactly one of HostCapturePath or HostLogPath is non-empty:

  • Attachable containers route stdout/stderr through the sbsh terminal wrapper, which writes a tty byte stream to HostCapturePath.
  • Non-Attachable containers (including kukeond) have the runtime shim append stdout/stderr to HostLogPath via cio.LogFile.

type PingArgs

type PingArgs struct{}

PingArgs is the empty request payload for the Ping RPC.

type PingReply

type PingReply struct {
	OK      bool
	Version string
	Err     *APIError
}

PingReply carries the daemon's ack plus the daemon build version. Clients use Ping to confirm the RPC handler is serving (not just that the socket exists).

type PurgeCellArgs

type PurgeCellArgs struct {
	Doc     v1beta1.CellDoc
	Force   bool
	Cascade bool
}

type PurgeCellReply

type PurgeCellReply struct {
	Result PurgeCellResult
	Err    *APIError
}

type PurgeCellResult

type PurgeCellResult struct {
	Cell              v1beta1.CellDoc
	ContainersDeleted bool
	CgroupDeleted     bool
	MetadataDeleted   bool
	PurgeSucceeded    bool
	Force             bool
	Cascade           bool
	Deleted           []string
	Purged            []string
}

type PurgeContainerArgs

type PurgeContainerArgs struct {
	Doc v1beta1.ContainerDoc
}

type PurgeContainerReply

type PurgeContainerReply struct {
	Result PurgeContainerResult
	Err    *APIError
}

type PurgeContainerResult

type PurgeContainerResult struct {
	Container          v1beta1.ContainerDoc
	CellMetadataExists bool
	ContainerExists    bool
	Deleted            []string
	Purged             []string
}

type PurgeRealmArgs

type PurgeRealmArgs struct {
	Doc     v1beta1.RealmDoc
	Force   bool
	Cascade bool
}

type PurgeRealmReply

type PurgeRealmReply struct {
	Result PurgeRealmResult
	Err    *APIError
}

type PurgeRealmResult

type PurgeRealmResult struct {
	Realm          v1beta1.RealmDoc
	RealmDeleted   bool
	PurgeSucceeded bool
	Force          bool
	Cascade        bool
	Deleted        []string
	Purged         []string
}

type PurgeSpaceArgs

type PurgeSpaceArgs struct {
	Doc     v1beta1.SpaceDoc
	Force   bool
	Cascade bool
}

type PurgeSpaceReply

type PurgeSpaceReply struct {
	Result PurgeSpaceResult
	Err    *APIError
}

type PurgeSpaceResult

type PurgeSpaceResult struct {
	Space             v1beta1.SpaceDoc
	MetadataDeleted   bool
	CgroupDeleted     bool
	CNINetworkDeleted bool
	PurgeSucceeded    bool
	Force             bool
	Cascade           bool
	Deleted           []string
	Purged            []string
}

type PurgeStackArgs

type PurgeStackArgs struct {
	Doc     v1beta1.StackDoc
	Force   bool
	Cascade bool
}

type PurgeStackReply

type PurgeStackReply struct {
	Result PurgeStackResult
	Err    *APIError
}

type PurgeStackResult

type PurgeStackResult struct {
	Stack   v1beta1.StackDoc
	Deleted []string
	Purged  []string
}

type RefreshAllArgs

type RefreshAllArgs struct{}

type RefreshAllReply

type RefreshAllReply struct {
	Result RefreshAllResult
	Err    *APIError
}

type RefreshAllResult

type RefreshAllResult struct {
	RealmsFound       []string
	SpacesFound       []string
	StacksFound       []string
	CellsFound        []string
	ContainersFound   []string
	RealmsUpdated     []string
	SpacesUpdated     []string
	StacksUpdated     []string
	CellsUpdated      []string
	ContainersUpdated []string
	Errors            []string
}

type StartCellArgs

type StartCellArgs struct {
	Doc v1beta1.CellDoc
}

type StartCellReply

type StartCellReply struct {
	Result StartCellResult
	Err    *APIError
}

type StartCellResult

type StartCellResult struct {
	Cell    v1beta1.CellDoc
	Started bool
}

type StartContainerArgs

type StartContainerArgs struct {
	Doc v1beta1.ContainerDoc
}

type StartContainerReply

type StartContainerReply struct {
	Result StartContainerResult
	Err    *APIError
}

type StartContainerResult

type StartContainerResult struct {
	Container v1beta1.ContainerDoc
	Started   bool
}

type StopCellArgs

type StopCellArgs struct {
	Doc v1beta1.CellDoc
}

type StopCellReply

type StopCellReply struct {
	Result StopCellResult
	Err    *APIError
}

type StopCellResult

type StopCellResult struct {
	Cell    v1beta1.CellDoc
	Stopped bool
}

type StopContainerArgs

type StopContainerArgs struct {
	Doc v1beta1.ContainerDoc
}

type StopContainerReply

type StopContainerReply struct {
	Result StopContainerResult
	Err    *APIError
}

type StopContainerResult

type StopContainerResult struct {
	Container v1beta1.ContainerDoc
	Stopped   bool
}

type UnixClient

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

UnixClient is a Client backed by a persistent net/rpc connection over a unix socket using the JSON-RPC codec. The connection is lazily established on first call and reused for subsequent calls on the same instance.

func NewUnixClient

func NewUnixClient(sockPath string, opts ...UnixOption) *UnixClient

NewUnixClient returns a ctx-aware Client that dials the given unix socket path on first use and reuses the connection for subsequent calls.

func (*UnixClient) ApplyDocuments

func (c *UnixClient) ApplyDocuments(ctx context.Context, rawYAML []byte) (ApplyDocumentsResult, error)

ApplyDocuments implements Client.

func (*UnixClient) AttachContainer added in v0.2.0

func (c *UnixClient) AttachContainer(
	ctx context.Context,
	doc v1beta1.ContainerDoc,
) (AttachContainerResult, error)

AttachContainer implements Client.

func (*UnixClient) Close

func (c *UnixClient) Close() error

Close terminates the underlying rpc.Client connection if open. Safe to call multiple times.

func (*UnixClient) CreateCell

func (c *UnixClient) CreateCell(ctx context.Context, doc v1beta1.CellDoc) (CreateCellResult, error)

CreateCell implements Client.

func (*UnixClient) CreateContainer

func (c *UnixClient) CreateContainer(ctx context.Context, doc v1beta1.ContainerDoc) (CreateContainerResult, error)

CreateContainer implements Client.

func (*UnixClient) CreateRealm

func (c *UnixClient) CreateRealm(ctx context.Context, doc v1beta1.RealmDoc) (CreateRealmResult, error)

CreateRealm implements Client.

func (*UnixClient) CreateSpace

func (c *UnixClient) CreateSpace(ctx context.Context, doc v1beta1.SpaceDoc) (CreateSpaceResult, error)

CreateSpace implements Client.

func (*UnixClient) CreateStack

func (c *UnixClient) CreateStack(ctx context.Context, doc v1beta1.StackDoc) (CreateStackResult, error)

CreateStack implements Client.

func (*UnixClient) DeleteCell

func (c *UnixClient) DeleteCell(ctx context.Context, doc v1beta1.CellDoc) (DeleteCellResult, error)

DeleteCell implements Client.

func (*UnixClient) DeleteContainer

func (c *UnixClient) DeleteContainer(ctx context.Context, doc v1beta1.ContainerDoc) (DeleteContainerResult, error)

DeleteContainer implements Client.

func (*UnixClient) DeleteImage added in v0.3.0

func (c *UnixClient) DeleteImage(ctx context.Context, realm, ref string) (DeleteImageResult, error)

DeleteImage implements Client.

func (*UnixClient) DeleteRealm

func (c *UnixClient) DeleteRealm(
	ctx context.Context,
	doc v1beta1.RealmDoc,
	force, cascade bool,
) (DeleteRealmResult, error)

DeleteRealm implements Client.

func (*UnixClient) DeleteSpace

func (c *UnixClient) DeleteSpace(
	ctx context.Context,
	doc v1beta1.SpaceDoc,
	force, cascade bool,
) (DeleteSpaceResult, error)

DeleteSpace implements Client.

func (*UnixClient) DeleteStack

func (c *UnixClient) DeleteStack(
	ctx context.Context,
	doc v1beta1.StackDoc,
	force, cascade bool,
) (DeleteStackResult, error)

DeleteStack implements Client.

func (*UnixClient) GetCell

func (c *UnixClient) GetCell(ctx context.Context, doc v1beta1.CellDoc) (GetCellResult, error)

GetCell implements Client.

func (*UnixClient) GetContainer

func (c *UnixClient) GetContainer(ctx context.Context, doc v1beta1.ContainerDoc) (GetContainerResult, error)

GetContainer implements Client.

func (*UnixClient) GetImage added in v0.3.0

func (c *UnixClient) GetImage(ctx context.Context, realm, ref string) (GetImageResult, error)

GetImage implements Client.

func (*UnixClient) GetRealm

func (c *UnixClient) GetRealm(ctx context.Context, doc v1beta1.RealmDoc) (GetRealmResult, error)

GetRealm implements Client.

func (*UnixClient) GetSpace

func (c *UnixClient) GetSpace(ctx context.Context, doc v1beta1.SpaceDoc) (GetSpaceResult, error)

GetSpace implements Client.

func (*UnixClient) GetStack

func (c *UnixClient) GetStack(ctx context.Context, doc v1beta1.StackDoc) (GetStackResult, error)

GetStack implements Client.

func (*UnixClient) KillCell

func (c *UnixClient) KillCell(ctx context.Context, doc v1beta1.CellDoc) (KillCellResult, error)

KillCell implements Client.

func (*UnixClient) KillContainer

func (c *UnixClient) KillContainer(ctx context.Context, doc v1beta1.ContainerDoc) (KillContainerResult, error)

KillContainer implements Client.

func (*UnixClient) ListCells

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

ListCells implements Client.

func (*UnixClient) ListContainers

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

ListContainers implements Client.

func (*UnixClient) ListImages added in v0.3.0

func (c *UnixClient) ListImages(ctx context.Context, realm string) (ListImagesResult, error)

ListImages implements Client.

func (*UnixClient) ListRealms

func (c *UnixClient) ListRealms(ctx context.Context) ([]v1beta1.RealmDoc, error)

ListRealms implements Client.

func (*UnixClient) ListSpaces

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

ListSpaces implements Client.

func (*UnixClient) ListStacks

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

ListStacks implements Client.

func (*UnixClient) LoadImage added in v0.3.0

func (c *UnixClient) LoadImage(ctx context.Context, realm string, tarball []byte) (LoadImageResult, error)

LoadImage implements Client.

func (*UnixClient) LogContainer added in v0.3.0

func (c *UnixClient) LogContainer(
	ctx context.Context,
	doc v1beta1.ContainerDoc,
) (LogContainerResult, error)

LogContainer implements Client.

func (*UnixClient) Ping

func (c *UnixClient) Ping(ctx context.Context) error

Ping implements Client.

func (*UnixClient) PurgeCell

func (c *UnixClient) PurgeCell(ctx context.Context, doc v1beta1.CellDoc, force, cascade bool) (PurgeCellResult, error)

PurgeCell implements Client.

func (*UnixClient) PurgeContainer

func (c *UnixClient) PurgeContainer(ctx context.Context, doc v1beta1.ContainerDoc) (PurgeContainerResult, error)

PurgeContainer implements Client.

func (*UnixClient) PurgeRealm

func (c *UnixClient) PurgeRealm(
	ctx context.Context,
	doc v1beta1.RealmDoc,
	force, cascade bool,
) (PurgeRealmResult, error)

PurgeRealm implements Client.

func (*UnixClient) PurgeSpace

func (c *UnixClient) PurgeSpace(
	ctx context.Context,
	doc v1beta1.SpaceDoc,
	force, cascade bool,
) (PurgeSpaceResult, error)

PurgeSpace implements Client.

func (*UnixClient) PurgeStack

func (c *UnixClient) PurgeStack(
	ctx context.Context,
	doc v1beta1.StackDoc,
	force, cascade bool,
) (PurgeStackResult, error)

PurgeStack implements Client.

func (*UnixClient) RefreshAll

func (c *UnixClient) RefreshAll(ctx context.Context) (RefreshAllResult, error)

RefreshAll implements Client.

func (*UnixClient) StartCell

func (c *UnixClient) StartCell(ctx context.Context, doc v1beta1.CellDoc) (StartCellResult, error)

StartCell implements Client.

func (*UnixClient) StartContainer

func (c *UnixClient) StartContainer(ctx context.Context, doc v1beta1.ContainerDoc) (StartContainerResult, error)

StartContainer implements Client.

func (*UnixClient) StopCell

func (c *UnixClient) StopCell(ctx context.Context, doc v1beta1.CellDoc) (StopCellResult, error)

StopCell implements Client.

func (*UnixClient) StopContainer

func (c *UnixClient) StopContainer(ctx context.Context, doc v1beta1.ContainerDoc) (StopContainerResult, error)

StopContainer implements Client.

type UnixOption

type UnixOption func(*UnixClient)

UnixOption configures a UnixClient.

func WithDialTimeout

func WithDialTimeout(d time.Duration) UnixOption

WithDialTimeout overrides the dial timeout for NewUnixClient.

Jump to

Keyboard shortcuts

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