From 4e936006f7ce97aace7b3406c54b29a96d599b7b Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 11:44:54 -0400 Subject: [PATCH] fix(action): populate all fields of Job from CronJob (#15259) (#15727) (#15729) Signed-off-by: sergey.ladutko Co-authored-by: SergeyLadutko <40435115+SergeyLadutko@users.noreply.github.com> Co-authored-by: sergey.ladutko --- .../batch/CronJob/actions/create-job/action.lua | 6 +----- .../batch/CronJob/actions/testdata/cronjob.yaml | 1 + .../batch/CronJob/actions/testdata/job.yaml | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/resource_customizations/batch/CronJob/actions/create-job/action.lua b/resource_customizations/batch/CronJob/actions/create-job/action.lua index 17b6455fa3d5d..e262facb0d415 100644 --- a/resource_customizations/batch/CronJob/actions/create-job/action.lua +++ b/resource_customizations/batch/CronJob/actions/create-job/action.lua @@ -47,11 +47,7 @@ ownerRef.uid = obj.metadata.uid job.metadata.ownerReferences = {} job.metadata.ownerReferences[1] = ownerRef -job.spec = {} -job.spec.suspend = false -job.spec.template = {} -job.spec.template.metadata = deepCopy(obj.spec.jobTemplate.spec.template.metadata) -job.spec.template.spec = deepCopy(obj.spec.jobTemplate.spec.template.spec) +job.spec = deepCopy(obj.spec.jobTemplate.spec) impactedResource = {} impactedResource.operation = "create" diff --git a/resource_customizations/batch/CronJob/actions/testdata/cronjob.yaml b/resource_customizations/batch/CronJob/actions/testdata/cronjob.yaml index d422c82da393a..2c45c5eae1f38 100644 --- a/resource_customizations/batch/CronJob/actions/testdata/cronjob.yaml +++ b/resource_customizations/batch/CronJob/actions/testdata/cronjob.yaml @@ -13,6 +13,7 @@ spec: annotations: my: annotation spec: + ttlSecondsAfterFinished: 100 template: metadata: labels: diff --git a/resource_customizations/batch/CronJob/actions/testdata/job.yaml b/resource_customizations/batch/CronJob/actions/testdata/job.yaml index 16d4e4960b0dc..1ef281afdcdb4 100644 --- a/resource_customizations/batch/CronJob/actions/testdata/job.yaml +++ b/resource_customizations/batch/CronJob/actions/testdata/job.yaml @@ -10,6 +10,7 @@ annotations: my: annotation spec: + ttlSecondsAfterFinished: 100 template: metadata: labels: