diff --git a/go.sum b/go.sum index 47764a17..fdeb203c 100644 --- a/go.sum +++ b/go.sum @@ -65,6 +65,7 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2Rrd27c3VGxi6a/6HNq8QmHRKM= github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -292,6 +293,8 @@ k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-aggregator v0.31.1 h1:vrYBTTs3xMrpiEsmBjsLETZE9uuX67oQ8B3i1BFfMPw= k8s.io/kube-aggregator v0.31.1/go.mod h1:+aW4NX50uneozN+BtoCxI4g7ND922p8Wy3tWKFDiWVk= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 h1:1dWzkmJrrprYvjGwh9kEUxmcUV/CtNU8QM7h1FLWQOo= k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38/go.mod h1:coRQXBK9NxO98XUv3ZD6AK3xzHCxV6+b7lrquKwaKzA= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= diff --git a/pkg/controller-gen/generators/client_generator.go b/pkg/controller-gen/generators/client_generator.go index ee74dae0..aee0eca3 100644 --- a/pkg/controller-gen/generators/client_generator.go +++ b/pkg/controller-gen/generators/client_generator.go @@ -95,6 +95,7 @@ func (cg *ClientGenerator) typesGroupVersionDocPackage(name *types.Name, gv sche p.HeaderComment = []byte(fmt.Sprintf(` %s +// +k8s:openapi-gen=true // +k8s:deepcopy-gen=package // +groupName=%s `, string(customArgs.BoilerplateContent), gv.Group)) diff --git a/pkg/controller-gen/main.go b/pkg/controller-gen/main.go index 9bc35307..8bd25af4 100644 --- a/pkg/controller-gen/main.go +++ b/pkg/controller-gen/main.go @@ -2,13 +2,13 @@ package controllergen import ( "fmt" + "golang.org/x/exp/maps" "io" "os" "path/filepath" "sort" "strings" - "golang.org/x/exp/maps" "k8s.io/gengo/args" "k8s.io/gengo/v2" "k8s.io/gengo/v2/generator" @@ -284,7 +284,7 @@ func generateOpenAPI(groups map[string]bool, customArgs *cgargs.CustomArgs) erro openAPIArgs := oaargs.New() openAPIArgs.OutputDir = filepath.Join(customArgs.OutputBase, customArgs.Options.OutputPackage, "openapi") openAPIArgs.OutputFile = "zz_generated_openapi.go" - openAPIArgs.OutputPkg = customArgs.Options.OutputPackage + openAPIArgs.OutputPkg = customArgs.Options.OutputPackage + "/openapi" openAPIArgs.GoHeaderFile = customArgs.Options.Boilerplate if err := openAPIArgs.Validate(); err != nil { @@ -315,8 +315,6 @@ func generateOpenAPI(groups map[string]bool, customArgs *cgargs.CustomArgs) erro } } - logrus.Info(inputDirs) - return gengo.Execute( oa.NameSystems(), oa.DefaultNameSystem(),