feat(gitops): add flux-diagnose for read-only Flux reconcile checks

flux-diagnose reports source, Kustomization and HelmRelease state,
answers "has this commit been applied yet?" with bounded polling (a cap
counted in 60-second kubectl wait pauses, never flux reconcile), and
walks a failure down the source -> Kustomization -> HelmRelease chain,
handing workload problems to k8s-diagnose. Read tier only; it uses the
caller's kubeconfig and never looks for credentials.

gitops 0.2.0; the package description now covers live reconcile state.

Refs: #194

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-11-24 20:34:42 +00:00
1 parent 67e2523252
commit 2a6eea3db1
6 files changed
+362 -2

No files matched your search

@@ -0,0 +1,51 @@
---
source_keys:
- adr-0032-action-tiers
---
# Status flow
Report the reconcile state of Flux objects. Read tier only; every command here is in the
`SKILL.md` tier table.
## 1 — Read
Every `flux` command defaults to the `flux-system` namespace. Pass `-A` for a cluster-wide read,
or `-n <ns>` for a named object; never trust the default.
- Cluster-wide: `flux get sources all -A`, then `flux get kustomizations -A` (already read by the
access gate), then `flux get helmreleases -A`. Add `flux stats -A` for the totals line.
- Named objects: `flux get <kind> <name> -n <ns>`, for example `flux get ks apps -n flux-system`.
- Failing only, when the caller asks "what's broken": add `--status-selector ready=false` to each
`flux get`.
## 2 — Classify each object
| State | Rule |
|---|---|
| `ready` | READY `True` |
| `failing` | READY `False` |
| `progressing` | READY `Unknown`, or the message says reconciliation is in progress |
| `suspended` | SUSPENDED `True`, whatever READY says; its status is frozen and stale |
| `stale` | READY `True`, but a Kustomization's revision is behind its source's revision |
`stale` needs both rows: compare the Kustomization's REVISION with its source's REVISION (the
source is shown by `flux get ks <name> -n <ns> --show-source`). A gap that persists past the
Kustomization's interval means it is waiting on a `dependsOn` object or is not being reconciled.
## 3 — Return
Output format:
```text
Cluster: <current context name> Ready: <n> Failing: <n> Suspended: <n> Stale: <n>
| Kind | Namespace/Name | State | Revision | Message |
```
One row per object; for a cluster-wide read, list only rows not `ready` and give `ready` as a
count. `Message` is the controller's message cut to one line; never paste events or logs here.
Get the context name with `kubectl config current-context`, which reads the name only.
A `failing` or `stale` row is a finding, not a diagnosis. Say which object is most upstream (a
source before the Kustomizations that use it) and stop; the caller re-invokes the skill to
diagnose it.