Skip to content

Detect (and meanwhile flag) images in common custom resources with PodSpecs #75

Description

@MPV

Summary

kir extracts images from a fixed set of core workload kinds (Pod, Deployment, DaemonSet, ReplicaSet, StatefulSet, Job, CronJob). Any document whose kind isn't registered in the scheme — CRDs / custom resources — is skipped (see #54). But many widely-used custom resources embed a pod template or image references, so kir silently misses their images today. For a tool that feeds vulnerability scanners, that's a coverage gap — and the same silent-data-loss class as #49.

This issue tracks two things: a short-term visibility improvement, and the longer-term detection work with a concrete catalog of targets.

(a) Visibility now: flag unrecognized kinds ("seen but not detected")

Today an unregistered kind is skipped silently. As a stepping stone — and independent of how detection is eventually implemented — kir can warn on stderr (exit 0) when it meets a kind it doesn't understand:

warning: skipped unrecognized kind "Rollout" (argoproj.io/v1alpha1); kir cannot yet extract images from it

This tells users kir saw the document but didn't inspect it, instead of leaving them to guess whether images were missed. stdout stays clean (images only), so pipelines are unaffected; exit stays 0 because an unknown kind isn't a failure. Contrast with known image-less kinds (Service, ConfigMap), which stay silently skipped — they're expected and have nothing to report. See the document-classification policy documented in #54.

(b) Detection: support common custom resources

The mechanism is tracked in #26 (dynamically locate a PodSpec rather than hardcoding kinds; Cue explored in #27–#30). Whichever approach wins, this is the concrete target list — each row is also a good acceptance fixture:

Resource API group · kind Where the images live
Argo Rollouts argoproj.io · Rollout spec.template (a PodTemplateSpec, like Deployment)
Argo Workflows argoproj.io · Workflow, CronWorkflow spec.templates[].container / .script.image, .containerSet.containers[]
Knative Serving serving.knative.dev · Service, Configuration, Revision spec.template.spec.containers[]
Tekton tekton.dev · Task, TaskRun, Pipeline… spec.steps[].image, spec.sidecars[].image
OpenKruise apps.kruise.io · CloneSet, Advanced StatefulSet/DaemonSet, BroadcastJob pod template (spec.template.spec)
KEDA keda.sh · ScaledJob spec.jobTargetRef.template.spec (pod template). ScaledObject only references a workload — no direct images
Prometheus Operator monitoring.coreos.com · Prometheus, Alertmanager, ThanosRuler spec.image, plus spec.containers[] / initContainers[]
KubeVirt kubevirt.io · VirtualMachine(Instance) spec.template.spec.volumes[].containerDisk.image — a different shape, likely out of scope for a PodSpec-based detector

Not every custom resource fits a PodSpec: some carry bare image: fields, and some (Flux, cert-manager) carry none. A PodSpec-only detector covers the majority; the odd ones out are candidates for explicit per-kind handling — or explicit non-support.

Suggested rollout

  1. Land visibility (a) first — small, and immediately useful on its own.
  2. Pick the detection mechanism (Dynamically find PodSpec in manifests #26): structural PodSpec search vs. per-kind extractors vs. Cue (Use newest CUE (0.13.x - needed for registry support) #27–Extract images from PodSpec using Cue #30).
  3. Add resources from the catalog one per PR, each with an approvals fixture, starting with the highest-value few (Argo Rollouts, Knative, Tekton).

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions