Documentation
¶
Overview ¶
Package project reduces raw Kubernetes objects to the allowlisted fields argus emits.
Raw objects are grotesque: a single Pod carries managedFields, a full duplicate of its own spec under last-applied-configuration, resourceVersion, uid, and generated token mounts. Emitting them fills the model's context with noise, and a model reasoning from noise guesses.
Every projection here is an explicit allowlist. Never a blocklist — a blocklist silently regresses the moment Kubernetes adds a field.
Index ¶
- Constants
- func ContainerSpec(c *corev1.Container) model.ContainerSpecView
- func Events(evs []corev1.Event, now time.Time) []model.EventGroup
- func Logs(raw string, now time.Time, tokenBudget int) ([]model.LogGroup, int)
- func Node(n *corev1.Node, now time.Time) model.NodeView
- func Normalize(msg string) string
- func PDB(p *policyv1.PodDisruptionBudget) *model.PDBView
- func Pod(p *corev1.Pod, usage map[string]corev1.ResourceList, now time.Time) model.PodView
- func RedactLine(s string) string
- func ReplicaSet(rs *appsv1.ReplicaSet, currentHash string, now time.Time) model.ReplicaSetView
- func Service(s *corev1.Service, ready, notReady, matched int) model.ServiceView
- func SortPods(pods []model.PodView)
- func Workload(d *appsv1.Deployment, now time.Time) *model.WorkloadView
Constants ¶
const DefaultLogTokens = 1800
DefaultLogTokens is the ceiling on emitted log content.
Budgeting by tokens rather than lines is the point: "last 100 lines" is meaningless when one line is a 4KB JSON blob and the next is "ok". A model's context is spent in tokens, so that is the unit the limit has to be expressed in.
Variables ¶
This section is empty.
Functions ¶
func ContainerSpec ¶
func ContainerSpec(c *corev1.Container) model.ContainerSpecView
ContainerSpec projects the desired shape of a container. Shared by Pod and by ReplicaSet template projection, which is what makes the rollout diff an apples-to-apples comparison.
func Events ¶
Events deduplicates raw events into groups keyed by (type, reason, normalized message, kind).
The object name is deliberately NOT part of the key. Forty pods of one Deployment reporting the same BackOff is one fact about the Deployment, not forty facts — keying on the object would produce forty near-identical groups and defeat the entire purpose. Each group instead reports how many distinct objects it covers, plus one of them as an example to drill into.
Counts respect the event's own series/count field rather than being recomputed: the apiserver already aggregates repeats server-side, so counting occurrences here would undercount by orders of magnitude on exactly the events that matter most.
func Logs ¶ added in v0.1.2
Logs turns raw container output into redacted, grouped, budgeted lines.
Order of operations matters and is deliberate:
- redact first, so a credential can never survive into a group key or a count;
- group second, so repetition collapses before the budget is spent on it;
- budget last, keeping the NEWEST groups — a crash is at the end of the log, never the start.
func Normalize ¶
Normalize strips the varying parts of an event message so equivalent events group together.
func PDB ¶
func PDB(p *policyv1.PodDisruptionBudget) *model.PDBView
PDB projects a PodDisruptionBudget, which explains rollouts that are stuck rather than broken.
func Pod ¶
Pod projects a pod and folds in its metrics, so a detector sees spec, status and usage together. usage is keyed by container name and may be nil when the metrics API is unavailable.
func RedactLine ¶ added in v0.1.2
RedactLine removes credential-shaped substrings from one line of log output.
func ReplicaSet ¶
func ReplicaSet(rs *appsv1.ReplicaSet, currentHash string, now time.Time) model.ReplicaSetView
ReplicaSet projects an RS plus its template, which is the input to the rollout diff.
func Service ¶
func Service(s *corev1.Service, ready, notReady, matched int) model.ServiceView
Service projects a Service together with the readiness of what it selects.
ready/notReady come from EndpointSlices; matched is how many pods the selector hits at all. Keeping both is what lets the endpoint detector distinguish a label mismatch (matched == 0) from a readiness failure (matched > 0, ready == 0) — two very different incidents that look identical in `kubectl get svc`.
func Workload ¶
func Workload(d *appsv1.Deployment, now time.Time) *model.WorkloadView
Workload projects a Deployment. StatefulSets and DaemonSets go through their own shims because their status fields have different names for the same concepts.
Types ¶
This section is empty.