-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
Add support for LogParams::since_time
#1342
Conversation
Tested using ```sh RUST_LOG=debug cargo run --example log_stream -- coredns-77ccd57875-k46v4 --since-time="2023-11-12T12:23:53Z" ``` on k3d. Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1342 +/- ##
=======================================
- Coverage 72.1% 72.1% -0.0%
=======================================
Files 75 75
Lines 6377 6387 +10
=======================================
+ Hits 4597 4604 +7
- Misses 1780 1783 +3
|
The type actually exist in the protos: https://github.com/kube-rs/k8s-pb/blob/d60271637aac5bb854d529f99d5e6a23154acd06/k8s-pb/src/api/core/v1/mod.rs#L3347 |
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
felt a bit uneasy about the |
Surprised this works, chrono is an optional dependency here: https://github.com/kube-rs/kube/blob/main/kube-core/Cargo.toml#L35 Am I missing something? |
i'm kind of cheating and piggybacking on |
k8s-openapi always depends on it in a minimal fashion so i feel that is ok... but we could also make it mandatory on our end with those features to make it explicit |
Adds a missing
sinceTime
parameter equivalent fromPodLogOptions
for #1339Think this is missing because of kubernetes/kubernetes#108498
Tested using
RUST_LOG=debug cargo run --example log_stream -- coredns-77ccd57875-k46v4 --since-time="2023-11-12T12:23:53Z"
on k3d.
Time Type
Am currently using
k8s_openapi::apimachinery::pkg::apis::meta::v1::Time
for the time wrapper but that's only a newtype overDateTime<Utc>
(viachrono
).This is a little awkward because the newtype implements serialize but we need it as a raw value for a query param (and passing it through
serde_json::to_string
did not feel useful), so in the end I am doing the same thing k8s-openapi is doing in its own serialize and calling chrono's to_rfc... fn.On a positive point, this does mean the
LogParams
type matches the type found onObjectMeta
(for creation_timestamp and deletion_timestamp), but this isn't actually very useful for the end user (as can be seen in the example with basically needing both types and converting between them).It could be simpler to expose
DateTime<Utc>
as the api time, but that means the type is locked down. Maybe we leave it and maybe push a PR tok8s-openapi
for convenience impls onTime
instead later to make it slightly more ergonomic?Also happy to remove the
Time
wrapper fromLogParams
and just putDateTime<Utc>
in there. Not sure which is best.