Skip to content

Commit 38e970c

Browse files
authored
fix cronjob status.lastSuccessfulTime not populated by a manually triggered job (#9881)
1 parent 3e47336 commit 38e970c

File tree

1 file changed

+5
-10
lines changed
  • modules/api/pkg/resource/cronjob

1 file changed

+5
-10
lines changed

modules/api/pkg/resource/cronjob/jobs.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,11 @@ func TriggerCronJob(client client.Interface,
114114

115115
jobToCreate := &batch.Job{
116116
ObjectMeta: meta.ObjectMeta{
117-
Name: newJobName,
118-
Namespace: namespace,
119-
Annotations: annotations,
120-
Labels: labels,
121-
OwnerReferences: []meta.OwnerReference{{
122-
APIVersion: CronJobAPIVersion,
123-
Kind: CronJobKindName,
124-
Name: cronJob.Name,
125-
UID: cronJob.UID,
126-
}},
117+
Name: newJobName,
118+
Namespace: namespace,
119+
Annotations: annotations,
120+
Labels: labels,
121+
OwnerReferences: []meta.OwnerReference{*meta.NewControllerRef(cronJob, batch.SchemeGroupVersion.WithKind("CronJob"))},
127122
},
128123
Spec: cronJob.Spec.JobTemplate.Spec,
129124
}

0 commit comments

Comments
 (0)