|
1 |
| -# apis |
| 1 | +## Introduction |
| 2 | +volcano-sh/api aims to provide a flexible way to generate CRD informer/clientset/lister with the Kubernetes version you |
| 3 | +need by separating api package with main repository. |
| 4 | +## Getting Started |
| 5 | +1. Clone the repository to local. |
| 6 | +```shell |
| 7 | +git clone https://github.com/openshift-evangelists/crd-code-generation.git |
| 8 | +``` |
| 9 | +2. Update the Kubernetes version in go.mod to what you want. Current release is taking v0.19.6 as an example. |
| 10 | +```go |
| 11 | +module volcano.sh/apis |
| 12 | + |
| 13 | +go 1.13 |
| 14 | + |
| 15 | +require ( |
| 16 | + k8s.io/api v0.19.6 |
| 17 | + k8s.io/apimachinery v0.19.6 |
| 18 | + k8s.io/apiserver v0.19.6 |
| 19 | + k8s.io/client-go v0.19.6 |
| 20 | + k8s.io/code-generator v0.20.4 // indirect |
| 21 | + k8s.io/klog v1.0.0 |
| 22 | +) |
| 23 | + |
| 24 | +replace ( |
| 25 | + k8s.io/api => k8s.io/api v0.19.6 |
| 26 | + k8s.io/apimachinery => k8s.io/apimachinery v0.19.6 |
| 27 | + k8s.io/apiserver => k8s.io/apiserver v0.19.6 |
| 28 | + k8s.io/client-go => k8s.io/client-go v0.19.6 |
| 29 | + k8s.io/klog => k8s.io/klog v1.0.0 |
| 30 | +) |
| 31 | +``` |
| 32 | +3. Execute the script hack/update-codegen.sh and you will get the CRD clientset in github.com/volcano-sh/apis/pkg/client, |
| 33 | +which is under $GOPATH/src |
| 34 | +```shell |
| 35 | +bash hack/update-codegen.sh |
| 36 | + |
| 37 | +# expected output as follows: |
| 38 | +Generating deepcopy funcs |
| 39 | +Generating clientset for batch.volcano.sh:v1alpha1 at github.com/volcano-sh/apis/pkg/client/clientset |
| 40 | +Generating listers for batch.volcano.sh:v1alpha1 at github.com/volcano-sh/apis/pkg/client/listers |
| 41 | +Generating informers for batch.volcano.sh:v1alpha1 at github.com/volcano-sh/apis/pkg/client/informers |
| 42 | +Generating deepcopy funcs |
| 43 | +Generating clientset for bus.volcano.sh:v1alpha1 at github.com/volcano-sh/apis/pkg/client/clientset |
| 44 | +Generating listers for bus.volcano.sh:v1alpha1 at github.com/volcano-sh/apis/pkg/client/listers |
| 45 | +Generating informers for bus.volcano.sh:v1alpha1 at github.com/volcano-sh/apis/pkg/client/informers |
| 46 | +Generating deepcopy funcs |
| 47 | +Generating clientset for scheduling.volcano.sh:v1beta1 at github.com/volcano-sh/apis/pkg/client/clientset |
| 48 | +Generating listers for scheduling.volcano.sh:v1beta1 at github.com/volcano-sh/apis/pkg/client/listers |
| 49 | +Generating informers for scheduling.volcano.sh:v1beta1 at github.com/volcano-sh/apis/pkg/client/informers |
| 50 | +``` |
0 commit comments