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

Panic when using watcher with a resource that does not expose a resourceVersion #1092

Closed
umanwizard opened this issue Nov 26, 2022 · 5 comments · Fixed by #1101
Closed

Panic when using watcher with a resource that does not expose a resourceVersion #1092

umanwizard opened this issue Nov 26, 2022 · 5 comments · Fixed by #1101
Labels
bug Something isn't working errors error handling or error ergonomics runtime controller runtime related

Comments

@umanwizard
Copy link

Current and expected behavior

See title. The offending line is here.

Possible solution

No response

Additional context

metrics-server apparently creates PodMetrics resources without this field, and my code panics when trying to watch them.

Environment

Client Version: v1.22.10
Server Version: v1.23.4
FROM ubuntu:jammy-20221101

Configuration and features

No response

Affected crates

kube-runtime

Would you like to work on fixing this bug?

No response

@umanwizard umanwizard added the bug Something isn't working label Nov 26, 2022
@nightkr
Copy link
Member

nightkr commented Nov 26, 2022

I believe metrics-server is using an extension API, so I'm not sure they support watches at all. That said, we should definitely at least have clearer error messages for this, and avoid panicking...

@goenning
Copy link
Contributor

goenning commented Dec 6, 2022

I've hit this wall too, watch is not supported: /~https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/1013-metrics-watch-api

Polling is the only alternative AFAIK

@clux clux added runtime controller runtime related errors error handling or error ergonomics labels Dec 7, 2022
@clux
Copy link
Member

clux commented Dec 7, 2022

In that case should probably extend watcher::Error here with a NoResourceVersion error variant and bubble that up from the offending line above.

@clux clux added help wanted Not immediately prioritised, please help! good first issue Good for newcomers and removed help wanted Not immediately prioritised, please help! good first issue Good for newcomers labels Dec 7, 2022
clux added a commit that referenced this issue Dec 7, 2022
Closes #1092

Signed-off-by: clux <sszynrae@gmail.com>
@clux clux linked a pull request Dec 7, 2022 that will close this issue
@clux
Copy link
Member

clux commented Dec 7, 2022

Quick PR in #1101 to turn the unwrap into an error. This will cause a repeating error when watch is not supported though, but hopefully it's more informative and a developer can catch/notice this earlier and be less confused about it than if it was an unwrap.

@nightkr
Copy link
Member

nightkr commented Dec 7, 2022

We may also want to add a poll_watcher at some point to cope with these cases...

@clux clux closed this as completed in #1101 Dec 9, 2022
clux added a commit that referenced this issue Dec 9, 2022
* Gracefully error in watcher when kinds do not support watch

Closes #1092

Signed-off-by: clux <sszynrae@gmail.com>

* Update kube-runtime/src/watcher.rs

Co-authored-by: teozkr <teo.roijezon@stackable.de>
Signed-off-by: Eirik A <sszynrae@gmail.com>

Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: Eirik A <sszynrae@gmail.com>
Co-authored-by: teozkr <teo.roijezon@stackable.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working errors error handling or error ergonomics runtime controller runtime related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants