Documentation
¶
Index ¶
- Constants
- Variables
- func ConvertContainerdStatusToContainerState(status containerd.Status) intmodel.ContainerState
- func DefaultRootContainerSpec(containerdID, cellID, realmID, spaceID, stackID, cniConfigPath, ... string) intmodel.ContainerSpec
- func NormalizeImageReference(image string) string
- type AttachableInjection
- type BuildOption
- type CPUResources
- type CgroupResources
- type CgroupSpec
- type Client
- type ContainerDeleteOptions
- type ContainerRuntime
- type ContainerSpec
- type IOResources
- type IOThrottleEntry
- type IOThrottleType
- type ImageInfo
- type MemoryResources
- type NamespacePaths
- type PruneResult
- type RegistryCredentials
- type ResolvedVolume
- type StopContainerOptions
- type StorageStats
- type TaskIO
- type TaskSpec
- type VolumeScope
Constants ¶
const ( // AttachableBinaryPath is where the kuketty binary is bind-mounted // read-only inside the container. The host source is staged from // kukeond's own /bin/kuketty by the runner (kuketty travels inside the // kukeond image — see Dockerfile). AttachableBinaryPath = "/.kukeon/bin/kuketty" // AttachableTTYDir is where the per-container tty directory is // bind-mounted inside the container. kuketty creates and owns the // socket (and, in later phases, capture / log) files inside this // directory; because it is a directory bind mount (not a file mount), // kuketty's unlink-and-recreate of the socket inode stays host-visible. AttachableTTYDir = "/run/kukeon/tty" // AttachableSocketPath is the in-container path of the kuketty attach // control socket. kuketty listens here; the host peer is the bind- // mount source directory's `socket` entry, which `kuke attach` // connects to. AttachableSocketPath = AttachableTTYDir + "/socket" // AttachableCapturePath is the declared in-container path for the // kuketty capture transcript. Honored starting in phase 2 (#288); // kuketty does not yet write the transcript in phase 1b. AttachableCapturePath = AttachableTTYDir + "/capture" // AttachableKukettyLogPath is the in-container path of the kuketty // wrapper's own slog output. Peer to AttachableSocketPath and // AttachableCapturePath inside the per-container TTY directory bind // mount, so the host-side ContainerKukettyLogPath resolves to the same // inode. The path is daemon-controlled — operators do not configure it // per cell — so this file always exists after first attach regardless // of cell YAML. Distinct from AttachableCapturePath (the workload's // tty byte stream); this carries the wrapper's own debug log // (issue #599, reversing #289 phase 3's opt-in design for the kuketty- // process log specifically). AttachableKukettyLogPath = AttachableTTYDir + "/" + consts.KukeonContainerKukettyLogFile // AttachableMetadataDir is the in-container directory where the // kukeond-rendered terminal metadata file lives. Kept under // /.kukeon/kuketty/ to mirror the /.kukeon/bin/ layout of the // binary mount and keep both kuketty-owned paths in one subtree // the workload's rootfs cannot collide with. AttachableMetadataDir = "/.kukeon/kuketty" // AttachableMetadataPath is the fixed in-container path kuketty reads // its runtime configuration from. The daemon bind-mounts the // per-container metadata file over this path at OCI spec build time. // Kept in sync with cmd/kuketty/main.go's defaultConfigPath constant. AttachableMetadataPath = AttachableMetadataDir + "/metadata.json" // AttachableMetadataFile is the basename of the host-side per-container // metadata file rendered into the directory above HostTTYDir before // the workload container starts. AttachableMetadataFile = "kuketty-metadata.json" // AttachableSocketMode is the octal mode applied to the per-container // attach control socket when SocketGID is configured. 0660 = rw for // owner (the container's runtime uid) + rw for group (the kukeon // group), no world. Combined with the metadata file's socket GID this // lets a non-root member of the kukeon group on the host `connect()` // to the per-container kuketty control socket. Linux requires write // permission on a socket inode to connect — group-readable alone is // not enough. AttachableSocketMode = "0660" // AttachableCaptureMode and AttachableLogFileMode are the octal modes // that will apply to the capture transcript and log file once phases // 2/3 land kuketty's writers. 0640 = rw for owner (the container uid) // + r for group (the kukeon group), no world. AttachableCaptureMode = "0640" AttachableLogFileMode = "0640" )
Reserved in-container paths the kuketty wrapper claims. Documented as such in pkg/api/model/v1beta1/container.go.
kuketty (issue #165) replaces sbsh on the OCI injection path. Phase 1b (#410) lands the attach-socket RPC server. Issue #641 makes the daemon mount kukeon's own api/model/v1beta1.ContainerDoc instead of a pre-rendered sbsh TerminalDoc: kuketty reads ContainerDoc.Spec, builds the TerminalSpec, and serves it via sbsh's pkg/terminal/server facade. The wrapper is invoked with no CLI flags — every runtime input flows through the bind-mounted metadata file.
const ( // DefaultRootContainerImage is the image used when none is provided. It is // retained only as the root container's filesystem base — the pause process // is the bind-mounted kukepause binary, not anything from busybox (#931). DefaultRootContainerImage = "docker.io/library/busybox:latest" // RootContainerPauseBinaryTarget is the in-container path the host's // kukepause binary is bind-mounted to and exec'd as PID 1 in every default // root container. kukepause installs SIGTERM/SIGINT handlers (so cell // teardown does not burn StopContainer's 10s graceful timeout) and a SIGCHLD // zombie reaper, then blocks on a Go select over those signal channels — // replacing the previous `sleep infinity`, which ignored SIGTERM as PID 1 // and reaped nothing (issue #931). RootContainerPauseBinaryTarget = "/.kukeon/bin/kukepause" // RootContainerPauseBinaryName is the basename of the kukepause binary as // staged under <RunPath>/bin by `kuke init`. It is the single source of // truth shared by the init-time stager (the writer) and the root-container // builder (which reads <RunPath>/bin/<name> as the kukepause bind source) so // the two never drift (issue #931). RootContainerPauseBinaryName = "kukepause" )
const DefaultSecretsStagingDir = "/run/kukeon/secrets"
DefaultSecretsStagingDir is the host directory the daemon uses to stage file-mounted secrets before bind-mounting them into containers. The directory lives under /run so contents are ephemeral across reboots on typical deployments.
Variables ¶
var KukeonKnownSnapshotters = []string{
"overlayfs",
"native",
"btrfs",
"zfs",
"devmapper",
"blockfile",
}
KukeonKnownSnapshotters is the list of containerd snapshotters CleanupNamespaceResources walks when no snapshotter is specified. Stays in sync with the set of snapshotters supported by the kukeond image (overlayfs in production; native is always present as containerd's fallback). Listed in the order they will be drained — overlayfs first because it is the only one populated on a real install, but the others are tried so a host that experimented with btrfs/zfs/etc. still gets a clean uninstall instead of "namespace not empty" surfacing the day after.
Listed snapshotters that are not registered in the daemon return errors from snapshotService.Walk; cleanupSnapshotsFor handles those at WARN and keeps walking the rest.
Functions ¶
func ConvertContainerdStatusToContainerState ¶
func ConvertContainerdStatusToContainerState(status containerd.Status) intmodel.ContainerState
ConvertContainerdStatusToContainerState converts a containerd task status to internal ContainerState.
A stopped task is split by its exit code (#1267): a clean exit (0) maps to ContainerStateExited, a non-zero exit to ContainerStateError. This mirrors the cell-level Exited/Error split so the container view distinguishes a completed workload from a crashed one. ContainerStateFailed stays reserved for kukeon's own container bring-up failures and is never produced here.
func DefaultRootContainerSpec ¶
func DefaultRootContainerSpec( containerdID, cellID, realmID, spaceID, stackID, cniConfigPath, kukepauseHostPath string, ) intmodel.ContainerSpec
DefaultRootContainerSpec returns a minimal ContainerSpec suitable for keeping the root container alive while other workload containers are managed. containerdID is the hierarchical ID used for containerd operations. The ID field will be set to "root" (base name).
kukepauseHostPath is the host path of the staged kukepause binary (<RunPath>/bin/kukepause, placed by `kuke init`). It is bind-mounted read-only at RootContainerPauseBinaryTarget (/.kukeon/bin/kukepause) and exec'd as the root container's PID 1 in place of the previous `sleep infinity` from busybox (issue #931). An empty path yields no bind mount — the caller is responsible for staging the binary first.
func NormalizeImageReference ¶
NormalizeImageReference canonicalizes an image reference to the fully qualified docker.io/library form containerd's resolver requires, the same way `docker` and kukebuild's -t normalization do (see normalizeImageName in cmd/kukebuild/build.go). Bare references that omit the registry, the docker.io/library namespace, or the tag would otherwise reach the resolver as `dummy://busybox:latest` and fail to parse, so every pull path runs the ref through here first.
Examples:
- "debian:latest" -> "docker.io/library/debian:latest"
- "alpine" -> "docker.io/library/alpine:latest"
- "busybox" -> "docker.io/library/busybox:latest"
- "docker.io/busybox:latest" -> "docker.io/library/busybox:latest"
- "user/image" -> "docker.io/user/image:latest"
- "docker.io/library/debian:latest" -> "docker.io/library/debian:latest" (unchanged)
- "registry.example.com/image:tag" -> "registry.example.com/image:tag" (unchanged)
- "kukeon.internal/kukeond:v0.0.0" -> "kukeon.internal/kukeond:v0.0.0" (unchanged)
A reference that cannot be parsed (genuinely malformed) is returned unchanged so the downstream containerd resolver surfaces the error, preserving prior behavior for invalid input.
Types ¶
type AttachableInjection ¶ added in v0.2.0
type AttachableInjection struct {
// KukettyBinaryPath is the host path of the kuketty binary that will
// be bind-mounted RO at AttachableBinaryPath inside the container.
// The daemon stages this from its own /bin/kuketty at provision time
// (kukeond image ships kuketty alongside the daemon binary).
KukettyBinaryPath string
// HostTTYDir is the host path of the per-container tty directory that
// will be bind-mounted at AttachableTTYDir inside the container. The
// host-visible socket that `kuke attach` connects to is the `socket`
// entry inside this directory.
HostTTYDir string
// HostMetadataPath is the host path of the per-container kuketty
// metadata file. The runner renders the metadata to this path before
// the container starts; the OCI bind mount maps it to
// AttachableMetadataPath inside the container.
HostMetadataPath string
// RenderMetadata, when non-nil, is invoked from inside the OCI
// args-wrap spec opt with the resolved workload argv — i.e. the merge
// of the image's ENTRYPOINT + CMD and any user override that
// containerd's WithImageConfig and our WithProcessArgs have already
// applied to s.Process.Args by the time the wrap runs. The callback
// is expected to render the ContainerDoc with the workload argv baked
// into Spec.Command / Spec.Args and write it atomically to
// HostMetadataPath. nil disables metadata rendering — used by unit
// tests that exercise only the args-wrap shape.
RenderMetadata func(workloadArgv []string) error
}
AttachableInjection carries the host-side paths needed to wrap a container's OCI spec so it runs under kuketty. The caller (the daemon) computes the paths from the cell/container identity and the configured run path. Empty fields disable the corresponding bind mount or metadata-file entry.
type BuildOption ¶ added in v0.2.0
type BuildOption func(*buildOpts)
BuildOption customizes BuildContainerSpec without changing its return type. Used for caller-provided values that don't live on the model spec — today the host-side paths required when ContainerSpec.Attachable is true, and the daemon-wide fallback memory limit applied when the spec carries none.
func WithAttachableInjection ¶ added in v0.2.0
func WithAttachableInjection(inj AttachableInjection) BuildOption
WithAttachableInjection configures the host-side paths used when wrapping an Attachable container. Has no effect on a spec where Attachable is false; in that case the option is silently ignored so callers can pass it unconditionally.
func WithDefaultMemoryLimit ¶ added in v0.6.0
func WithDefaultMemoryLimit(bytes int64) BuildOption
WithDefaultMemoryLimit configures a daemon-wide fallback memory limit (in bytes). The limit is applied via oci.WithMemoryLimit only when the ContainerSpec does not already carry a positive Resources.MemoryLimitBytes — an explicit per-container value always wins. A zero or negative argument is a no-op so callers can pass it unconditionally. Issue #531.
func WithExtraLabels ¶ added in v0.6.0
func WithExtraLabels(labels map[string]string) BuildOption
WithExtraLabels merges additional containerd container labels into the built spec's label map (existing keys overwritten on collision). Used by the runner to stamp `kukeon.io/spec-hash` at container-create time without threading the value through every Build option; root containers receive the same label via the labels argument BuildRootContainerSpec already accepts. Empty input is a no-op so callers can pass it unconditionally. Issue #867.
func WithKukeonGroupGID ¶ added in v0.6.0
func WithKukeonGroupGID(gid uint32) BuildOption
WithKukeonGroupGID injects the host's `kukeon` group GID into the container process's OCI Process.User.AdditionalGids. The kukeon-owned per-container directories (the attachable tty bind-mount, secrets, etc.) are group-owned on the host by this GID with mode 02750 — without world access, an in- container process that does not belong to this numeric group cannot read/write them. Without this hop, additionalGids are resolved by containerd from the image's /etc/group; an image that happens to define "kukeon" at a different numeric GID (or omits it entirely) silently produces an unstartable cell because kuketty's listen / log open fails with EACCES on the bind-mounted tty dir.
Zero is a no-op so callers can pass r.opts.KukeonGroupGID unconditionally. The opt appends to whatever AdditionalGids containerd's WithUser already populated from the rootfs (it runs after securitySpecOpts), and dedupes so a coincidentally-matching image GID is not duplicated.
func WithSecretRunPath ¶ added in v0.6.0
func WithSecretRunPath(runPath string) BuildOption
WithSecretRunPath carries the daemon's RunPath into CreateContainerFromSpec so scoped references can be resolved off disk before the OCI spec is built: a ContainerSecret with a secretRef from the referenced scope's secrets tree (<RunPath>/data/<scope>/secrets/<name>, issue #619) and a kind: volume VolumeMount from its scope's volumes tree (issue #1016). Has no effect on BuildContainerSpec itself — the value is consumed by resolveSecrets and resolveVolumeMounts. An empty argument is a no-op so callers can pass it unconditionally; specs that declare no scoped reference never touch the path. Issue #623.
type CPUResources ¶
CPUResources maps to cpu*, cpuset* controllers.
type CgroupResources ¶
type CgroupResources struct {
CPU *CPUResources
Memory *MemoryResources
IO *IOResources
}
CgroupResources represents the subset of controllers we expose.
type CgroupSpec ¶
type CgroupSpec struct {
// Group is the target cgroup path, e.g. /kukeon/workloads/runner.
Group string
// Mountpoint overrides the default cgroup mount (/sys/fs/cgroup) when non-empty.
Mountpoint string
// Resources defines the controller knobs that should be configured for the cgroup.
Resources CgroupResources
}
CgroupSpec describes how to create a new cgroup.
func DefaultCellSpec ¶
func DefaultCellSpec(cell intmodel.Cell) CgroupSpec
func DefaultRealmSpec ¶
func DefaultRealmSpec(realm intmodel.Realm) CgroupSpec
func DefaultSpaceSpec ¶
func DefaultSpaceSpec(space intmodel.Space) CgroupSpec
func DefaultStackSpec ¶
func DefaultStackSpec(stack intmodel.Stack) CgroupSpec
type Client ¶
type Client interface {
Connect() error
Close() error
CreateNamespace(namespace string) error
DeleteNamespace(namespace string) error
ListNamespaces() ([]string, error)
GetNamespace(namespace string) (string, error)
ExistsNamespace(namespace string) (bool, error)
CleanupNamespaceResources(namespace, snapshotter string) error
GetCgroupMountpoint() string
GetCurrentCgroupPath() (string, error)
CgroupPath(group, mountpoint string) (string, error)
NewCgroup(spec CgroupSpec) (*cgroup2.Manager, error)
LoadCgroup(group string, mountpoint string) (*cgroup2.Manager, error)
DeleteCgroup(group, mountpoint string) error
// EnsureSubtreeControllers writes "+<ctrl>" to the named group's own
// cgroup.subtree_control AND to every ancestor up to the unified cgroup
// mount, so the group's children inherit the controllers. The level-
// agnostic primitive used by every realm/space/stack ensure path (issue
// #327) and by the cell wrappers below (issues #312, #314). Filters the
// requested set against what the host root advertises and returns the
// effective set actually written. Idempotent — re-running on an already-
// delegated subtree is a no-op.
EnsureSubtreeControllers(group, mountpoint string, controllers []string) ([]string, error)
// EnableCellSubtreeControllers enables the named cgroup-v2 controllers in
// the cell cgroup's own subtree_control AND in every ancestor's
// subtree_control up to the unified cgroup mount, so child cgroups (the
// per-container task cgroups runc creates under Linux.CgroupsPath)
// inherit the controllers and cell-level resource accounting / limits
// become effective. Returns the effective controller set actually
// written (the requested set filtered against the host root's
// cgroup.controllers) so the runner can persist it on
// CellStatus.SubtreeControllers (issue #328). Thin wrapper around
// EnsureSubtreeControllers kept for the cell call sites' readability.
// Issue #312.
EnableCellSubtreeControllers(group, mountpoint string, controllers []string) ([]string, error)
// EnableCellAllSubtreeControllers is the cell/profile=NestedCgroupRuntime
// counterpart: it delegates the full host-available cgroup-v2 controller
// set on the cell's subtree_control (and every ancestor's), rather than
// the kukeon resource subset. Returns the effective controller set
// actually written so the runner can persist it on
// CellStatus.SubtreeControllers (issue #328). Used by cells that host
// an inner cgroup runtime (an embedded containerd or systemd) which
// needs to in turn delegate arbitrary controllers to its own children.
// Issue #314.
EnableCellAllSubtreeControllers(group, mountpoint string) ([]string, error)
// RelocateProcessesToLeaf drains every PID currently in <group>/cgroup.procs
// into a freshly-mkdir'd leaf cgroup at <group>/<leaf>. Used to satisfy
// cgroup-v2's no-internal-process rule (issue #336): subtree_control
// widening for non-thread-aware controllers (memory, io, ...) is rejected
// by the kernel when the target cgroup hosts processes directly. The
// leaf inherits the parent's controllers via the parent's subtree_control,
// so resource accounting at <group> still applies — the PIDs just live
// one level deeper. Idempotent: re-running on an already-drained group
// is a no-op.
RelocateProcessesToLeaf(group, mountpoint, leaf string) error
CreateContainerFromSpec(namespace string, spec intmodel.ContainerSpec, creds []RegistryCredentials, opts ...BuildOption) (containerd.Container, error)
CreateContainer(namespace string, spec ContainerSpec, creds []RegistryCredentials) (containerd.Container, error)
GetContainer(namespace, id string) (containerd.Container, error)
ListContainers(namespace string, filters ...string) ([]containerd.Container, error)
ExistsContainer(namespace, id string) (bool, error)
DeleteContainer(namespace, id string, opts ContainerDeleteOptions) error
StartContainer(namespace string, spec ContainerSpec, taskSpec TaskSpec) (containerd.Task, error)
StopContainer(namespace, id string, opts StopContainerOptions) (*containerd.ExitStatus, error)
TaskStatus(namespace, id string) (containerd.Status, error)
TaskMetrics(namespace, id string) (*apitypes.Metric, error)
// ContainerProcessUID returns the resolved process.User.UID from the
// given container's OCI runtime spec. Used after CreateContainerFromSpec
// to chown the host-side per-container Attachable tty directory to the
// runtime uid the container will execute as — which can be non-root
// when the image carries a USER directive (or the cell profile sets
// container.user). Without this, kuketty inside the container fails to
// create its socket/log/capture files in the bind-mounted dir.
ContainerProcessUID(namespace string, container containerd.Container) (uint32, error)
// LoadImage imports an OCI/docker image tarball into the specified
// containerd namespace and returns the names of the imported images.
LoadImage(namespace string, reader io.Reader) ([]string, error)
// ListImages enumerates images in the specified containerd namespace.
ListImages(namespace string) ([]ImageInfo, error)
// GetImage returns metadata for the named image ref in the specified
// containerd namespace. Returns errdefs.ErrImageNotFound if
// the ref is absent.
GetImage(namespace, ref string) (ImageInfo, error)
// ImageChainID returns the chainID the image at ref would unpack to
// today, computed from the current rootfs DiffIDs in the namespace's
// content store. Pair with ContainerRootChainID to detect that an
// image tag has been re-pointed since a container was created (the
// digest-drift signal missing from bootstrapCell's image comparison
// in issue #915 defect 2). Returns errdefs.ErrImageNotFound if the
// ref is absent.
ImageChainID(namespace, ref string) (string, error)
// ContainerRootChainID returns the chainID of the parent layer stack
// the container's root snapshot was committed against — i.e. the
// image content the container is anchored on at the moment of the
// call, regardless of what the image ref by the same name resolves
// to today. Returns errdefs.ErrContainerNotFound if the container is
// absent.
ContainerRootChainID(namespace, containerID string) (string, error)
// DeleteImage removes the named image ref from the specified
// containerd namespace. Returns errdefs.ErrImageNotFound if the ref
// is absent so callers can distinguish missing from operational
// failures.
DeleteImage(namespace, ref string) error
// PruneImages reclaims dangling image layers and the orphaned leases
// pinning them in the specified containerd namespace, leaving tagged
// images and the snapshots backing live containers untouched. Returns
// the count of leases released vs. retained.
PruneImages(namespace string) (PruneResult, error)
// NamespaceStorage returns the per-namespace storage footprint —
// snapshot count (across every registered snapshotter in
// KukeonKnownSnapshotters), lease count, and content-blob count plus
// summed byte size. Used by `kuke status` to surface accumulation
// before the data volume fills (issue #1039); the figures come from
// containerd's metadata stores (boltdb iterators), not an on-disk
// du, so the call stays cheap enough for the status command's
// budget. Per-snapshot disk usage is intentionally omitted — it
// would require walking the snapshotter's filesystem.
NamespaceStorage(namespace string) (StorageStats, error)
}
type ContainerDeleteOptions ¶
type ContainerDeleteOptions struct {
// SnapshotCleanup indicates whether to clean up snapshots.
SnapshotCleanup bool
}
ContainerDeleteOptions describes options for deleting a container.
type ContainerRuntime ¶
type ContainerRuntime struct {
// Name is the runtime name (e.g., "io.containerd.runc.v2").
Name string
// Options are runtime-specific options.
Options interface{}
}
ContainerRuntime describes the runtime configuration.
type ContainerSpec ¶
type ContainerSpec struct {
// ID is the unique identifier for the container.
ID string
// Image is the image reference to use for the container.
Image string
// SnapshotKey is the key for the snapshot. If empty, defaults to ID.
SnapshotKey string
// Snapshotter is the snapshotter to use. If empty, uses default.
Snapshotter string
// Runtime is the runtime configuration.
Runtime *ContainerRuntime
// SpecOpts are OCI spec options to apply.
SpecOpts []oci.SpecOpts
// Labels are key-value pairs to attach to the container.
Labels map[string]string
// CNIConfigPath is the path to the CNI configuration to use for this container.
CNIConfigPath string
}
ContainerSpec describes how to create a new container.
func BuildContainerSpec ¶
func BuildContainerSpec( containerSpec intmodel.ContainerSpec, options ...BuildOption, ) ContainerSpec
BuildContainerSpec converts an internal ContainerSpec to ctr.ContainerSpec with the expected defaults applied. Uses ContainerdID if available, otherwise falls back to ID.
func BuildRootContainerSpec ¶
func BuildRootContainerSpec( rootSpec intmodel.ContainerSpec, labels map[string]string, options ...BuildOption, ) ContainerSpec
BuildRootContainerSpec converts the internal root container spec into an internal ctr.ContainerSpec with the expected defaults applied. Uses ContainerdID if available, otherwise falls back to ID.
Variadic BuildOption is honored for the daemon-wide knobs that also affect non-root containers — today the daemon-default memory cap (issue #531). Per-spec-only BuildOptions like WithAttachableInjection have no effect on a root container spec.
func JoinContainerNamespaces ¶
func JoinContainerNamespaces(spec ContainerSpec, ns NamespacePaths) ContainerSpec
JoinContainerNamespaces returns a copy of spec with namespace spec options applied.
type IOResources ¶
type IOResources struct {
Weight uint16
Throttle []IOThrottleEntry
}
IOResources exposes IO weight + throttling.
type IOThrottleEntry ¶
type IOThrottleEntry struct {
Type IOThrottleType
Major int64
Minor int64
Rate uint64
}
IOThrottleEntry represents a single io.max entry.
type IOThrottleType ¶
type IOThrottleType string
IOThrottleType identifies the throttle file to target.
const ( IOTypeReadBPS IOThrottleType = IOThrottleType(cgroup2.ReadBPS) IOTypeWriteBPS IOThrottleType = IOThrottleType(cgroup2.WriteBPS) IOTypeReadIOPS IOThrottleType = IOThrottleType(cgroup2.ReadIOPS) IOTypeWriteIOPS IOThrottleType = IOThrottleType(cgroup2.WriteIOPS) )
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 ctr-layer view of a containerd image. The fields are the common subset surfaced to operators by `kuke get image`; downstream layers re-encode this onto their own wire types so the ctr package does not leak into pkg/api.
type MemoryResources ¶
MemoryResources maps to memory controller knobs.
type NamespacePaths ¶
NamespacePaths describes the namespace file paths a container should join.
type PruneResult ¶ added in v0.6.0
PruneResult reports the outcome of a surgical image prune: how many leases were released (each release triggers a synchronous containerd GC sweep that reclaims the dangling content/snapshots the lease was the last GC root for) and how many were retained because they still back a live container's snapshot.
type RegistryCredentials ¶
type RegistryCredentials struct {
// Username is the registry username.
Username string
// Password is the registry password or token.
Password string
// ServerAddress is the registry server address (e.g., "docker.io", "registry.example.com").
// If empty, credentials apply to the registry extracted from the image reference.
ServerAddress string
}
RegistryCredentials contains authentication information for a container registry. This type matches the modelhub RegistryCredentials structure for use in the ctr package.
func ConvertRealmCredentials ¶
func ConvertRealmCredentials(creds []intmodel.RegistryCredentials) []RegistryCredentials
ConvertRealmCredentials converts modelhub RegistryCredentials slice to ctr RegistryCredentials slice.
type ResolvedVolume ¶ added in v0.8.0
ResolvedVolume is the outcome of resolving a kind: volume VolumeMount: the host directory to bind-mount and the scope coordinates the reference resolved to. The coordinates let the `kuke delete volume` gate match a live mount against the Volume being deleted without re-walking the scope. Step 4 (#1016).
func ResolveVolumeMount ¶ added in v0.8.0
func ResolveVolumeMount(runPath string, scope VolumeScope, mount intmodel.VolumeMount) (ResolvedVolume, error)
ResolveVolumeMount resolves a kind: volume VolumeMount to the on-disk Volume directory under runPath. A bare Source names a Volume in the container's own scope, walked most-specific-first (stack → space → realm); a VolumeRef names one cross-scope by explicit coordinates. The referenced Volume must already exist — there is no auto-create (an unknown name is a hard error, not a silent provision), so a typo'd reference fails fast at container create. A non-volume Kind is not this resolver's concern and yields an error so callers never mis-route a bind/tmpfs mount here. Step 4 (#1016).
type StopContainerOptions ¶
type StopContainerOptions struct {
// Signal is the signal to send (defaults to SIGTERM).
Signal string
// Timeout is the timeout for graceful shutdown.
Timeout *time.Duration
// Force indicates whether to force kill if timeout is exceeded.
Force bool
}
StopContainerOptions describes options for stopping a container.
type StorageStats ¶ added in v0.6.0
type StorageStats struct {
// Snapshots is the total snapshot count across every registered
// snapshotter in KukeonKnownSnapshotters. Aggregated so the status
// row reads at-a-glance — a per-snapshotter breakdown would just
// noise the report when one snapshotter dominates in practice
// (overlayfs on real installs).
Snapshots int
// Leases is the total lease count from leases.Manager.List. Leases
// are containerd GC roots — accumulation past the live-image count
// is the leak signal issue #1039 surfaces.
Leases int
// Blobs is the count of content-store blobs (committed manifests,
// layers, configs).
Blobs int
// BlobsBytes is the summed Size field across the content-store
// walk — cheap because content.Info already carries the byte size,
// so no extra file stat is needed.
BlobsBytes int64
}
StorageStats is the per-namespace footprint NamespaceStorage returns — the figures `kuke status`'s storage section surfaces so snapshot/lease/ content accumulation is observable before the data volume fills. All counts are metadata-store reads (boltdb iterators), so the call stays cheap. Snapshot disk usage is intentionally omitted: it would require `du` against the snapshotter's filesystem and the status budget doesn't fit it.
type TaskIO ¶
type TaskIO struct {
// Stdin is the path to stdin (if any).
Stdin string
// Stdout is the path to stdout (if any).
Stdout string
// Stderr is the path to stderr (if any).
Stderr string
// Terminal indicates if the task should have a TTY.
Terminal bool
// LogFilePath, when set, makes the runtime shim write the task's
// stdout and stderr to this host path via cio.LogFile. The shim
// opens the file in append mode; if no file exists yet it is
// created. Mutually exclusive with Terminal — log files do not
// pair with a TTY.
LogFilePath string
}
TaskIO describes the IO configuration for a task.
type TaskSpec ¶
type TaskSpec struct {
// IO is the IO configuration for the task.
IO *TaskIO
// Options are task creation options.
Options []containerd.NewTaskOpts
}
TaskSpec describes how to create a new task.
type VolumeScope ¶ added in v0.8.0
VolumeScope is the realm/space/stack scope a container resolves a same-scope (bare-source) kind: volume mount against. The scope walk starts at the deepest set coordinate and falls back to shallower ones, so the most-specific Volume of a given name wins — mirroring secret-scope lookup. Step 4 (#1016).