-
Notifications
You must be signed in to change notification settings - Fork 440
controller-gen doesn't work with k8s.io/apiextensions-apiserver #291
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
Comments
Can you share your types.go file containing your API definitions? It looks like you are depending on something in the apiextensions-apiserver API group 🤔 fwiw, #277 is a fix for:
|
@munnerz , yes, you are right, my API definitions depend on the apiextensions-apiserver API group, and thanks for the info :)! |
It looks like similar PRs for the |
Hi @munnerz, yes, you are right, would you mind me working on this? I think your PR is a good example for me to start and I can send the similar PRs for |
I'm curious as to why your types depend on apiextensions. Are you embedding a CRD spec in your types? Just want to make sure we're solving the right problems here |
Gatekeeper is embedding a CRD spec into its |
@jiachengxu and I are also embedding the CRD Spec into one of our resources. |
We might want to better generically detect when something implements the JSON interfaces manually -- we have the typechecking info, so it should be possilbe. /help |
@DirectXMan12: Please ensure the request meets the requirements listed here. If this request no longer meets these requirements, the label can be removed 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. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
I have a type that embeds
@DirectXMan12 If you can give me some pointers, I can work on a PR to make it happen. |
I think someone posted something recently: #427 just waiting on a test |
Great news! I look forward to ditching the old, old version of controller-gen |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale How is this looking? I notice #427 is merged, but this isn't resolved. Is this just an oversight? |
I think this is mostly resolved. Technically, we should have type info for the other types, but we at least have a workaround, so I think we can probably close this for now. |
I'm able to repro this issue on |
@tshak did you use the following CRD option?
That got it going for me. I only figured that out by looking at the PR. Further documentation would make this a lot friendlier. |
Thanks Julian. Sadly that does not work for me:
I'm running
|
Is the following code being vendored in? If gomod is pruning that code for some reason, then the |
It looks like that reversion is in v0.4.1, but not v0.4.0. I can confirm that generating CRDs that embed JSONSchema is broken due to the reversion in #505 @DirectXMan12 Should the reversion be un-reverted? Are there any plans to accommodate embedding JSONSchema in other ways? |
/reopen Re-opening as this issue has been de-mitigated |
@maxsmythe: 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. |
Looks like I don't have permissions to re-open. Can it be re-opened? |
This marker will avoid trying to do any type detection on any struct field on which it is set. This gives users a safety valve when they hit an edge case where type inference does the wrong thing for them. This fixes kubernetes-sigs#291, which was recently re-broken by fixing kubernetes-sigs#502 Signed-off-by: Max Smythe <[email protected]>
This marker will avoid trying to do any type detection on any struct field on which it is set. This gives users a safety valve when they hit an edge case where type inference does the wrong thing for them. This fixes kubernetes-sigs#291, which was recently re-broken by fixing kubernetes-sigs#502 Signed-off-by: Max Smythe <[email protected]>
Hi folks,
I use controller-gen integrated with Kubebuilder to generate RBAC, webhook and CRDs for my project, there is a command called
make manifests
to run:controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
to generate everything, but it doesn't work for me since I have
k8s.io/apiextensions-apiserver
in mygo.mod
as a dependency, the following error messages are poping out:/Users/maxwell/go/pkg/mod/k8s.io/[email protected]/pkg/apis/apiextensions/v1beta1/types_jsonschema.go:63:2: enountered struct field "Raw" without JSON tag in type "JSON" /Users/maxwell/go/pkg/mod/k8s.io/[email protected]/pkg/apis/apiextensions/v1beta1/types_jsonschema.go:29:24: unsupported type "float64" /Users/maxwell/go/pkg/mod/k8s.io/[email protected]/pkg/apis/apiextensions/v1beta1/types_jsonschema.go:31:24: unsupported type "float64" /Users/maxwell/go/pkg/mod/k8s.io/[email protected]/pkg/apis/apiextensions/v1beta1/types_jsonschema.go:39:24: unsupported type "float64" /Users/maxwell/go/pkg/mod/k8s.io/[email protected]/pkg/apis/apiextensions/v1beta1/types_jsonschema.go:85:2: enountered struct field "Schema" without JSON tag in type "JSONSchemaPropsOrArray" /Users/maxwell/go/pkg/mod/k8s.io/[email protected]/pkg/apis/apiextensions/v1beta1/types_jsonschema.go:86:2: enountered struct field "JSONSchemas" without JSON tag in type "JSONSchemaPropsOrArray" /Users/maxwell/go/pkg/mod/k8s.io/[email protected]/pkg/apis/apiextensions/v1beta1/types_jsonschema.go:105:2: enountered struct field "Allows" without JSON tag in type "JSONSchemaPropsOrBool" /Users/maxwell/go/pkg/mod/k8s.io/[email protected]/pkg/apis/apiextensions/v1beta1/types_jsonschema.go:106:2: enountered struct field "Schema" without JSON tag in type "JSONSchemaPropsOrBool" /Users/maxwell/go/pkg/mod/k8s.io/[email protected]/pkg/apis/apiextensions/v1beta1/types_jsonschema.go:127:2: enountered struct field "Schema" without JSON tag in type "JSONSchemaPropsOrStringArray" /Users/maxwell/go/pkg/mod/k8s.io/[email protected]/pkg/apis/apiextensions/v1beta1/types_jsonschema.go:128:2: enountered struct field "Property" without JSON tag in type "JSONSchemaPropsOrStringArray" Error: not all generators ran successfully
Any ideas about why this happened?
Thanks,
Jiacheng
The text was updated successfully, but these errors were encountered: