-
Notifications
You must be signed in to change notification settings - Fork 428
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
controller-gen panics when providing schema with nested structs + struct tags #654
Comments
I have the same problem with nested structures.
|
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closing this issue. 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/test-infra repository. |
Still occurs in v0.10.0. /reopen |
@alexg-axis: You can't reopen an issue/PR unless you authored it or you are a collaborator. 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/test-infra repository. |
Still occurs in v0.11.1 also /reopen |
@errordeveloper: You can't reopen an issue/PR unless you authored it or you are a collaborator. 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/test-infra repository. |
Still occurs in v0.15.0 /reopen |
@c3-clement: You can't reopen an issue/PR unless you authored it or you are a collaborator. 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. |
Seems at least reasonable to return a proper error instead of a panic. If we should support it in general probably depends on if it aligns with kubernetes API conventions. /reopen |
@sbueringer: Reopened this issue. 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. |
This issue seems to be similar to Issue #442, but i am not sure if the root cause is the same.
When writing a Schema, containing a nested struct, the
controller-gen
tool panics.will lead to
Specifically, when adding the
json:"test_struct"
tag, the panic is triggered. Leaving it out, leads to a proper error:encountered struct field "TestStruct" without JSON tag in type "MySpec"
.Workaround
a workaround is possible, by specifying the same struct in an explicit way:
My environment
operator-sdk version: "v1.16.0", commit: "560044140c4f3d88677e4ef2872931f5bb97f255", kubernetes version: "v1.21", go version: "go1.17.5", GOOS: "darwin", GOARCH: "amd64"
controller-gen version:
sigs.k8s.io/controller-tools/cmd/[email protected]
. I could reproduce the same error with 0.8.0The text was updated successfully, but these errors were encountered: