Skip to content

feat: collect pods with workload ownership, containers, and images - #5

Merged
kfeofantov merged 1 commit into
mainfrom
feat/pod-collector
Jul 28, 2026
Merged

kfeofantov merged 1 commit into
mainfrom
feat/pod-collector

Conversation

@kfeofantov

Copy link
Copy Markdown
Contributor

First collector slice — read-only, log-only:

  • internal/collector.PodWatcher: lists all pods in all namespaces via shared informers, then keeps watching for new ones.
  • Ownership resolution walks the owner chain one controller hop at a time: Pod → ReplicaSet → Deployment/Rollout, Pod → Job → CronJob, plus direct controllers (StatefulSet, DaemonSet, bare Job, static pods owned by Node) and bare pods (none).
  • Collected view per pod: namespace, name, node, phase, workload, containers + images (init containers flagged). Env, args, command are never read — filter early.
  • The agent only logs; nothing is written to disk or transmitted.

Tests:

  • Unit tests on the fake clientset cover all ownership chains, container extraction, and the subscribe-after-start path.
  • First e2e suite (test/e2e, build tag e2e): runs against a disposable kind cluster (make cluster-up e2e cluster-down), creates a real Deployment and a CronJob-owned Job, and asserts on watcher output. Refuses to run against non-kind contexts. kind is a Go tool dependency — no local install needed.

Verified live against kind v1.36.1: initial list + new-pod subscription + static-pod (Node-owned) resolution all correct.

🤖 Generated with Claude Code

PodWatcher lists all pods in all namespaces and subscribes to new ones
via shared informers. Each pod is resolved to its managing workload
(Deployment, CronJob, Rollout, StatefulSet, DaemonSet, Job, bare pod)
by walking the owner chain one controller hop at a time, and reduced to
namespace, name, node, phase, workload, and container images. Env, args,
and command are never read (filter early). The agent only logs for now;
nothing is written or transmitted.

E2e tests run against a disposable kind cluster (make cluster-up e2e
cluster-down) and refuse to target non-kind contexts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kfeofantov
kfeofantov merged commit 2839c7a into main Jul 28, 2026
3 checks passed
@kfeofantov
kfeofantov deleted the feat/pod-collector branch July 28, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant