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
- Special-case handling of map[string]map[string]interface{} These are converted to map[string]JSON, because controller-gen has issues with maps of maps. https://github.com/kubernetes-sigs/controller-t... — committed to babbageclunk/k8s-infra by babbageclunk 4 years ago
- Special-case handling of map[string]map[string]interface{} These are converted to map[string]JSON, because controller-gen has issues with maps of maps. https://github.com/kubernetes-sigs/controller-t... — committed to babbageclunk/k8s-infra by babbageclunk 4 years ago
- Special-case handling of map[string]map[string]interface{} These are converted to map[string]JSON, because controller-gen has issues with maps of maps. https://github.com/kubernetes-sigs/controller-t... — committed to babbageclunk/k8s-infra by babbageclunk 4 years ago
- Special-case handling of map[string]map[string]interface{} These are converted to map[string]JSON, because controller-gen has issues with maps of maps. https://github.com/kubernetes-sigs/controller-t... — committed to babbageclunk/k8s-infra by babbageclunk 4 years ago
- Special-case handling of map[string]map[string]interface{} These are converted to map[string]JSON, because controller-gen has issues with maps of maps. https://github.com/kubernetes-sigs/controller-t... — committed to babbageclunk/k8s-infra by babbageclunk 4 years ago
- Replace AnyTypes with apiextensions.JSON (#295) * Add pipeline stage to replace AnyType with apiextension.JSON Allowing arbitrary JSON in these fields makes sense since they're underconstrained ... — committed to Azure/k8s-infra by babbageclunk 4 years ago
@tamalsaha try to use the latest controlller-gen in master branch
and re-generate will be work