You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+88-49Lines changed: 88 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,108 +5,143 @@ A small Go CLI that tracks Kubernetes resources defined in manifests, showing co
5
5
Highlights:
6
6
- Tracks readiness of Deployments, StatefulSets, Jobs, DaemonSets, and arbitrary CRDs.
7
7
- Prints progress and events; pod logs are only shown when containers fail (ImagePullBackOff, CrashLoopBackOff, OOMKilled, etc.).
8
-
- Works with files, directories, or stdin (great for kubectl, helm, or kustomize pipelines).
8
+
- Works with files, directories, stdin, and Helm releases (via `kubetracker helm`).
9
9
- Extensible readiness strategy for CRDs via condition mappings.
10
+
- Helm release tracking implemented: `kubetracker helm` reads Helm v3 release Secrets, decodes the rendered manifest, and reuses the same tracker as `track`.
10
11
11
12
Note: This tool does not apply resources; it tracks resources you’re applying via your deployment tooling (kubectl/helm/Argo/etc.). You can run it concurrently with your apply/upgrade and it will follow the resources defined in your manifests.
12
13
13
14
## Status
14
15
15
16
- Tracking implemented: readiness for Deployments, StatefulSets, DaemonSets, Jobs; CRDs via conditions (auto-inferred and custom mappings).
16
-
- Progress/events/logs wired; healthy pod logs suppressed by default; pod status enrichment avoids UNKNOWN; built-in CRD rules (cert-manager Certificate Ready=True, Apache APISIX ApisixRoute ResourcesAvailable=True).
17
-
- Prints READY on success; supports --exit-on-first-fail and global --timeout; optional --failure-grace-period keeps tracking and retries builtin trackers for transient failures (e.g., ImagePullBackOff).
17
+
- Progress/events/logs wired; healthy pod logs suppressed by default; pod status enrichment avoids UNKNOWN; built-in CRD rules (cert-manager `Certificate``Ready=True`, Apache APISIX `ApisixRoute``ResourcesAvailable=True`).
18
+
- Helm release tracking implemented:
19
+
-`kubetracker helm` supports tracking one or more Helm releases directly by reading the cluster Secret for each release and decoding the embedded release manifest.
20
+
- Supports release refs as `<namespace>/<name>` or `<name>` with `--namespace` set.
21
+
- Picks the latest Helm Secret (type `helm.sh/release.v1`) by numeric `version` label, breaking ties by most recent creation timestamp.
22
+
- Emits non-fatal warnings for things like non-integer `version` labels; decode errors surface as invalid input.
23
+
- Prints READY on success; supports `--exit-on-first-fail` and global `--timeout`; optional `--failure-grace-period` keeps tracking and retries builtin trackers for transient failures (e.g., ImagePullBackOff).
18
24
19
25
What’s next:
20
26
- More per-CRD defaults and condition heuristics.
21
27
- Structured JSON output mode for CI.
22
-
- Optional --apply mode and additional QoL improvements.
23
-
28
+
- Optional `--apply` mode and additional QoL improvements.
The `helm` subcommand provides two convenient ways to track Helm-managed resources:
101
+
102
+
1. Track rendered manifests produced by `helm template` piped to `kubetracker track -f -`.
103
+
2. Track releases directly with `kubetracker helm <RELEASE...>` which reads the in-cluster Helm v3 Secret for each release and decodes the `.manifest` embedded in the release payload.
104
+
105
+
How `kubetracker helm` works:
106
+
- Each CLI release arg can be specified as `<namespace>/<name>` or just `<name>` (requires `--namespace`).
107
+
- The subcommand lists Secrets in the release namespace labeled `owner=helm` and `name=<release>`.
108
+
- It filters Secrets of Type `helm.sh/release.v1` and selects the single best candidate:
109
+
- Prefers the highest numeric `version` label.
110
+
- If multiple Secrets share the same numeric `version`, picks the most recently created one.
111
+
- If a Secret has a non-integer `version` label, kubetracker may emit a non-fatal warning and treat that version as `-1` for selection purposes (verbose mode will show the warning).
112
+
- The Secret's `data["release"]` payload is decoded:
113
+
- Base64 decode
114
+
- If gzipped, gunzip the payload
115
+
- Unmarshal JSON and extract the `manifest` field
116
+
- The extracted manifest (multi-document YAML) is fed to the same manifest loader used by `track`, then tracked normally.
117
+
118
+
Caveats and limitations:
119
+
- Only Helm v3 release Secrets of Type `helm.sh/release.v1` are supported.
120
+
- If your Helm installation uses a different storage backend (e.g., secrets encrypted by external tooling, or a different secret type), `kubetracker helm` may not be able to decode the manifest.
121
+
- RBAC: listing Secrets in the release namespace requires permissions; lacking access will produce an error.
122
+
- If the release Secret is missing, empty, or cannot be decoded, `kubetracker helm` will surface an invalid input error.
- Pods under the hood for status and logs (but logs are shown only for failing states).
83
-
- Arbitrary CRDs: readiness determined by conditions (configurable), or presence-only fallback.
128
+
- Arbitrary CRDs: readiness determined by `status.conditions` (configurable), or presence-only fallback.
84
129
85
130
### CRDs readiness strategy
86
131
87
-
By default, kubetracker tries to infer readiness via status.conditions:
88
-
- If a resource exposes `status.conditions` with a recognizable “Ready”, “Available”, “Healthy”, or similar positive condition, kubetracker waits for that condition to be True.
132
+
By default, kubetracker tries to infer readiness via `status.conditions`:
133
+
- If a resource exposes `status.conditions` with a recognizable `Ready`, `Available`, `Healthy`, or similar positive condition, kubetracker waits for that condition to be `True`.
89
134
- If such conditions are absent, kubetracker falls back to presence (created) which is often sufficient for controller-managed resources but may be too permissive.
90
135
91
136
You can customize CRD readiness via `--crd-condition`:
- Helpers to locate and decode Helm v3 release Secrets and extract the rendered manifest used by `kubetracker helm`.
148
185
-`pkg/printer/`
149
186
- Progress/events/log tables (inspired by nelm’s printer).
150
187
- Adjusted to suppress healthy pod logs; render only failure logs.
@@ -159,17 +196,19 @@ This separation keeps the CLI thin and the tracking logic testable and reusable.
159
196
- CRD readiness via common conditions + custom mapping flag; built-in defaults for common CRDs.
160
197
- Progress/events; logs only for failures; pod status enrichment; READY banner on success.
161
198
- Failure grace period for transient errors on builtin trackers; exit-on-first-fail support.
199
+
- Helm release tracking (`kubetracker helm`) to read and decode Helm v3 Secrets and track rendered manifests.
162
200
- v0.1: Better CRD support
163
201
- More per-kind defaults (ExternalSecret, KafkaTopic, PrometheusRule, etc.) and improved heuristics.
164
202
- v0.2: Quality-of-life
165
203
- Structured JSON output mode for CI consumption.
166
-
- --apply flag (optional) to apply manifests inline before tracking.
204
+
-`--apply` flag (optional) to apply manifests inline before tracking.
167
205
- Namespace discovery from manifests when not provided.
168
206
169
207
## Best practices and notes
170
208
171
209
- Run kubetracker alongside your deploy step (kubectl/helm). If you must serialize, consider `--apply` in a future version.
172
-
- Keep CRD readiness explicit via `--crd-condition` whenever your controller doesn’t expose a standard “Ready=True”.
210
+
- For Helm releases, prefer `kubetracker helm <ns>/<name>` when you want in-cluster rendered manifests to be tracked, or pipe `helm template` to `kubetracker track` if you render locally.
211
+
- Keep CRD readiness explicit via `--crd-condition` whenever your controller doesn’t expose a standard `Ready=True`.
173
212
- If your CI needs machine readable output, prefer the future JSON mode. For now, you can grep by headers and statuses.
0 commit comments