mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 04:52:08 +00:00
Merge pull request #118530 from carlory/fix-issue-118276
fix Cronjob status.lastSuccessfulTime not populated by a manually triggered job
This commit is contained in:
commit
bca1336021
@ -261,17 +261,10 @@ func (o *CreateJobOptions) createJobFromCronJob(cronJob *batchv1.CronJob) *batch
|
|||||||
// this is ok because we know exactly how we want to be serialized
|
// this is ok because we know exactly how we want to be serialized
|
||||||
TypeMeta: metav1.TypeMeta{APIVersion: batchv1.SchemeGroupVersion.String(), Kind: "Job"},
|
TypeMeta: metav1.TypeMeta{APIVersion: batchv1.SchemeGroupVersion.String(), Kind: "Job"},
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: o.Name,
|
Name: o.Name,
|
||||||
Annotations: annotations,
|
Annotations: annotations,
|
||||||
Labels: cronJob.Spec.JobTemplate.Labels,
|
Labels: cronJob.Spec.JobTemplate.Labels,
|
||||||
OwnerReferences: []metav1.OwnerReference{
|
OwnerReferences: []metav1.OwnerReference{*metav1.NewControllerRef(cronJob, batchv1.SchemeGroupVersion.WithKind("CronJob"))},
|
||||||
{
|
|
||||||
APIVersion: batchv1.SchemeGroupVersion.String(),
|
|
||||||
Kind: "CronJob",
|
|
||||||
Name: cronJob.GetName(),
|
|
||||||
UID: cronJob.GetUID(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Spec: cronJob.Spec.JobTemplate.Spec,
|
Spec: cronJob.Spec.JobTemplate.Spec,
|
||||||
}
|
}
|
||||||
|
@ -161,16 +161,9 @@ func TestCreateJobFromCronJob(t *testing.T) {
|
|||||||
expected: &batchv1.Job{
|
expected: &batchv1.Job{
|
||||||
TypeMeta: metav1.TypeMeta{APIVersion: batchv1.SchemeGroupVersion.String(), Kind: "Job"},
|
TypeMeta: metav1.TypeMeta{APIVersion: batchv1.SchemeGroupVersion.String(), Kind: "Job"},
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: jobName,
|
Name: jobName,
|
||||||
Annotations: map[string]string{"cronjob.kubernetes.io/instantiate": "manual"},
|
Annotations: map[string]string{"cronjob.kubernetes.io/instantiate": "manual"},
|
||||||
OwnerReferences: []metav1.OwnerReference{
|
OwnerReferences: []metav1.OwnerReference{*metav1.NewControllerRef(cronJob, batchv1.SchemeGroupVersion.WithKind("CronJob"))},
|
||||||
{
|
|
||||||
APIVersion: batchv1.SchemeGroupVersion.String(),
|
|
||||||
Kind: "CronJob",
|
|
||||||
Name: cronJob.GetName(),
|
|
||||||
UID: cronJob.GetUID(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Spec: batchv1.JobSpec{
|
Spec: batchv1.JobSpec{
|
||||||
Template: corev1.PodTemplateSpec{
|
Template: corev1.PodTemplateSpec{
|
||||||
|
Loading…
Reference in New Issue
Block a user