Skip to content
This repository was archived by the owner on Aug 31, 2022. It is now read-only.
This repository was archived by the owner on Aug 31, 2022. It is now read-only.

Wrong GetTimestampMs value of FailedScheduling event #194

@lobshunter

Description

@lobshunter

On kubernetes 1.19.x version, kube-scheduler emits FailedScheduling event with FirstTimestamp field set to null.

$ kubectl get event mypod.16e645b5c10bc186 -o json | jq
{
  "action": "Scheduling",
  "apiVersion": "v1",
  "eventTime": "2022-04-16T04:22:40.408032Z",
  "firstTimestamp": null,
  "involvedObject": {
    "apiVersion": "v1",
    "kind": "Pod",
    "name": "mypod",
    "namespace": "mynamespace",
    "resourceVersion": "775554465",
    "uid": "1901567b-4b02-4b9c-a67f-2c8977a818d6"
  },
  "kind": "Event",
  "lastTimestamp": null,
  "message": "0/1 nodes are available: 1 node(s) didn't match node selector.",
  "metadata": {
    "creationTimestamp": "2022-04-16T04:22:40Z",
    "name": "mypod.16e645b5c10bc186",
    "namespace": "mynamespace",
    "resourceVersion": "775554468",
    "selfLink": "/api/v1/namespaces/mynamespace/events/mypod.16e645b5c10bc186",
    "uid": "dd5843da-a3f1-404a-9f40-2c592a256054"
  },
  "reason": "FailedScheduling",
  "reportingComponent": "default-scheduler",
  "reportingInstance": "default-scheduler-172.16.4.67",
  "source": {},
  "type": "Warning"
}

GetTimestampMs method should read timestamp from eventTime instead. Otherwise the timestamp is regarded as zero value, such timestamp cause issues(e.g. Loki sink rejects the event).

I will submit a PR for this and check the behavior of different versions of kube-scheduler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions