args := GeneratorArgs{ OutputFilename: "generated.go", // specify the API types we want to generate APIPackages: []string{"k8s.io/api/example/v1alpha1"}, // specify the API group version we want to generate APIGroup: "example.com", APIVersion: "v1alpha1", // set the boilerplate comment text that goes at the top of each generated file Boilerplate: licenseHeader, } generator.Generate(args)
args := GeneratorArgs{ OutputFilename: "generated.go", APIPackages: []string{"k8s.io/api/apps/v1"}, APIGroup: "apps", APIVersion: "v1", Boilerplate: licenseHeader, } generator.Generate(args)In this example, we generate code for the apps API group and version using the k8s.io/api/apps/v1 package. Overall, the GeneratorArgs struct is used for setting various arguments that are needed for code generation in Kubernetes. The struct is part of the k8s.io/kubernetes/cmd/libs/go2idl/args package.