FindContainerImages does not detect images in initContainers and CronJob jobTemplate
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 364
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 84
Description
Title
FindContainerImages does not detect images in initContainers and CronJob jobTemplate
Description
Summary
The current implementation of FindContainerImages only extracts container images from:
spec.template.spec.containers.image
However, Kubernetes manifests can reference container images in additional valid fields which are currently not handled.
Missing Fields
The function does not detect images from:
spec.template.spec.initContainers.image
spec.jobTemplate.spec.template.spec.containers.image (CronJob)
spec.jobTemplate.spec.template.spec.initContainers.image (CronJob)
There is already a TODO comment in the code mentioning this limitation.
Impact
Because of this limitation:
Images used in initContainers are ignored.
CronJob images may not be detected.
Image tracking or diff logic relying on this function may be incomplete.
Manifest analysis becomes inaccurate for certain workloads.
Suggested Improvement
Extend FindContainerImages to also extract images from:
spec.template.spec.initContainers.image
spec.jobTemplate.spec.template.spec.containers.image
spec.jobTemplate.spec.template.spec.initContainers.image
This can be implemented using the existing nestedStringSlice helper for consistency.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at FindContainerImages and inspect the existing TODO and nestedStringSlice helper. Trace how images are collected from the current template path, then extend the collection to the listed initContainers and CronJob jobTemplate paths. Done means all four valid image locations are detected consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100