Skip to content

Commit

Permalink
fix: ensure that Job owner is actually a CronJob before appending it
Browse files Browse the repository at this point in the history
  • Loading branch information
MrFishFinger committed Aug 3, 2023
1 parent 84449d9 commit 6e72d0d
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 6e72d0d

Please sign in to comment.