-
-
Notifications
You must be signed in to change notification settings - Fork 284
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 ResourceExt::creation_timestamp #888
Conversation
kube-core/src/resource.rs
Outdated
@@ -225,4 +233,8 @@ impl<K: Resource> ResourceExt for K { | |||
fn finalizers_mut(&mut self) -> &mut Vec<String> { | |||
self.meta_mut().finalizers.get_or_insert_with(Vec::new) | |||
} | |||
|
|||
fn creation(&self) -> Option<Time> { | |||
self.meta().creation_timestamp.clone() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is possible that this method should reach into the inner chrono DateTime
since the k8s-openapi
one is just a wrapper for it.
EDIT: but that's probably a deref issue for the serialization layer rather than us forcing a .0
Codecov Report
@@ Coverage Diff @@
## master #888 +/- ##
==========================================
- Coverage 70.39% 70.34% -0.06%
==========================================
Files 62 62
Lines 4287 4289 +2
==========================================
- Hits 3018 3017 -1
- Misses 1269 1272 +3
|
kube-core/src/resource.rs
Outdated
/// Returns the creation timestamp | ||
/// | ||
/// This is guaranteed to exist on resources received by the apiserver. | ||
fn creation(&self) -> Option<Time>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
creation
sound awkward to me. created_at
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, actually, it might be smarter to go for the full creation_timestamp
name here upon reflection; because everything else is named exactly after the names in ObjectMeta
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, looks good to me
shortcut method to access a cloned creation timestamp Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
40aa4c1
to
992f622
Compare
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
shortcut method to access a cloned creation timestamp.