-
--input-dir
- The directory path where APIs are defined. Make sure that the types are defined in<inputDir>/pkg/apis/{$GROUP}/{$VERSION}
. For example, if your input apis are defined intypes.go
insidetestdata/pkg/apis/apps/v1/types.go
, the input directory should be specified astestdata/pkg
.{$GROUP}/{$VERSION}
is appended in the input path. Note: This is the relative path to the input directory where APIs live. -
--output-dir
- The directory where output clients are to be generated. It defaults to theclientset
folder under current working directory.Clientset
wrappers would be generated inside<outputDir>/<clientset-name>/clientset.go
.- Individual typed client wrappers would be inside
<outputDir>/<clientset-name>/${GROUP}/${VERSION}/${group_version}.go
.
-
--clientset-api-path
- The path to whereclientset
generated byk8s.io/code-gen
is present. -
--clientset-name
- The name of the generated clientset package. It defaults toclientset
. -
--group-versions
- List of group versions in the formatgroup:version
. Define multiple groups by specifying the flag again. For example, the inputs can be:--group-version="apps:v1"
--group-versions="rbac:v1" --group-versions="apps:v1"
--group-version="rbac:v1,v2"
-
--go-header-file
- Path to the header file.
Example: To run it locally and see how it works, use the following command:
go run main.go client --clientset-name clusterclient --go-header-file testdata/header.txt
--clientset-api-path=github.com/kcp-dev/code-generator/testdata/pkg/generated/clientset/versioned
--input-dir testdata/pkg/apis
--output-dir testdata/pkg --group-versions example:v1
will create an output folder in testdata/pkg/clientset
.