Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: upload some warn conditions #2115

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions worker/master/podevent/podevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,15 @@ func recordUpdateEvent(clientset kubernetes.Interface, pod *corev1.Pod, f determ
}

// running time
var rtime time.Time
var rtime metav1.Time
for _, condition := range pod.Status.Conditions {
if condition.Type != corev1.PodReady || condition.Status != corev1.ConditionTrue {
continue
}
rtime = condition.LastTransitionTime.Time
if condition.LastTransitionTime.IsZero() {
continue
}
rtime = condition.LastTransitionTime
}

// the container state of the pod in the PodStatus_Running must be running
Expand All @@ -178,7 +181,7 @@ func recordUpdateEvent(clientset kubernetes.Interface, pod *corev1.Pod, f determ
logrus.Debugf("Service id: %s; %s.", serviceID, msg)
loggerOpt := event.GetLoggerOption("failure")

if !rtime.IsZero() && time.Now().Sub(rtime) > 2*time.Minute {
if !rtime.IsZero() && time.Now().Sub(rtime.Time) > 2*time.Minute {
evt.FinalStatus = model.EventFinalStatusEmptyComplete.String()
if err := db.GetManager().ServiceEventDao().UpdateModel(evt); err != nil {
logrus.Warningf("event id: %s; failed to update service event: %v", evt.EventID, err)
Expand Down
Loading