From 6e72d0d68346daab25e37a7e373efb5a31e97f26 Mon Sep 17 00:00:00 2001 From: MrFishFinger <4768596+MrFishFinger@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:19:07 +0200 Subject: [PATCH] fix: ensure that Job owner is actually a CronJob before appending it --- main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index c0c3290..c9eb208 100644 --- a/main.go +++ b/main.go @@ -273,9 +273,8 @@ func printResources(namespace corev1.Namespace, clientset *kubernetes.Clientset, continue } - // check if the job has an owner - // If it does then it's part of a CronJob - if len(job.ObjectMeta.OwnerReferences) == 0 { + // check if the job has an owner, and that it is of kind `CronJob` + if len(job.ObjectMeta.OwnerReferences) == 0 || job.ObjectMeta.OwnerReferences[0].Kind != "CronJob" { if _, ok := nsJobs[job.Name]; !ok { nsJobs[job.Name] = job }