Skip to content

Commit

Permalink
fix(discovery): ignore cronjob if no have jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
djerfy committed Jun 26, 2023
1 parent 5b5216c commit a9d241c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/modules/kubernetes/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ def getCronjob(name=None, exclude_name=None, exclude_namespace=None):

for job in kubernetes.list_job_for_all_namespaces().items:

if not job:
continue

if not job.metadata.owner_references:
continue

Expand All @@ -260,6 +263,9 @@ def getCronjob(name=None, exclude_name=None, exclude_namespace=None):
if related_job_dt > job_latest_dt:
job_latest = related_job

if type(job_latest) is dict:
continue

if job_latest.status.conditions[0].type == "Complete":
cronjob_status = "0"
else:
Expand Down

0 comments on commit a9d241c

Please sign in to comment.