Skip to content

Commit

Permalink
Merge pull request #17 from MrFishFinger/handle-non-cronjob-managed-jobs
Browse files Browse the repository at this point in the history
fix: ensure that Job owner is actually a CronJob before appending it
  • Loading branch information
rothgar authored Aug 3, 2023
2 parents 84449d9 + 6e72d0d commit 6e839c8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 6e839c8

Please sign in to comment.