Skip to content

Commit

Permalink
Merge pull request #3683 from chaunceyjiang/cronjob
Browse files Browse the repository at this point in the history
fix panic when printing log when lastSuccessfulTime of cronjob is nil
  • Loading branch information
karmada-bot committed Jun 20, 2023
2 parents b05784e + c3a4c26 commit 1791270
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/resourceinterpreter/default/native/aggregatestatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ func aggregateCronJobStatus(object *unstructured.Unstructured, aggregatedStatusI
if err = json.Unmarshal(item.Status.Raw, temp); err != nil {
return nil, err
}
klog.V(3).Infof("Grab cronJob(%s/%s) status from cluster(%s), active: %+v, lastScheduleTime: %s, lastSuccessfulTime: %s",
cronjob.Namespace, cronjob.Name, item.ClusterName, temp.Active, temp.LastScheduleTime.String(), temp.LastSuccessfulTime.String())
klog.V(3).Infof("Grab cronJob(%s/%s) status from cluster(%s), active: %+v, lastScheduleTime: %+v, lastSuccessfulTime: %+v",
cronjob.Namespace, cronjob.Name, item.ClusterName, temp.Active, temp.LastScheduleTime, temp.LastSuccessfulTime)
newStatus.Active = append(newStatus.Active, temp.Active...)
if newStatus.LastScheduleTime == nil {
newStatus.LastScheduleTime = temp.LastScheduleTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ func Test_aggregateCronJobStatus(t *testing.T) {
},
},
"lastScheduleTime": "2023-02-08T07:16:00Z",
"lastSuccessfulTime": "2023-02-08T07:15:00Z",
"lastSuccessfulTime": nil,
})
cronjobStatusRaw2, _ := helper.BuildStatusRawExtension(map[string]interface{}{
"active": []corev1.ObjectReference{
Expand Down

0 comments on commit 1791270

Please sign in to comment.