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 helper for creating a controller owner_ref on Resource #850

Merged
merged 3 commits into from
Mar 17, 2022

Conversation

clux
Copy link
Member

@clux clux commented Mar 17, 2022

Motivation

Controllers frequently have to create owned objects with owner references pointing back to the object we get passed to reconcile.

We would like a way to quickly populate the OwnerReference struct for this case to avoid having to hand-cook this in every controller.

Solution

Grab the function in configmapgen_controller and add it as a Resource::controller_owner_ref impl.

It's possible we should put this elsewhere, am open to ideas, but we should have something like this.

Signed-off-by: clux <sszynrae@gmail.com>
@clux clux added the changelog-add changelog added category for prs label Mar 17, 2022
@clux clux requested a review from a team March 17, 2022 08:15
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
@clux clux added this to the 0.70.0 milestone Mar 17, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #850 (da52814) into master (47fcf10) will decrease coverage by 0.12%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #850      +/-   ##
==========================================
- Coverage   70.42%   70.29%   -0.13%     
==========================================
  Files          59       59              
  Lines        4203     4212       +9     
==========================================
+ Hits         2960     2961       +1     
- Misses       1243     1251       +8     
Impacted Files Coverage Δ
kube-core/src/resource.rs 51.35% <0.00%> (-7.12%) ⬇️
kube-runtime/src/wait.rs 70.00% <0.00%> (+2.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47fcf10...da52814. Read the comment docs.

@clux clux merged commit d99a144 into master Mar 17, 2022
@clux clux deleted the owner-ref-gen branch March 17, 2022 08:37
@clux clux added the ergonomics ergonomics of the public interface label Mar 17, 2022
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 ergonomics ergonomics of the public interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants