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

Add ResourceExt::creation_timestamp #888

Merged
merged 5 commits into from May 6, 2022
Merged

Add ResourceExt::creation_timestamp #888

merged 5 commits into from May 6, 2022

Conversation

clux
Copy link
Member

@clux clux commented Apr 18, 2022

shortcut method to access a cloned creation timestamp.

@clux clux mentioned this pull request Apr 18, 2022
@@ -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()
Copy link
Member Author

@clux clux Apr 18, 2022

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

@clux clux added the changelog-add changelog added category for prs label Apr 18, 2022
@clux clux added this to the 0.72.0 milestone Apr 18, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2022

Codecov Report

Merging #888 (1cae27e) into master (bb3ad20) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

@@            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     
Impacted Files Coverage Δ
kube-core/src/resource.rs 47.50% <0.00%> (-1.22%) ⬇️
kube-runtime/src/wait.rs 68.00% <0.00%> (-2.00%) ⬇️

@clux clux removed this from the 0.72.0 milestone Apr 18, 2022
/// Returns the creation timestamp
///
/// This is guaranteed to exist on resources received by the apiserver.
fn creation(&self) -> Option<Time>;
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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

clux added 2 commits May 6, 2022 19:41
shortcut method to access a cloned creation timestamp

Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
@clux clux changed the title Add ResourceExt::creation Add ResourceExt::created_at May 6, 2022
@clux clux added this to the 0.72.0 milestone May 6, 2022
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
@clux clux changed the title Add ResourceExt::created_at Add ResourceExt::creation_timestamp May 6, 2022
Signed-off-by: clux <sszynrae@gmail.com>
@clux clux merged commit 17b489a into master May 6, 2022
@clux clux deleted the resource-ext-creation branch May 6, 2022 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-add changelog added category for prs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants