status

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package status implements `kuke status`, the consolidated health report that absorbs the original gaps doc's three separate proposals — `kuke doctor` (host pre-flight is now `kuke doctor cgroups`), `kuke ping` (daemon liveness), and `kuke selftest` (parity + state consistency) — into one post-init smoke command. Replaces the manual `kuke get realms` vs `kuke get realms --no-daemon` diff ritual the project AGENTS.md spells out (issue #202).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStatusCmd

func NewStatusCmd() *cobra.Command

NewStatusCmd builds the `kuke status` command.

Types

type MockRunCtxKey

type MockRunCtxKey struct{}

MockRunCtxKey is the context key tests use to inject a pre-built runCtx (mock clients, temp paths) so the command can be exercised end-to-end without dialing a real daemon, opening containerd, or walking /sys/fs/cgroup. Mirrors the MockControllerKey pattern the get subcommands use.

type Report

type Report struct {
	OK     bool     `json:"ok"`
	Checks []Result `json:"checks"`
}

Report is the full top-level payload — what --json marshals, and what the human renderer iterates over to print the section table.

type Result

type Result struct {
	Section     string `json:"section"`
	Name        string `json:"name"`
	Status      Status `json:"status"`
	Detail      string `json:"detail,omitempty"`
	Remediation string `json:"remediation,omitempty"`
	// Storage carries the structured per-realm counts the storage
	// section surfaces — populated only on storage rows. CI tooling
	// parses these to alert on accumulation before the data volume
	// fills (issue #1039); the human Detail string carries the same
	// figures pre-formatted.
	Storage *StorageStats `json:"storage,omitempty"`
}

Result is one row in the report — every section emits one Result per check. Detail is the short one-line summary printed next to the status; Remediation is the optional one-line fix hint surfaced when --verbose is set or whenever the status is WARN/FAIL.

type Status

type Status int

Status classifies one check's outcome. OK is the silent pass, WARN is informational (the check found something unusual but the system is still serving), FAIL is a regression signal — the exit code is non-zero when any row carries FAIL, matching the issue #202 contract.

const (
	StatusOK Status = iota
	StatusWARN
	StatusFAIL
)

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

MarshalJSON renders the human label rather than the integer so the `--json` output is stable across enum reordering.

func (Status) String

func (s Status) String() string

String returns the short label rendered in the human output and the JSON `status` field. Kept short so the human table column doesn't widen.

type StorageStats

type StorageStats struct {
	Snapshots  int   `json:"snapshots"`
	Leases     int   `json:"leases"`
	Blobs      int   `json:"blobs"`
	BlobsBytes int64 `json:"blobsBytes"`
}

StorageStats mirrors ctr.StorageStats on the wire — the per-realm snapshot/lease/blob figures `kuke status` exposes for parsing. The status package owns the JSON tags so a future internal/ctr struct rename doesn't ripple into the public CLI contract.

Jump to

Keyboard shortcuts

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