Skip to content

Commit 6e839c8

Browse files
authored
Merge pull request #17 from MrFishFinger/handle-non-cronjob-managed-jobs
fix: ensure that Job owner is actually a CronJob before appending it
2 parents 84449d9 + 6e72d0d commit 6e839c8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,8 @@ func printResources(namespace corev1.Namespace, clientset *kubernetes.Clientset,
273273
continue
274274
}
275275

276-
// check if the job has an owner
277-
// If it does then it's part of a CronJob
278-
if len(job.ObjectMeta.OwnerReferences) == 0 {
276+
// check if the job has an owner, and that it is of kind `CronJob`
277+
if len(job.ObjectMeta.OwnerReferences) == 0 || job.ObjectMeta.OwnerReferences[0].Kind != "CronJob" {
279278
if _, ok := nsJobs[job.Name]; !ok {
280279
nsJobs[job.Name] = job
281280
}

0 commit comments

Comments
 (0)