Skip to content

Commit 6c50aae

Browse files
authored
Merge pull request #1075 from xing-yang/update_code_gen_1.30
Update code-generator to 1.30.0
2 parents 5e3a4ea + 3366d23 commit 6c50aae

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

client/hack/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ Make sure to run this script after making changes to /client/apis/volumesnapshot
2626
```
2727
* Checkout latest release version
2828
```bash
29-
git checkout v0.29.1
29+
git checkout v0.30.0
3030
```
3131

32-
* Ensure the file `generate-groups.sh` exists
32+
* Ensure the file `kube_codegen.sh` exists
3333

3434
```bash
35-
ls ${GOPATH}/src/k8s.io/code-generator/generate-groups.sh
35+
ls ${GOPATH}/src/k8s.io/code-generator/kube_codegen.sh
3636
```
3737

3838
Update generated client code in external-snapshotter
@@ -42,14 +42,13 @@ Update generated client code in external-snapshotter
4242
./hack/update-generated-code.sh
4343
```
4444

45-
Once you run the script, you will get an output as follows:
45+
Once you run the script, the code will be generated for volumesnapshot:v1 and volumegroupsnapshot:v1alpha1, and you will get an output as follows:
4646

4747
```bash
48-
Generating deepcopy funcs
49-
Generating clientset for volumesnapshot:v1 at github.com/kubernetes-csi/external-snapshotter/client/v7/clientset
50-
Generating listers for volumesnapshot:v1 at github.com/kubernetes-csi/external-snapshotter/client/v7/listers
51-
Generating informers for volumesnapshot:v1 at github.com/kubernetes-csi/external-snapshotter/client/v7/informers
52-
48+
Generating deepcopy code for 2 targets
49+
Generating client code for 2 targets
50+
Generating lister code for 2 targets
51+
Generating informer code for 2 targets
5352
```
5453

5554
## update-crd.sh

client/hack/update-generated-code.sh

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,15 @@ set -o pipefail
2020

2121
SCRIPT_ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)
2222

23-
# generate the code with:
24-
# --output-base because this script should also be able to run inside the vendor dir of
25-
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
26-
# instead of the $GOPATH directly. For normal projects this can be dropped.
27-
${GOPATH}/src/k8s.io/code-generator/generate-groups.sh "deepcopy,client,informer,lister" \
28-
github.com/kubernetes-csi/external-snapshotter/client/v7 github.com/kubernetes-csi/external-snapshotter/client/v7/apis \
29-
"volumesnapshot:v1 volumegroupsnapshot:v1alpha1" \
30-
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt
23+
source "${GOPATH}/src/k8s.io/code-generator/kube_codegen.sh"
3124

32-
# To use your own boilerplate text use:
33-
# --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt
25+
kube::codegen::gen_helpers \
26+
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
27+
"${SCRIPT_ROOT}/apis"
3428

35-
# Move generated file from client/v7 to client folder and remove client/v7
36-
cp -rf v7/. .
37-
rm -rf v7
29+
kube::codegen::gen_client \
30+
--output-dir "${SCRIPT_ROOT}" \
31+
--output-pkg "github.com/kubernetes-csi/external-snapshotter/client/v7" \
32+
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
33+
--with-watch \
34+
"${SCRIPT_ROOT}/apis"

0 commit comments

Comments
 (0)