Skip to content

Commit

Permalink
Merge pull request kubernetes-csi#1075 from xing-yang/update_code_gen…
Browse files Browse the repository at this point in the history
…_1.30

Update code-generator to 1.30.0
  • Loading branch information
k8s-ci-robot authored May 13, 2024
2 parents 5e3a4ea + 3366d23 commit 6c50aae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
17 changes: 8 additions & 9 deletions client/hack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ Make sure to run this script after making changes to /client/apis/volumesnapshot
```
* Checkout latest release version
```bash
git checkout v0.29.1
git checkout v0.30.0
```

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

```bash
ls ${GOPATH}/src/k8s.io/code-generator/generate-groups.sh
ls ${GOPATH}/src/k8s.io/code-generator/kube_codegen.sh
```

Update generated client code in external-snapshotter
Expand All @@ -42,14 +42,13 @@ Update generated client code in external-snapshotter
./hack/update-generated-code.sh
```

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

```bash
Generating deepcopy funcs
Generating clientset for volumesnapshot:v1 at github.com/kubernetes-csi/external-snapshotter/client/v7/clientset
Generating listers for volumesnapshot:v1 at github.com/kubernetes-csi/external-snapshotter/client/v7/listers
Generating informers for volumesnapshot:v1 at github.com/kubernetes-csi/external-snapshotter/client/v7/informers
Generating deepcopy code for 2 targets
Generating client code for 2 targets
Generating lister code for 2 targets
Generating informer code for 2 targets
```

## update-crd.sh
Expand Down
23 changes: 10 additions & 13 deletions client/hack/update-generated-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,15 @@ set -o pipefail

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

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

# To use your own boilerplate text use:
# --go-header-file ${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt
kube::codegen::gen_helpers \
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
"${SCRIPT_ROOT}/apis"

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

0 comments on commit 6c50aae

Please sign in to comment.