controller-tools: map values must be a named type

My apis package has a Go struct that is not a CRD. But controller-gen keeps throwing the following error:

Generating CRD manifests
/go/src/kubedb.dev/apimachinery/apis/kubedb/v1alpha1/report.go:21:27: map values must be a named type, not *ast.StarExpr
/go/src/kubedb.dev/apimachinery/apis/kubedb/v1alpha1/report.go:22:27: map values must be a named type, not *ast.StarExpr
Error: not all generators ran successfully
// +kubebuilder:object:root=false
// +k8s:deepcopy-gen=false
// +k8s:gen-deepcopy=false
type ReportSummary struct {
	Postgres      map[string]*PostgresSummary      `json:"postgres,omitempty"`
	Elasticsearch map[string]*ElasticsearchSummary `json:"elastic,omitempty"`
}

Full Example: https://github.com/kubedb/apimachinery/blob/report-kubebuilder-bug/apis/kubedb/v1alpha1/report.go

Clone and checkout this branch and then run make gen to reproduce.

How do I tell controller-gen to ignore this struct?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 10
  • Comments: 20 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@tamalsaha try to use the latest controlller-gen in master branch

GO111MODULE=on go get -v sigs.k8s.io/controller-tools/cmd/controller-gen@master

and re-generate will be work