pipe-cd / pipe-cd/pipecd

FindContainerImages does not detect images in initContainers and CronJob jobTemplate

Open Beginner friendly
#6,528 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.