From d4150f809b6394b746f21bdaea3e5b5b59275d2c Mon Sep 17 00:00:00 2001 From: mgianluc Date: Tue, 24 Sep 2024 15:50:40 +0200 Subject: [PATCH] Fix Job examples --- docs/getting_started/features/schedule/schedule.md | 6 +++--- examples-unused-resources/jobs/completed_jobs.yaml | 2 +- .../validate_resourceselector/completed_jobs/cleaner.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/getting_started/features/schedule/schedule.md b/docs/getting_started/features/schedule/schedule.md index 296cce8..1a5d349 100644 --- a/docs/getting_started/features/schedule/schedule.md +++ b/docs/getting_started/features/schedule/schedule.md @@ -52,7 +52,7 @@ The k8s-cleaner is able to accept the below schedule formats. hs = {} hs.matching = false if obj.status ~= nil then - if obj.status.completionTime ~= nil and obj.status.succeeded > 0 and obj.status.active == 0 then + if obj.status.completionTime ~= nil and obj.status.succeeded > 0 then hs.matching = true end end @@ -77,7 +77,7 @@ kind: Cleaner metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | - {"apiVersion":"apps.projectsveltos.io/v1alpha1","kind":"Cleaner","metadata":{"annotations":{},"name":"completed-jobs"},"spec":{"action":"Delete","resourcePolicySet":{"resourceSelectors":[{"evaluate":"function evaluate()\n hs = {}\n hs.matching = false\n if obj.status ~= nil then\n if obj.status.completionTime ~= nil and obj.status.succeeded \u003e 0 and obj.status.active == 0 then\n hs.matching = true\n end\n end\n return hs\nend\n","group":"batch","kind":"Job","version":"v1"}]},"schedule":"@every 1h30m"}} + {"apiVersion":"apps.projectsveltos.io/v1alpha1","kind":"Cleaner","metadata":{"annotations":{},"name":"completed-jobs"},"spec":{"action":"Delete","resourcePolicySet":{"resourceSelectors":[{"evaluate":"function evaluate()\n hs = {}\n hs.matching = false\n if obj.status ~= nil then\n if obj.status.completionTime ~= nil and obj.status.succeeded \u003e 0 then\n hs.matching = true\n end\n end\n return hs\nend\n","group":"batch","kind":"Job","version":"v1"}]},"schedule":"@every 1h30m"}} creationTimestamp: "2024-08-03T14:09:49Z" finalizers: - projectsveltos.io/cleaner-finalizer @@ -94,7 +94,7 @@ spec: hs = {} hs.matching = false if obj.status ~= nil then - if obj.status.completionTime ~= nil and obj.status.succeeded > 0 and obj.status.active == 0 then + if obj.status.completionTime ~= nil and obj.status.succeeded > 0 then hs.matching = true end end diff --git a/examples-unused-resources/jobs/completed_jobs.yaml b/examples-unused-resources/jobs/completed_jobs.yaml index 66b7411..68a0f1b 100644 --- a/examples-unused-resources/jobs/completed_jobs.yaml +++ b/examples-unused-resources/jobs/completed_jobs.yaml @@ -19,7 +19,7 @@ spec: hs = {} hs.matching = false if obj.status ~= nil then - if obj.status.completionTime ~= nil and obj.status.succeeded > 0 and obj.status.active == 0 then + if obj.status.completionTime ~= nil and obj.status.succeeded > 0 then hs.matching = true end end diff --git a/internal/controller/executor/validate_resourceselector/completed_jobs/cleaner.yaml b/internal/controller/executor/validate_resourceselector/completed_jobs/cleaner.yaml index 66b7411..68a0f1b 100644 --- a/internal/controller/executor/validate_resourceselector/completed_jobs/cleaner.yaml +++ b/internal/controller/executor/validate_resourceselector/completed_jobs/cleaner.yaml @@ -19,7 +19,7 @@ spec: hs = {} hs.matching = false if obj.status ~= nil then - if obj.status.completionTime ~= nil and obj.status.succeeded > 0 and obj.status.active == 0 then + if obj.status.completionTime ~= nil and obj.status.succeeded > 0 then hs.matching = true end end