Skip to content
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 fails when using type URL #552

Closed
Ruminateer opened this issue Mar 31, 2021 · 4 comments · Fixed by #601
Closed

controller-gen fails when using type URL #552

Ruminateer opened this issue Mar 31, 2021 · 4 comments · Fixed by #601
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@Ruminateer
Copy link

I am trying to run a Kubebuilder project that uses Knative at https://github.com/PaddleFlow/ElasticServing. I got the exact same issue as #391. I am using controller-gen v0.5.0.

$ make install
/home/zzy/go/bin/controller-gen "crd:maxDescLen=0" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/usr/lib/go-1.13/src/net/url/url.go:357:2: encountered struct field "Scheme" without JSON tag in type "URL"
/usr/lib/go-1.13/src/net/url/url.go:358:2: encountered struct field "Opaque" without JSON tag in type "URL"
/usr/lib/go-1.13/src/net/url/url.go:359:2: encountered struct field "User" without JSON tag in type "URL"
/usr/lib/go-1.13/src/net/url/url.go:360:2: encountered struct field "Host" without JSON tag in type "URL"
/usr/lib/go-1.13/src/net/url/url.go:361:2: encountered struct field "Path" without JSON tag in type "URL"
/usr/lib/go-1.13/src/net/url/url.go:362:2: encountered struct field "RawPath" without JSON tag in type "URL"
/usr/lib/go-1.13/src/net/url/url.go:363:2: encountered struct field "ForceQuery" without JSON tag in type "URL"
/usr/lib/go-1.13/src/net/url/url.go:364:2: encountered struct field "RawQuery" without JSON tag in type "URL"
/usr/lib/go-1.13/src/net/url/url.go:365:2: encountered struct field "Fragment" without JSON tag in type "URL"
ElasticServing/pkg/apis/elasticserving/v1:-: conflicting types in allOf branches in schema: string vs object
Error: not all generators ran successfully
run `controller-gen crd:maxDescLen=0 rbac:roleName=manager-role webhook paths=./... output:crd:artifacts:config=config/crd/bases -w` to see all available markers, or `controller-gen crd:maxDescLen=0 rbac:roleName=manager-role webhook paths=./... output:crd:artifacts:config=config/crd/bases -h` for usage
make: *** [Makefile:43: manifests] Error 1

I am opening this issue as #391 is closed but seems unresolved. Any update or any workaround on this?

@Ruminateer
Copy link
Author

I contacted the project author and is able to generate CRD with controller-gen@v0.3.1-0.20200528125929-5c0c6ae3b64b. Why this works with the older version but doesn't work with the newest version?

@markusthoemmes
Copy link
Contributor

Somewhat related to this, not even type aliases that I tried to force to validate as a string type seem to be working. Here's a quick reproducer https://github.com/kubernetes-sigs/controller-tools/compare/master...markusthoemmes:url-repro?expand=1.

Am I holding this wrong or are we looking at a bug?

@DeanBrunt
Copy link

DeanBrunt commented May 22, 2021

I'm observing the same behaviour as @markusthoemmes .
I've got a type similar to IntOrString that for validation I want checked as a string. Even when I try and force the type validation using a marker comment, it still fails with the missing json struct tag error.

@k8s-triage-robot
Copy link

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants