Repository navigation
🌱Add envtest tests for +kubebuilder:default={} with nested field defaults - #1392
Conversation
|
This seems like a breaking change to me. Additional I think the CRDs we generate already behave this way as the apiserver recursively defaults top down |
a1617c1 to
61c75f1
Compare
a393310 to
92bcaf9
Compare
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
92bcaf9 to
7bf3534
Compare
7bf3534 to
5b00aab
Compare
5b00aab to
6795224
Compare
ac6b199 to
28e6c25
Compare
|
Hi @sbueringer, Sorry, I took a closer look at this, and you're absolutely right to push back. I also read your comment on the issue, and I agree. We could add tests to verify the current behavior, but I don't think this warrants keeping the issue open. I'll leave a comment on the issue and suggest we close it. |
|
This doesn't really test our behaviour so much as it tests the API server behaviour, but I guess if that's beneficial to make sure that if the upstream behaviour changes, that we can handle it, then I'm ~ok with merging this /lgtm @sbueringer do you agree? |
|
LGTM label has been added. DetailsGit tree hash: b953854e8253fd092eef1fd57c00a956a5d015fd |
|
Hi @sbueringer, Could you please help with this one? After taking a deeper look and revisiting your comment, I completely agree with your feedback. We're only adding tests here now, as discussed: #622 (comment) Thank you so much for your help! |
Agree. controller-gen just takes the default values from the markers and sets them in the corresponding fields in the CRD. I assume we already have sufficient test coverage for this. Accordingly this PR just adds regression test coverage for the defaulting code in the kube-apiserver. I would assume and hope that this test coverage already exists in the k/k repository and they don't intentionally make breaking changes to the v1 CRD API.
Independent of that, as Joel's okay with it and I don't have a strong objection against it, I"m fine with adding this test coverage. But can we please change this test to use envtest so it tests actual kube-apiserver behavior? This would not be guaranteed if we directly call the same functions that the apiserver is currently calling internally. Additionally the maintenance effort for the test should be lower if we don't have to keep the test code in sync with the kube-apiserver code. Please also change the PR title to refer to what we are testing vs. just pointing to an issue. |
28e6c25 to
0c68234
Compare
|
Hi @sbueringer Thank you for looking this one.
That was indeed a good idea and suggestion done ! |
|
Thx /lgtm /assign @JoelSpeed |
|
LGTM label has been added. DetailsGit tree hash: f1c6055a2ab81ac808a5f2f5b23fd3727734ce02 |
|
@JoelSpeed could you give a help here for we get this one merged? c/c @sbueringer |
|
I think it's okay, let's merge /lgtm |

Adds test coverage for the scenarios in #622 (+kubebuilder:default={} on a pointer field whose nested fields have their own defaults)