FindReferencingConfigMaps and FindReferencingSecrets miss CronJob references
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 364
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 84
Description
What's the problem
While looking at the code after #6528 was fixed, I noticed that
FindReferencingConfigMaps and FindReferencingSecrets have the same
gap — they don't handle CronJobs.
Both functions only look through spec.template.spec.*, which works
for Deployments, StatefulSets, and DaemonSets. But CronJobs put their
pod template under spec.jobTemplate.spec.template.spec.*, so any
ConfigMap or Secret referenced inside a CronJob is completely invisible
to these functions.
What breaks
If a CronJob mounts a ConfigMap as a volume or pulls credentials from a
Secret via env, PipeCD won't know about it. That means drift detection
won't catch config changes, and re-deploys won't be triggered when those
configs change.
Paths that are currently missed
FindReferencingConfigMaps:
- spec.jobTemplate.spec.template.spec.volumes.configMap.name
- spec.jobTemplate.spec.template.spec.containers.env.valueFrom.configMapKeyRef.name
- spec.jobTemplate.spec.template.spec.containers.envFrom.configMapRef.name
- spec.jobTemplate.spec.template.spec.initContainers.env.valueFrom.configMapKeyRef.name
- spec.jobTemplate.spec.template.spec.initContainers.envFrom.configMapRef.name
FindReferencingSecrets:
- spec.jobTemplate.spec.template.spec.volumes.secret.secretName
- spec.jobTemplate.spec.template.spec.containers.env.valueFrom.secretKeyRef.name
- spec.jobTemplate.spec.template.spec.containers.envFrom.secretRef.name
- spec.jobTemplate.spec.template.spec.initContainers.env.valueFrom.secretKeyRef.name
- spec.jobTemplate.spec.template.spec.initContainers.envFrom.secretRef.name
The fix is straightforward — add the missing nestedStringSlice probes
for the jobTemplate paths, same pattern already used for the existing paths.
Affects both kubernetes and kubernetes_multicluster provider packages.
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
Search for FindReferencingConfigMaps and FindReferencingSecrets in the kubernetes and kubernetes_multicluster provider packages, then compare their existing nestedStringSlice probes for pod templates. Add matching probes for the CronJob jobTemplate paths listed in the issue, and verify that ConfigMap and Secret references from volumes, containers, and init containers are found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100