-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
clientgen: allow to pass custom apiPath when generating client sets #32769
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ var ( | |
includedTypesOverrides = flag.StringSlice("included-types-overrides", []string{}, "list of group/version/type for which client should be generated. By default, client is generated for all types which have genclient=true in types.go. This overrides that. For each groupVersion in this list, only the types mentioned here will be included. The default check of genclient=true will be used for other group versions.") | ||
basePath = flag.String("input-base", "k8s.io/kubernetes/pkg/apis", "base path to look for the api group. Default to \"k8s.io/kubernetes/pkg/apis\"") | ||
clientsetName = flag.StringP("clientset-name", "n", "internalclientset", "the name of the generated clientset package.") | ||
clientsetAPIPath = flag.StringP("clientset-api-path", "", "", "the value of default API path.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. having There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think defaulting to "" is better. We need to distinguish if "/apis" is user specified or if it's the default. It matters because we need to treat the "core" group specially in the latter case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. true, I guess with the ugly "core" special case we have to support there is no clean solution. I am fine with keeping |
||
clientsetPath = flag.String("clientset-path", "k8s.io/kubernetes/pkg/client/clientset_generated/", "the generated clientset will be output to <clientset-path>/<clientset-name>. Default to \"k8s.io/kubernetes/pkg/client/clientset_generated/\"") | ||
clientsetOnly = flag.Bool("clientset-only", false, "when set, client-gen only generates the clientset shell, without generating the individual typed clients") | ||
fakeClient = flag.Bool("fake-clientset", true, "when set, client-gen will generate the fake clientset that can be used in tests") | ||
|
@@ -177,21 +178,22 @@ func main() { | |
if err != nil { | ||
glog.Fatalf("Unexpected error: %v", err) | ||
} | ||
glog.Infof("going to generate clientset from these input paths: %v", inputPath) | ||
glog.V(3).Infof("going to generate clientset from these input paths: %v", inputPath) | ||
arguments.InputDirs = append(inputPath, dependencies...) | ||
|
||
arguments.CustomArgs = clientgenargs.Args{ | ||
GroupVersions: groupVersions, | ||
GroupVersionToInputPath: gvToPath, | ||
ClientsetName: *clientsetName, | ||
ClientsetAPIPath: *clientsetAPIPath, | ||
ClientsetOutputPath: *clientsetPath, | ||
ClientsetOnly: *clientsetOnly, | ||
FakeClient: *fakeClient, | ||
CmdArgs: cmdArgs, | ||
IncludedTypesOverrides: includedTypesOverrides, | ||
} | ||
|
||
glog.Infof("==arguments: %v\n", arguments) | ||
glog.V(3).Infof("==arguments: %v\n", arguments) | ||
} | ||
|
||
if err := arguments.Execute( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any need to make that parametrized as well?