Skip to content

Watch events sometimes fail to parse #1986

@AlexandreTunstall

Description

@AlexandreTunstall

Current and expected behavior

Sometimes, one of my controllers encounters one of the following errors.

QueueError(WatchFailed(SerdeError(Error("invalid type: string \"kind\", expected adjacently tagged enum WatchEvent", line: 1, column: 8))))
QueueError(WatchFailed(SerdeError(Error("invalid type: string \"code\", expected adjacently tagged enum WatchEvent", line: 1, column: 8))))
QueueError(WatchFailed(SerdeError(Error("invalid type: string \"status\", expected adjacently tagged enum WatchEvent", line: 1, column: 10))))
QueueError(WatchFailed(SerdeError(Error("invalid type: string \"reason\", expected adjacently tagged enum WatchEvent", line: 1, column: 10))))
QueueError(WatchFailed(SerdeError(Error("invalid type: string \"message\", expected adjacently tagged enum WatchEvent", line: 1, column: 11))))
QueueError(WatchFailed(SerdeError(Error("invalid type: string \"details\", expected adjacently tagged enum WatchEvent", line: 1, column: 11))))
QueueError(WatchFailed(SerdeError(Error("invalid type: string \"metadata\", expected adjacently tagged enum WatchEvent", line: 1, column: 12))))
QueueError(WatchFailed(SerdeError(Error("invalid type: string \"apiVersion\", expected adjacently tagged enum WatchEvent", line: 1, column: 14))))
QueueError(WatchFailed(SerdeError(Error("invalid type: string \"retryAfterSeconds\", expected adjacently tagged enum WatchEvent", line: 1, column: 23))))

As a result, the controller is unable to respond immediately to events and has to retry until the error disappears (which it usually does after a few retries).

It seems to me like kube is not correctly parsing some WatchEvent entries, but I can't understand why, nor am I able to see from the debug logs the raw JSON of the events that fail to parse (tcpdump would not help because of TLS).

Possible solution

No response

Additional context

The error is frequent, unpredictable, and intermittent.

Could it be something wrong with my custom resources?

Environment

The Kubernetes cluster was manually set up.

Server Version: v1.36.1
kube version: 3.1.0

What is OS in your Dockerfile?

N/A. The image in which kube is running was generated via nix (i.e. effectively FROM scratch). The image consists solely of the statically linked binary.

Configuration and features

k8s-openapi = { version = "0.27.0", features = ["schemars", "v1_35"] }
kube = { version = "3.0.1", features = ["derive", "runtime", "unstable-runtime", "ws"] }

YAML

No response

Affected crates

kube-core

Would you like to work on fixing this bug?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions