diff options
| author | Chao Xu <xuchao@google.com> | 2016-10-31 11:59:48 -0700 |
|---|---|---|
| committer | Chao Xu <xuchao@google.com> | 2016-10-31 15:05:26 -0700 |
| commit | 8a3536fe9bcb6d2636a2e1998d0e07ecc3427dc1 (patch) | |
| tree | f2b222eb16d7d32d1ea778d342ffd67d4418880d | |
| parent | 4b33176486dbc401173a001811404382b493f408 (diff) | |
remove release_1_4
remove archived federation clientsets
update README
| -rw-r--r-- | generating-clientset.md | 67 |
1 files changed, 17 insertions, 50 deletions
diff --git a/generating-clientset.md b/generating-clientset.md index c5c8d698..cbb6141c 100644 --- a/generating-clientset.md +++ b/generating-clientset.md @@ -1,72 +1,39 @@ # Generation and release cycle of clientset -Client-gen is an automatic tool that generates -[clientset](../../docs/proposals/client-package-structure.md#high-level-client-sets) -based on API types. This doc introduces the use the client-gen, and the release -cycle of the generated clientsets. +Client-gen is an automatic tool that generates [clientset](../../docs/proposals/client-package-structure.md#high-level-client-sets) based on API types. This doc introduces the use the client-gen, and the release cycle of the generated clientsets. ## Using client-gen -The workflow includes four steps: -- Marking API types with tags: in `pkg/apis/${GROUP}/${VERSION}/types.go`, mark -the types (e.g., Pods) that you want to generate clients for with the -`// +genclient=true` tag. If the resource associated with the type is not -namespace scoped (e.g., PersistentVolume), you need to append the -`nonNamespaced=true` tag as well. +The workflow includes three steps: -- Running the client-gen tool: you need to use the command line argument -`--input` to specify the groups and versions of the APIs you want to generate -clients for, client-gen will then look into -`pkg/apis/${GROUP}/${VERSION}/types.go` and generate clients for the types you -have marked with the `genclient` tags. For example, running: +1. Marking API types with tags: in `pkg/apis/${GROUP}/${VERSION}/types.go`, mark the types (e.g., Pods) that you want to generate clients for with the `// +genclient=true` tag. If the resource associated with the type is not namespace scoped (e.g., PersistentVolume), you need to append the `nonNamespaced=true` tag as well. -``` -$ client-gen --input="api/v1,extensions/v1beta1" --clientset-name="my_release" -``` +2. + - a. If you are developing in the k8s.io/kubernetes repository, you just need to run hack/update-codegen.sh. -will generate a clientset named "my_release" which includes clients for api/v1 -objects and extensions/v1beta1 objects. You can run `$ client-gen --help` to see -other command line arguments. + - b. If you are running client-gen outside of k8s.io/kubernetes, you need to use the command line argument `--input` to specify the groups and versions of the APIs you want to generate clients for, client-gen will then look into `pkg/apis/${GROUP}/${VERSION}/types.go` and generate clients for the types you have marked with the `genclient` tags. For example, to generated a clientset named "my_release" including clients for api/v1 objects and extensions/v1beta1 objects, you need to run: -- ***Adding expansion methods***: client-gen only generates the common methods, - such as `Create()` and `Delete()`. You can manually add additional methods - through the expansion interface. For example, this - [file](../../pkg/client/clientset_generated/release_1_4/typed/core/v1/pod_expansion.go) - adds additional methods to Pod's client. As a convention, we put the expansion - interface and its methods in file ${TYPE}_expansion.go. In most cases, you - don't want to remove existing expansion files. So to make life easier, - instead of creating a new clientset from scratch, ***you can copy and rename an - existing clientset (so that all the expansion files are copied)***, and then run - client-gen. +``` +$ client-gen --input="api/v1,extensions/v1beta1" --clientset-name="my_release" +``` -- Generating fake clients for testing purposes: client-gen will generate a fake -clientset if the command line argument `--fake-clientset` is set. The fake -clientset provides the default implementation, you only need to fake out the -methods you care about when writing test cases. +3. ***Adding expansion methods***: client-gen only generates the common methods, such as CRUD. You can manually add additional methods through the expansion interface. For example, this [file](../../pkg/client/clientset_generated/release_1_5/typed/core/v1/pod_expansion.go) adds additional methods to Pod's client. As a convention, we put the expansion interface and its methods in file ${TYPE}_expansion.go. In most cases, you don't want to remove existing expansion files. So to make life easier, instead of creating a new clientset from scratch, ***you can copy and rename an existing clientset (so that all the expansion files are copied)***, and then run client-gen. -The output of client-gen includes: +## Output of client-gen -- clientset: the clientset will be generated at -`pkg/client/clientset_generated/` by default, and you can change the path via -the `--clientset-path` command line argument. +- clientset: the clientset will be generated at `pkg/client/clientset_generated/` by default, and you can change the path via the `--clientset-path` command line argument. - Individual typed clients and client for group: They will be generated at `pkg/client/clientset_generated/${clientset_name}/typed/generated/${GROUP}/${VERSION}/` ## Released clientsets -At the 1.2 release, we have two released clientsets in the repo: -internalclientset and release_1_2. +If you are contributing code to k8s.io/kubernetes, try to use the release_X_Y clientset in this [directory](../../pkg/client/clientset_generated/). + +If you need a stable Go client to build your own project, please refer to the [client-go repository](https://github.com/kubernetes/client-go). -- internalclientset: because most components in our repo still deal with the -internal objects, the internalclientset talks in internal objects to ease the -adoption of clientset. We will keep updating it as our API evolves. Eventually -it will be replaced by a versioned clientset. +We are migrating k8s.io/kubernetes to use client-go as well, see issue [#35159](https://github.com/kubernetes/kubernetes/issues/35159). -- release_1_2: release_1_2 clientset is a versioned clientset, it includes -clients for the core v1 objects, extensions/v1beta1, autoscaling/v1, and -batch/v1 objects. We will NOT update it after we cut the 1.2 release. After the -1.2 release, we will create release_1_3 clientset and keep it updated until we -cut release 1.3. +<!-- BEGIN MUNGE: GENERATED_ANALYTICS --> []() <!-- END MUNGE: GENERATED_ANALYTICS --> <!-- BEGIN MUNGE: GENERATED_ANALYTICS --> |
