Documentation
¶
Overview ¶
Package kube talks to the apiserver and projects what it finds into model.Snapshot.
Everything here is read-only. That is not a convention: TestNoMutatingVerbs walks this package's AST and fails on any call to a mutating client verb. v0.1 runs under a developer kubeconfig with full cluster-admin, so RBAC will not hold that line for us — the binary has to.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AmbiguousError ¶
AmbiguousError lists the candidates when a fuzzy name matches more than one workload. Returning the choices beats picking one: during an incident, silently diagnosing the wrong workload costs more than one extra round-trip.
func (*AmbiguousError) Error ¶
func (e *AmbiguousError) Error() string
type Client ¶
type Client struct {
Typed kubernetes.Interface
Metrics metricsv.Interface
Dynamic dynamic.Interface
Context string // resolved context name, for audit logging
// contains filtered or unexported fields
}
Client bundles the three typed clients a gather needs, plus the call budget they share.
func (*Client) Gather ¶
Gather collects everything needed to diagnose one workload and projects it into a Snapshot.
Failures are recorded in Snapshot.Degraded rather than returned. During an incident a partial diagnosis beats no diagnosis — but detectors must consult Snapshot.Missing and dock their confidence, so "we could not see the metrics API" never masquerades as "memory looks fine".
func (*Client) Resolve ¶
Resolve turns a fuzzy query into exactly one Ref.
Accepts "checkout", "checkout-api", "deploy/checkout-api", or "deployment/checkout-api". Matching is tiered — exact name first, then prefix, then substring — and stops at the first tier that produces hits, so an exact name is never made ambiguous by an unrelated substring match.
func (*Client) WithTimeout ¶
WithTimeout derives the per-invocation deadline. Callers must use the returned context for every apiserver call so a slow cluster degrades the snapshot instead of hanging the MCP session.
type Options ¶
type Options struct {
Kubeconfig string // path; empty means the standard loading rules, then in-cluster
Context string // kubeconfig context name; empty means current-context
Timeout time.Duration // per-invocation deadline for the whole gather
MaxCalls int64 // hard cap on apiserver requests per invocation
}
Options configures cluster access and the blast-radius limits on a single tool invocation.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions are deliberately conservative. A diagnostic tool that DoSes the control plane during an incident is a career-limiting artifact.