-
-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add typed scale argument to derive macro #1656
Conversation
This allows cutomizing the scale subresource by providing key-value items instead of a raw JSON string. For backwards-compatibility, it is still supported to provide a JSON string. However, all examples and tests were converted to the new format. Signed-off-by: Techassi <git@techassi.dev>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1656 +/- ##
=======================================
+ Coverage 75.8% 75.9% +0.1%
=======================================
Files 84 84
Lines 7626 7679 +53
=======================================
+ Hits 5776 5822 +46
- Misses 1850 1857 +7
|
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.
Hey there. Thanks for this! Apologise for the delay.
I think this makes sense, given you've made it non-breaking, but ideally the dependency on the openapi crate should be severed if it's just for the interface. Have added a few suggestive comments.
No worries. I will shortly take a look at your comments. I will also see if we can get rid of the |
Signed-off-by: Techassi <git@techassi.dev>
Sorry for the delayed work on this, but I think I have addressed both of your biggest concerns in d93d708. |
Signed-off-by: Techassi <git@techassi.dev>
Signed-off-by: Techassi <git@techassi.dev>
Signed-off-by: Techassi <git@techassi.dev>
Signed-off-by: Techassi <git@techassi.dev>
Signed-off-by: Techassi <git@techassi.dev>
0a98def
to
7a86117
Compare
Adding this test proved to be very valuable because the FromMeta implemenetation had a few errors and resulted in different panic messages coming from the derive macro. I also added a small note to the #[kube(scale(...))] section stating that the scale subresource can only be used when the status subresource is used as well. I plan to further improve the validation in a future pull request. Signed-off-by: Techassi <git@techassi.dev>
cccc052
to
696d389
Compare
I think this PR is ready. Any objections merging this @clux? |
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.
Any objections merging this
Ahh, sorry, I forgot about this. Had a busy month. Yes, this looks sensible. I had a quick re-look over, and one nit, maybe. See if you agree. Otherwise it's all good. Happy for you to iteate more if you have other ideas.
I think the thing that made this go to the back of my mind for a while was I wasn't sure about the complexity tradeoff here about supporting two modes if we had no good way to deprecate the old one. But I suspect we can gradually phase out the old raw string stuff and simplify this down the line anyway.
Yes, that is indeed a tradeoff. Luckily, we can get rid of most of the added code once we deprecate the old way:
|
Let me know if this answer is satisfactory: #1656 (comment). If so, we can move forward and merge. |
All good. Ill merge. Thank you very much! |
Alright, cool. Thank you as well! |
Motivation
Customizing the
scale
subresource via#[kube(scale = r#"{}"#)]
can feel very out-of-place and requires writing a raw JSON string. In addition, this can lead to a very long line, eg:Solution
This allows customizing the scale subresource by providing key-value items instead of a raw JSON string. For backwards-compatibility, it is still supported to provide a JSON string. However, all examples and tests were converted to the new format.