Skip to content

Commit 505542b

Browse files
authored
Merge pull request #265 from alex1989hu/doc/add-v2-code-generator-readme
doc: add workaround for hack/update-generated-code.sh
2 parents 7af2d0f + 14eaac2 commit 505542b

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

hack/README.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,35 @@ This is the script to update clientset/informers/listers and API deepcopy code u
1010

1111
Make sure to run this script after making changes to /pkg/apis/volumesnapshot/v1beta1/types.go.
1212

13-
To run this script, simply run: ./hack/update-generated-code.sh from the project root directory.
13+
To run this script, you have to patch it:
14+
```patch
15+
diff --git a/hack/update-generated-code.sh b/hack/update-generated-code.sh
16+
--- a/hack/update-generated-code.sh
17+
+++ b/hack/update-generated-code.sh
18+
@@ -27,7 +27,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge
19+
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
20+
# instead of the $GOPATH directly. For normal projects this can be dropped.
21+
bash ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
22+
- github.com/kubernetes-csi/external-snapshotter/pkg/client github.com/kubernetes-csi/external-snapshotter/pkg/apis \
23+
+ github.com/kubernetes-csi/external-snapshotter/v2/pkg/client github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis \
24+
volumesnapshot:v1beta1 \
25+
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt
26+
```
27+
28+
Once you are done with patching, continue:
29+
```bash
30+
rm -fr v2/
31+
ln -sfvn $(pwd) v2
32+
rm -fr pkg/client
33+
```
34+
35+
Run: ./hack/update-generated-code.sh from the project root directory.
36+
37+
Do not forget to revert previously applied workaround:
38+
```bash
39+
git checkout -- v2/
40+
git checkout -- hack/update-generated-code.sh
41+
```
1442

1543
## update-crd.sh
1644

0 commit comments

Comments
 (0)