-
Notifications
You must be signed in to change notification settings - Fork 426
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
🐛 pkg/crd: fix alias type parsing for struct type alias #1122
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Mahe Tardy <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mtardy The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @mtardy. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions 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. |
/cc sbueringer @tsaarni |
@mtardy: GitHub didn't allow me to request PR reviews from the following users: tsaarni. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions 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. |
Using Underlying() was working for basic types but was resolving "too far" for more complex type, as for the structure. I.e. instead of retrieving the new type for aliased, it actually retrieved the underyling (who could have guessed) actual type. For example, for a string alias, we have: - Alias type info: testdata.kubebuilder.io/cronjob.StringAlias - Rhs from the alias def: string - Underlying from the alias: string But for a struct alias, we have: - Alias type info: testdata.kubebuilder.io/cronjob.InlineAlias - Rhs from the alias def: testdata.kubebuilder.io/cronjob.EmbeddedStruct - Underlying from the alias: struct{FromEmbedded string "json:\"fromEmbedded,omitempty\""} I also imagine that we don't handle nested alias, but this is for another patch. Signed-off-by: Mahe Tardy <[email protected]>
User tsaarni bumped into a panic when using embedded/inline field with a type alias and that Alias types are enabled in Go. They thankfully included a reproducer that is shipped in this patch from the issue kubernetes-sigs#1088. Co-authored-by: Tero Saarni <[email protected]> Signed-off-by: Mahe Tardy <[email protected]>
470bfea
to
cf0446d
Compare
Btw @sbueringer I'm a member of @kubernetes, do you know how hard it would be to be added to @kubernetes-sigs? |
Turns out it was fairly easy, kubernetes/org#5326. /ok-to-test |
@mtardy: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions 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. |
well, I was a bit too early /ok-to-test |
Related, maybe: #1119 |
Fixes #1088.
This was actually breaking all struct type alias I think, not especially when using embedded/inline struct.
I tested that both should pass: