Skip to content

Commit

Permalink
fix: non-platform created components do not log events (#1691)
Browse files Browse the repository at this point in the history
  • Loading branch information
yangkaa authored Jul 19, 2023
1 parent 330309a commit fe9fec7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion worker/master/podevent/podevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,13 @@ func recordUpdateEvent(clientset kubernetes.Interface, pod *corev1.Pod, f determ
return
}
podstatus := new(pb.PodStatus)
wutil.DescribePodStatus(clientset, pod, podstatus, k8sutil.DefListEventsByPod)
// Non-platform created components do not log events
tenantID, serviceID, _, _ := k8sutil.ExtractLabels(pod.GetLabels())
if tenantID == "" || serviceID == "" {
logrus.Debugf("pod: %s; tenantID or serviceID is empty", pod.GetName())
return
}
wutil.DescribePodStatus(clientset, pod, podstatus, k8sutil.DefListEventsByPod)
// the pod in the pending status has no start time and container statuses
if podstatus.Type == pb.PodStatus_ABNORMAL || podstatus.Type == pb.PodStatus_NOTREADY || podstatus.Type == pb.PodStatus_UNHEALTHY {
var eventID string
Expand Down Expand Up @@ -189,7 +194,12 @@ func recordUpdateEvent(clientset kubernetes.Interface, pod *corev1.Pod, f determ

// AbnormalEvent -
func AbnormalEvent(clientset kubernetes.Interface, pod *corev1.Pod) {
// Non-platform created components do not log events
tenantID, serviceID, _, _ := k8sutil.ExtractLabels(pod.GetLabels())
if tenantID == "" || serviceID == "" {
logrus.Debugf("pod: %s; tenantID or serviceID is empty", pod.GetName())
return
}
if pod != nil && pod.Status.Phase == corev1.PodPending {
for _, condition := range pod.Status.Conditions {
if condition.Type == corev1.PodScheduled && condition.Status == "False" {
Expand Down

0 comments on commit fe9fec7

Please sign in to comment.